From d8b31ac40c423272aa0acad3413e3039ff8526a9 Mon Sep 17 00:00:00 2001 From: arshabbir Date: Wed, 3 Jul 2024 21:40:47 +0530 Subject: [PATCH] feat(Resource Controller): Added onetime_credentials property in ResourceInstance and ResourceKey schemas Signed-off-by: arshabbir --- .../v2/ResourceController.java | 7 +- .../model/CreateResourceInstanceOptions.java | 11 +- .../v2/model/ListReclamationsOptions.java | 29 ++++- .../v2/model/ResourceInstance.java | 17 ++- .../v2/model/ResourceKey.java | 17 ++- .../model/UpdateResourceInstanceOptions.java | 7 +- .../v2/ResourceControllerIT.java | 2 + .../v2/ResourceControllerTest.java | 115 +++++++++--------- .../v2/model/ResourceInstanceTest.java | 3 +- .../v2/model/ResourceKeyTest.java | 3 +- 10 files changed, 142 insertions(+), 69 deletions(-) diff --git a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceController.java b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceController.java index 0dd349cd44..c9d854e4b7 100644 --- a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceController.java +++ b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceController.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2022. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -12,7 +12,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-f381b8c9-20221101-115055 + * IBM OpenAPI SDK Code Generator Version: 3.91.0-d9755c53-20240605-153412 */ package com.ibm.cloud.platform_services.resource_controller.v2; @@ -1018,6 +1018,9 @@ public ServiceCall listReclamations(ListReclamationsOptions li if (listReclamationsOptions.resourceInstanceId() != null) { builder.query("resource_instance_id", String.valueOf(listReclamationsOptions.resourceInstanceId())); } + if (listReclamationsOptions.resourceGroupId() != null) { + builder.query("resource_group_id", String.valueOf(listReclamationsOptions.resourceGroupId())); + } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); diff --git a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/CreateResourceInstanceOptions.java b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/CreateResourceInstanceOptions.java index 32c66c1f00..127d060ef7 100644 --- a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/CreateResourceInstanceOptions.java +++ b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/CreateResourceInstanceOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2022. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ + package com.ibm.cloud.platform_services.resource_controller.v2.model; import java.util.ArrayList; @@ -92,9 +93,9 @@ public CreateResourceInstanceOptions build() { } /** - * Adds an tags to tags. + * Adds a new element to tags. * - * @param tags the new tags + * @param tags the new element to be added * @return the CreateResourceInstanceOptions builder */ public Builder addTags(String tags) { @@ -299,7 +300,9 @@ public Boolean allowCleanup() { /** * Gets the parameters. * - * Configuration options represented as key-value pairs that are passed through to the target resource brokers. + * Configuration options represented as key-value pairs that are passed through to the target resource brokers. Set + * the `onetime_credentials` property to specify whether newly created resource key credentials can be retrieved by + * using get resource key or get a list of all of the resource keys requests. * * @return the parameters */ diff --git a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ListReclamationsOptions.java b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ListReclamationsOptions.java index 7c3f931eda..c4b52078d4 100644 --- a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ListReclamationsOptions.java +++ b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ListReclamationsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2022. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ + package com.ibm.cloud.platform_services.resource_controller.v2.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -21,6 +22,7 @@ public class ListReclamationsOptions extends GenericModel { protected String accountId; protected String resourceInstanceId; + protected String resourceGroupId; /** * Builder. @@ -28,6 +30,7 @@ public class ListReclamationsOptions extends GenericModel { public static class Builder { private String accountId; private String resourceInstanceId; + private String resourceGroupId; /** * Instantiates a new Builder from an existing ListReclamationsOptions instance. @@ -37,6 +40,7 @@ public static class Builder { private Builder(ListReclamationsOptions listReclamationsOptions) { this.accountId = listReclamationsOptions.accountId; this.resourceInstanceId = listReclamationsOptions.resourceInstanceId; + this.resourceGroupId = listReclamationsOptions.resourceGroupId; } /** @@ -75,6 +79,17 @@ public Builder resourceInstanceId(String resourceInstanceId) { this.resourceInstanceId = resourceInstanceId; return this; } + + /** + * Set the resourceGroupId. + * + * @param resourceGroupId the resourceGroupId + * @return the ListReclamationsOptions builder + */ + public Builder resourceGroupId(String resourceGroupId) { + this.resourceGroupId = resourceGroupId; + return this; + } } protected ListReclamationsOptions() { } @@ -82,6 +97,7 @@ protected ListReclamationsOptions() { } protected ListReclamationsOptions(Builder builder) { accountId = builder.accountId; resourceInstanceId = builder.resourceInstanceId; + resourceGroupId = builder.resourceGroupId; } /** @@ -114,5 +130,16 @@ public String accountId() { public String resourceInstanceId() { return resourceInstanceId; } + + /** + * Gets the resourceGroupId. + * + * The ID of the resource group. + * + * @return the resourceGroupId + */ + public String resourceGroupId() { + return resourceGroupId; + } } diff --git a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceInstance.java b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceInstance.java index 43e90a8cdb..c0b6dbff53 100644 --- a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceInstance.java +++ b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceInstance.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2022. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ + package com.ibm.cloud.platform_services.resource_controller.v2.model; import java.util.Date; @@ -84,6 +85,8 @@ public interface State { protected String resourceGroupCrn; @SerializedName("target_crn") protected String targetCrn; + @SerializedName("onetime_credentials") + protected Boolean onetimeCredentials; protected Map parameters; @SerializedName("allow_cleanup") protected Boolean allowCleanup; @@ -346,6 +349,18 @@ public String getTargetCrn() { return targetCrn; } + /** + * Gets the onetimeCredentials. + * + * Whether newly created resource key credentials can be retrieved by using get resource key or get a list of all of + * the resource keys requests. + * + * @return the onetimeCredentials + */ + public Boolean isOnetimeCredentials() { + return onetimeCredentials; + } + /** * Gets the parameters. * diff --git a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceKey.java b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceKey.java index 16dd4fc713..221549aa0f 100644 --- a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceKey.java +++ b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceKey.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2022. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ + package com.ibm.cloud.platform_services.resource_controller.v2.model; import java.util.Date; @@ -48,6 +49,8 @@ public class ResourceKey extends GenericModel { protected String resourceGroupId; @SerializedName("resource_id") protected String resourceId; + @SerializedName("onetime_credentials") + protected Boolean onetimeCredentials; protected Credentials credentials; @SerializedName("iam_compatible") protected Boolean iamCompatible; @@ -236,6 +239,18 @@ public String getResourceId() { return resourceId; } + /** + * Gets the onetimeCredentials. + * + * Whether newly created resource key credentials can be retrieved by using get resource key or get a list of all of + * the resource keys requests. + * + * @return the onetimeCredentials + */ + public Boolean isOnetimeCredentials() { + return onetimeCredentials; + } + /** * Gets the credentials. * diff --git a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/UpdateResourceInstanceOptions.java b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/UpdateResourceInstanceOptions.java index a41dfca59b..bddc93672a 100644 --- a/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/UpdateResourceInstanceOptions.java +++ b/modules/resource-controller/src/main/java/com/ibm/cloud/platform_services/resource_controller/v2/model/UpdateResourceInstanceOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2022. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ + package com.ibm.cloud.platform_services.resource_controller.v2.model; import java.util.Map; @@ -177,7 +178,9 @@ public String name() { /** * Gets the parameters. * - * The new configuration options for the instance. + * The new configuration options for the instance. Set the `onetime_credentials` property to specify whether newly + * created resource key credentials can be retrieved by using get resource key or get a list of all of the resource + * keys requests. * * @return the parameters */ diff --git a/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceControllerIT.java b/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceControllerIT.java index d0f3fb0908..a45757496e 100644 --- a/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceControllerIT.java +++ b/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceControllerIT.java @@ -242,6 +242,7 @@ public void test01GetResourceInstance() { ResourceInstance result = response.getResult(); assertNotNull(result); + assertNotNull(result.isOnetimeCredentials()); assertEquals(result.getId(), testInstanceCrn); assertEquals(result.getGuid(), testInstanceGuid); assertEquals(result.getCrn(), testInstanceCrn); @@ -915,6 +916,7 @@ public void test19GetResourceKey() { ResourceKey result = response.getResult(); assertNotNull(result); + assertNotNull(result.isOnetimeCredentials()); assertEquals(result.getId(), testInstanceKeyCrn); assertEquals(result.getGuid(), testInstanceKeyGuid); assertEquals(result.getCrn(), testInstanceKeyCrn); diff --git a/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceControllerTest.java b/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceControllerTest.java index fd5a39d6b7..7ea47db2fe 100644 --- a/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceControllerTest.java +++ b/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/ResourceControllerTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2022, 2023. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,29 +10,16 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ -package com.ibm.cloud.platform_services.resource_controller.v2; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.fail; - -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 org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; +package com.ibm.cloud.platform_services.resource_controller.v2; +import com.ibm.cloud.platform_services.resource_controller.v2.ResourceController; import com.ibm.cloud.platform_services.resource_controller.v2.model.CancelLastopResourceInstanceOptions; import com.ibm.cloud.platform_services.resource_controller.v2.model.CreateResourceAliasOptions; import com.ibm.cloud.platform_services.resource_controller.v2.model.CreateResourceBindingOptions; import com.ibm.cloud.platform_services.resource_controller.v2.model.CreateResourceInstanceOptions; import com.ibm.cloud.platform_services.resource_controller.v2.model.CreateResourceKeyOptions; +import com.ibm.cloud.platform_services.resource_controller.v2.model.Credentials; import com.ibm.cloud.platform_services.resource_controller.v2.model.DeleteResourceAliasOptions; import com.ibm.cloud.platform_services.resource_controller.v2.model.DeleteResourceBindingOptions; import com.ibm.cloud.platform_services.resource_controller.v2.model.DeleteResourceInstanceOptions; @@ -50,6 +37,7 @@ import com.ibm.cloud.platform_services.resource_controller.v2.model.ListResourceKeysForInstanceOptions; import com.ibm.cloud.platform_services.resource_controller.v2.model.ListResourceKeysOptions; import com.ibm.cloud.platform_services.resource_controller.v2.model.LockResourceInstanceOptions; +import com.ibm.cloud.platform_services.resource_controller.v2.model.PlanHistoryItem; import com.ibm.cloud.platform_services.resource_controller.v2.model.Reclamation; import com.ibm.cloud.platform_services.resource_controller.v2.model.ReclamationsList; import com.ibm.cloud.platform_services.resource_controller.v2.model.ResourceAlias; @@ -62,6 +50,7 @@ import com.ibm.cloud.platform_services.resource_controller.v2.model.ResourceBindingsList; import com.ibm.cloud.platform_services.resource_controller.v2.model.ResourceBindingsPager; import com.ibm.cloud.platform_services.resource_controller.v2.model.ResourceInstance; +import com.ibm.cloud.platform_services.resource_controller.v2.model.ResourceInstanceLastOperation; import com.ibm.cloud.platform_services.resource_controller.v2.model.ResourceInstancesList; import com.ibm.cloud.platform_services.resource_controller.v2.model.ResourceInstancesPager; import com.ibm.cloud.platform_services.resource_controller.v2.model.ResourceKey; @@ -77,11 +66,23 @@ import com.ibm.cloud.platform_services.resource_controller.v2.model.UpdateResourceKeyOptions; import com.ibm.cloud.platform_services.resource_controller.v2.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 com.ibm.cloud.sdk.core.util.DateUtils; +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 ResourceController service. @@ -105,7 +106,7 @@ public void testConstructorWithNullAuthenticator() throws Throwable { @Test public void testListResourceInstancesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"rows_count\": 9, \"next_url\": \"nextUrl\", \"resources\": [{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}]}"; + String mockResponseBody = "{\"rows_count\": 9, \"next_url\": \"nextUrl\", \"resources\": [{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"onetime_credentials\": true, \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}]}"; String listResourceInstancesPath = "/v2/resource_instances"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -172,8 +173,8 @@ public void testListResourceInstancesWRetries() throws Throwable { @Test public void testListResourceInstancesWithPagerGetNext() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"scheduled_reclaim_at\":\"2019-01-01T12:00:00.000Z\",\"restored_at\":\"2019-01-01T12:00:00.000Z\",\"restored_by\":\"restoredBy\",\"scheduled_reclaim_by\":\"scheduledReclaimBy\",\"name\":\"name\",\"region_id\":\"regionId\",\"account_id\":\"accountId\",\"reseller_channel_id\":\"resellerChannelId\",\"resource_plan_id\":\"resourcePlanId\",\"resource_group_id\":\"resourceGroupId\",\"resource_group_crn\":\"resourceGroupCrn\",\"target_crn\":\"targetCrn\",\"parameters\":{\"anyKey\":\"anyValue\"},\"allow_cleanup\":true,\"crn\":\"crn\",\"state\":\"active\",\"type\":\"type\",\"sub_type\":\"subType\",\"resource_id\":\"resourceId\",\"dashboard_url\":\"dashboardUrl\",\"last_operation\":{\"type\":\"type\",\"state\":\"in progress\",\"sub_type\":\"subType\",\"async\":false,\"description\":\"description\",\"reason_code\":\"reasonCode\",\"poll_after\":9,\"cancelable\":true,\"poll\":true},\"resource_aliases_url\":\"resourceAliasesUrl\",\"resource_bindings_url\":\"resourceBindingsUrl\",\"resource_keys_url\":\"resourceKeysUrl\",\"plan_history\":[{\"resource_plan_id\":\"resourcePlanId\",\"start_date\":\"2019-01-01T12:00:00.000Z\",\"requestor_id\":\"requestorId\"}],\"migrated\":true,\"extensions\":{\"anyKey\":\"anyValue\"},\"controlled_by\":\"controlledBy\",\"locked\":true}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"scheduled_reclaim_at\":\"2019-01-01T12:00:00.000Z\",\"restored_at\":\"2019-01-01T12:00:00.000Z\",\"restored_by\":\"restoredBy\",\"scheduled_reclaim_by\":\"scheduledReclaimBy\",\"name\":\"name\",\"region_id\":\"regionId\",\"account_id\":\"accountId\",\"reseller_channel_id\":\"resellerChannelId\",\"resource_plan_id\":\"resourcePlanId\",\"resource_group_id\":\"resourceGroupId\",\"resource_group_crn\":\"resourceGroupCrn\",\"target_crn\":\"targetCrn\",\"parameters\":{\"anyKey\":\"anyValue\"},\"allow_cleanup\":true,\"crn\":\"crn\",\"state\":\"active\",\"type\":\"type\",\"sub_type\":\"subType\",\"resource_id\":\"resourceId\",\"dashboard_url\":\"dashboardUrl\",\"last_operation\":{\"type\":\"type\",\"state\":\"in progress\",\"sub_type\":\"subType\",\"async\":false,\"description\":\"description\",\"reason_code\":\"reasonCode\",\"poll_after\":9,\"cancelable\":true,\"poll\":true},\"resource_aliases_url\":\"resourceAliasesUrl\",\"resource_bindings_url\":\"resourceBindingsUrl\",\"resource_keys_url\":\"resourceKeysUrl\",\"plan_history\":[{\"resource_plan_id\":\"resourcePlanId\",\"start_date\":\"2019-01-01T12:00:00.000Z\",\"requestor_id\":\"requestorId\"}],\"migrated\":true,\"extensions\":{\"anyKey\":\"anyValue\"},\"controlled_by\":\"controlledBy\",\"locked\":true}]}"; + String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"scheduled_reclaim_at\":\"2019-01-01T12:00:00.000Z\",\"restored_at\":\"2019-01-01T12:00:00.000Z\",\"restored_by\":\"restoredBy\",\"scheduled_reclaim_by\":\"scheduledReclaimBy\",\"name\":\"name\",\"region_id\":\"regionId\",\"account_id\":\"accountId\",\"reseller_channel_id\":\"resellerChannelId\",\"resource_plan_id\":\"resourcePlanId\",\"resource_group_id\":\"resourceGroupId\",\"resource_group_crn\":\"resourceGroupCrn\",\"target_crn\":\"targetCrn\",\"onetime_credentials\":true,\"parameters\":{\"anyKey\":\"anyValue\"},\"allow_cleanup\":true,\"crn\":\"crn\",\"state\":\"active\",\"type\":\"type\",\"sub_type\":\"subType\",\"resource_id\":\"resourceId\",\"dashboard_url\":\"dashboardUrl\",\"last_operation\":{\"type\":\"type\",\"state\":\"in progress\",\"sub_type\":\"subType\",\"async\":false,\"description\":\"description\",\"reason_code\":\"reasonCode\",\"poll_after\":9,\"cancelable\":true,\"poll\":true},\"resource_aliases_url\":\"resourceAliasesUrl\",\"resource_bindings_url\":\"resourceBindingsUrl\",\"resource_keys_url\":\"resourceKeysUrl\",\"plan_history\":[{\"resource_plan_id\":\"resourcePlanId\",\"start_date\":\"2019-01-01T12:00:00.000Z\",\"requestor_id\":\"requestorId\"}],\"migrated\":true,\"extensions\":{\"anyKey\":\"anyValue\"},\"controlled_by\":\"controlledBy\",\"locked\":true}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"scheduled_reclaim_at\":\"2019-01-01T12:00:00.000Z\",\"restored_at\":\"2019-01-01T12:00:00.000Z\",\"restored_by\":\"restoredBy\",\"scheduled_reclaim_by\":\"scheduledReclaimBy\",\"name\":\"name\",\"region_id\":\"regionId\",\"account_id\":\"accountId\",\"reseller_channel_id\":\"resellerChannelId\",\"resource_plan_id\":\"resourcePlanId\",\"resource_group_id\":\"resourceGroupId\",\"resource_group_crn\":\"resourceGroupCrn\",\"target_crn\":\"targetCrn\",\"onetime_credentials\":true,\"parameters\":{\"anyKey\":\"anyValue\"},\"allow_cleanup\":true,\"crn\":\"crn\",\"state\":\"active\",\"type\":\"type\",\"sub_type\":\"subType\",\"resource_id\":\"resourceId\",\"dashboard_url\":\"dashboardUrl\",\"last_operation\":{\"type\":\"type\",\"state\":\"in progress\",\"sub_type\":\"subType\",\"async\":false,\"description\":\"description\",\"reason_code\":\"reasonCode\",\"poll_after\":9,\"cancelable\":true,\"poll\":true},\"resource_aliases_url\":\"resourceAliasesUrl\",\"resource_bindings_url\":\"resourceBindingsUrl\",\"resource_keys_url\":\"resourceKeysUrl\",\"plan_history\":[{\"resource_plan_id\":\"resourcePlanId\",\"start_date\":\"2019-01-01T12:00:00.000Z\",\"requestor_id\":\"requestorId\"}],\"migrated\":true,\"extensions\":{\"anyKey\":\"anyValue\"},\"controlled_by\":\"controlledBy\",\"locked\":true}]}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -210,13 +211,13 @@ public void testListResourceInstancesWithPagerGetNext() throws Throwable { } assertEquals(allResults.size(), 2); } - + // Test the listResourceInstances operation using the ResourceInstancesPager.getAll() method @Test public void testListResourceInstancesWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"scheduled_reclaim_at\":\"2019-01-01T12:00:00.000Z\",\"restored_at\":\"2019-01-01T12:00:00.000Z\",\"restored_by\":\"restoredBy\",\"scheduled_reclaim_by\":\"scheduledReclaimBy\",\"name\":\"name\",\"region_id\":\"regionId\",\"account_id\":\"accountId\",\"reseller_channel_id\":\"resellerChannelId\",\"resource_plan_id\":\"resourcePlanId\",\"resource_group_id\":\"resourceGroupId\",\"resource_group_crn\":\"resourceGroupCrn\",\"target_crn\":\"targetCrn\",\"parameters\":{\"anyKey\":\"anyValue\"},\"allow_cleanup\":true,\"crn\":\"crn\",\"state\":\"active\",\"type\":\"type\",\"sub_type\":\"subType\",\"resource_id\":\"resourceId\",\"dashboard_url\":\"dashboardUrl\",\"last_operation\":{\"type\":\"type\",\"state\":\"in progress\",\"sub_type\":\"subType\",\"async\":false,\"description\":\"description\",\"reason_code\":\"reasonCode\",\"poll_after\":9,\"cancelable\":true,\"poll\":true},\"resource_aliases_url\":\"resourceAliasesUrl\",\"resource_bindings_url\":\"resourceBindingsUrl\",\"resource_keys_url\":\"resourceKeysUrl\",\"plan_history\":[{\"resource_plan_id\":\"resourcePlanId\",\"start_date\":\"2019-01-01T12:00:00.000Z\",\"requestor_id\":\"requestorId\"}],\"migrated\":true,\"extensions\":{\"anyKey\":\"anyValue\"},\"controlled_by\":\"controlledBy\",\"locked\":true}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"scheduled_reclaim_at\":\"2019-01-01T12:00:00.000Z\",\"restored_at\":\"2019-01-01T12:00:00.000Z\",\"restored_by\":\"restoredBy\",\"scheduled_reclaim_by\":\"scheduledReclaimBy\",\"name\":\"name\",\"region_id\":\"regionId\",\"account_id\":\"accountId\",\"reseller_channel_id\":\"resellerChannelId\",\"resource_plan_id\":\"resourcePlanId\",\"resource_group_id\":\"resourceGroupId\",\"resource_group_crn\":\"resourceGroupCrn\",\"target_crn\":\"targetCrn\",\"parameters\":{\"anyKey\":\"anyValue\"},\"allow_cleanup\":true,\"crn\":\"crn\",\"state\":\"active\",\"type\":\"type\",\"sub_type\":\"subType\",\"resource_id\":\"resourceId\",\"dashboard_url\":\"dashboardUrl\",\"last_operation\":{\"type\":\"type\",\"state\":\"in progress\",\"sub_type\":\"subType\",\"async\":false,\"description\":\"description\",\"reason_code\":\"reasonCode\",\"poll_after\":9,\"cancelable\":true,\"poll\":true},\"resource_aliases_url\":\"resourceAliasesUrl\",\"resource_bindings_url\":\"resourceBindingsUrl\",\"resource_keys_url\":\"resourceKeysUrl\",\"plan_history\":[{\"resource_plan_id\":\"resourcePlanId\",\"start_date\":\"2019-01-01T12:00:00.000Z\",\"requestor_id\":\"requestorId\"}],\"migrated\":true,\"extensions\":{\"anyKey\":\"anyValue\"},\"controlled_by\":\"controlledBy\",\"locked\":true}]}"; + String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"scheduled_reclaim_at\":\"2019-01-01T12:00:00.000Z\",\"restored_at\":\"2019-01-01T12:00:00.000Z\",\"restored_by\":\"restoredBy\",\"scheduled_reclaim_by\":\"scheduledReclaimBy\",\"name\":\"name\",\"region_id\":\"regionId\",\"account_id\":\"accountId\",\"reseller_channel_id\":\"resellerChannelId\",\"resource_plan_id\":\"resourcePlanId\",\"resource_group_id\":\"resourceGroupId\",\"resource_group_crn\":\"resourceGroupCrn\",\"target_crn\":\"targetCrn\",\"onetime_credentials\":true,\"parameters\":{\"anyKey\":\"anyValue\"},\"allow_cleanup\":true,\"crn\":\"crn\",\"state\":\"active\",\"type\":\"type\",\"sub_type\":\"subType\",\"resource_id\":\"resourceId\",\"dashboard_url\":\"dashboardUrl\",\"last_operation\":{\"type\":\"type\",\"state\":\"in progress\",\"sub_type\":\"subType\",\"async\":false,\"description\":\"description\",\"reason_code\":\"reasonCode\",\"poll_after\":9,\"cancelable\":true,\"poll\":true},\"resource_aliases_url\":\"resourceAliasesUrl\",\"resource_bindings_url\":\"resourceBindingsUrl\",\"resource_keys_url\":\"resourceKeysUrl\",\"plan_history\":[{\"resource_plan_id\":\"resourcePlanId\",\"start_date\":\"2019-01-01T12:00:00.000Z\",\"requestor_id\":\"requestorId\"}],\"migrated\":true,\"extensions\":{\"anyKey\":\"anyValue\"},\"controlled_by\":\"controlledBy\",\"locked\":true}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"scheduled_reclaim_at\":\"2019-01-01T12:00:00.000Z\",\"restored_at\":\"2019-01-01T12:00:00.000Z\",\"restored_by\":\"restoredBy\",\"scheduled_reclaim_by\":\"scheduledReclaimBy\",\"name\":\"name\",\"region_id\":\"regionId\",\"account_id\":\"accountId\",\"reseller_channel_id\":\"resellerChannelId\",\"resource_plan_id\":\"resourcePlanId\",\"resource_group_id\":\"resourceGroupId\",\"resource_group_crn\":\"resourceGroupCrn\",\"target_crn\":\"targetCrn\",\"onetime_credentials\":true,\"parameters\":{\"anyKey\":\"anyValue\"},\"allow_cleanup\":true,\"crn\":\"crn\",\"state\":\"active\",\"type\":\"type\",\"sub_type\":\"subType\",\"resource_id\":\"resourceId\",\"dashboard_url\":\"dashboardUrl\",\"last_operation\":{\"type\":\"type\",\"state\":\"in progress\",\"sub_type\":\"subType\",\"async\":false,\"description\":\"description\",\"reason_code\":\"reasonCode\",\"poll_after\":9,\"cancelable\":true,\"poll\":true},\"resource_aliases_url\":\"resourceAliasesUrl\",\"resource_bindings_url\":\"resourceBindingsUrl\",\"resource_keys_url\":\"resourceKeysUrl\",\"plan_history\":[{\"resource_plan_id\":\"resourcePlanId\",\"start_date\":\"2019-01-01T12:00:00.000Z\",\"requestor_id\":\"requestorId\"}],\"migrated\":true,\"extensions\":{\"anyKey\":\"anyValue\"},\"controlled_by\":\"controlledBy\",\"locked\":true}]}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -249,12 +250,12 @@ public void testListResourceInstancesWithPagerGetAll() throws Throwable { assertNotNull(allResults); assertEquals(allResults.size(), 2); } - + // Test the createResourceInstance operation with a valid options model parameter @Test public void testCreateResourceInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; + String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"onetime_credentials\": true, \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; String createResourceInstancePath = "/v2/resource_instances"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -312,7 +313,7 @@ public void testCreateResourceInstanceNoOptions() throws Throwable { @Test public void testGetResourceInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; + String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"onetime_credentials\": true, \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; String getResourceInstancePath = "/v2/resource_instances/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -415,7 +416,7 @@ public void testDeleteResourceInstanceNoOptions() throws Throwable { @Test public void testUpdateResourceInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; + String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"onetime_credentials\": true, \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; String updateResourceInstancePath = "/v2/resource_instances/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -554,7 +555,7 @@ public void testListResourceAliasesForInstanceWithPagerGetNext() throws Throwabl } assertEquals(allResults.size(), 2); } - + // Test the listResourceAliasesForInstance operation using the ResourceAliasesForInstancePager.getAll() method @Test public void testListResourceAliasesForInstanceWithPagerGetAll() throws Throwable { @@ -584,12 +585,12 @@ public void testListResourceAliasesForInstanceWithPagerGetAll() throws Throwable assertNotNull(allResults); assertEquals(allResults.size(), 2); } - + // Test the listResourceKeysForInstance operation with a valid options model parameter @Test public void testListResourceKeysForInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"rows_count\": 9, \"next_url\": \"nextUrl\", \"resources\": [{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}]}"; + String mockResponseBody = "{\"rows_count\": 9, \"next_url\": \"nextUrl\", \"resources\": [{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"onetime_credentials\": true, \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}]}"; String listResourceKeysForInstancePath = "/v2/resource_instances/testString/resource_keys"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -644,8 +645,8 @@ public void testListResourceKeysForInstanceNoOptions() throws Throwable { @Test public void testListResourceKeysForInstanceWithPagerGetNext() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; + String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"onetime_credentials\":true,\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"onetime_credentials\":true,\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -673,13 +674,13 @@ public void testListResourceKeysForInstanceWithPagerGetNext() throws Throwable { } assertEquals(allResults.size(), 2); } - + // Test the listResourceKeysForInstance operation using the ResourceKeysForInstancePager.getAll() method @Test public void testListResourceKeysForInstanceWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; + String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"onetime_credentials\":true,\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"onetime_credentials\":true,\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -703,12 +704,12 @@ public void testListResourceKeysForInstanceWithPagerGetAll() throws Throwable { assertNotNull(allResults); assertEquals(allResults.size(), 2); } - + // Test the lockResourceInstance operation with a valid options model parameter @Test public void testLockResourceInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; + String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"onetime_credentials\": true, \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; String lockResourceInstancePath = "/v2/resource_instances/testString/lock"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -759,7 +760,7 @@ public void testLockResourceInstanceNoOptions() throws Throwable { @Test public void testUnlockResourceInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; + String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"onetime_credentials\": true, \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; String unlockResourceInstancePath = "/v2/resource_instances/testString/lock"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -810,7 +811,7 @@ public void testUnlockResourceInstanceNoOptions() throws Throwable { @Test public void testCancelLastopResourceInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; + String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"scheduled_reclaim_at\": \"2019-01-01T12:00:00.000Z\", \"restored_at\": \"2019-01-01T12:00:00.000Z\", \"restored_by\": \"restoredBy\", \"scheduled_reclaim_by\": \"scheduledReclaimBy\", \"name\": \"name\", \"region_id\": \"regionId\", \"account_id\": \"accountId\", \"reseller_channel_id\": \"resellerChannelId\", \"resource_plan_id\": \"resourcePlanId\", \"resource_group_id\": \"resourceGroupId\", \"resource_group_crn\": \"resourceGroupCrn\", \"target_crn\": \"targetCrn\", \"onetime_credentials\": true, \"parameters\": {\"anyKey\": \"anyValue\"}, \"allow_cleanup\": true, \"crn\": \"crn\", \"state\": \"active\", \"type\": \"type\", \"sub_type\": \"subType\", \"resource_id\": \"resourceId\", \"dashboard_url\": \"dashboardUrl\", \"last_operation\": {\"type\": \"type\", \"state\": \"in progress\", \"sub_type\": \"subType\", \"async\": false, \"description\": \"description\", \"reason_code\": \"reasonCode\", \"poll_after\": 9, \"cancelable\": true, \"poll\": true}, \"resource_aliases_url\": \"resourceAliasesUrl\", \"resource_bindings_url\": \"resourceBindingsUrl\", \"resource_keys_url\": \"resourceKeysUrl\", \"plan_history\": [{\"resource_plan_id\": \"resourcePlanId\", \"start_date\": \"2019-01-01T12:00:00.000Z\", \"requestor_id\": \"requestorId\"}], \"migrated\": true, \"extensions\": {\"anyKey\": \"anyValue\"}, \"controlled_by\": \"controlledBy\", \"locked\": true}"; String cancelLastopResourceInstancePath = "/v2/resource_instances/testString/last_operation"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -861,7 +862,7 @@ public void testCancelLastopResourceInstanceNoOptions() throws Throwable { @Test public void testListResourceKeysWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"rows_count\": 9, \"next_url\": \"nextUrl\", \"resources\": [{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}]}"; + String mockResponseBody = "{\"rows_count\": 9, \"next_url\": \"nextUrl\", \"resources\": [{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"onetime_credentials\": true, \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}]}"; String listResourceKeysPath = "/v2/resource_keys"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -920,8 +921,8 @@ public void testListResourceKeysWRetries() throws Throwable { @Test public void testListResourceKeysWithPagerGetNext() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; + String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"onetime_credentials\":true,\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"onetime_credentials\":true,\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -954,13 +955,13 @@ public void testListResourceKeysWithPagerGetNext() throws Throwable { } assertEquals(allResults.size(), 2); } - + // Test the listResourceKeys operation using the ResourceKeysPager.getAll() method @Test public void testListResourceKeysWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; + String mockResponsePage1 = "{\"total_count\":2,\"limit\":1,\"next_url\":\"https://myhost.com/somePath?start=1\",\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"onetime_credentials\":true,\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"id\":\"id\",\"guid\":\"guid\",\"url\":\"url\",\"created_at\":\"2019-01-01T12:00:00.000Z\",\"updated_at\":\"2019-01-01T12:00:00.000Z\",\"deleted_at\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_by\":\"updatedBy\",\"deleted_by\":\"deletedBy\",\"source_crn\":\"sourceCrn\",\"name\":\"name\",\"crn\":\"crn\",\"state\":\"state\",\"account_id\":\"accountId\",\"resource_group_id\":\"resourceGroupId\",\"resource_id\":\"resourceId\",\"onetime_credentials\":true,\"credentials\":{\"REDACTED\":\"REDACTED\",\"apikey\":\"apikey\",\"iam_apikey_description\":\"iamApikeyDescription\",\"iam_apikey_name\":\"iamApikeyName\",\"iam_role_crn\":\"iamRoleCrn\",\"iam_serviceid_crn\":\"iamServiceidCrn\"},\"iam_compatible\":false,\"migrated\":true,\"resource_instance_url\":\"resourceInstanceUrl\",\"resource_alias_url\":\"resourceAliasUrl\"}]}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -989,12 +990,12 @@ public void testListResourceKeysWithPagerGetAll() throws Throwable { assertNotNull(allResults); assertEquals(allResults.size(), 2); } - + // Test the createResourceKey operation with a valid options model parameter @Test public void testCreateResourceKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}"; + String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"onetime_credentials\": true, \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}"; String createResourceKeyPath = "/v2/resource_keys"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1054,7 +1055,7 @@ public void testCreateResourceKeyNoOptions() throws Throwable { @Test public void testGetResourceKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}"; + String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"onetime_credentials\": true, \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}"; String getResourceKeyPath = "/v2/resource_keys/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1155,7 +1156,7 @@ public void testDeleteResourceKeyNoOptions() throws Throwable { @Test public void testUpdateResourceKeyWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}"; + String mockResponseBody = "{\"id\": \"id\", \"guid\": \"guid\", \"url\": \"url\", \"created_at\": \"2019-01-01T12:00:00.000Z\", \"updated_at\": \"2019-01-01T12:00:00.000Z\", \"deleted_at\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_by\": \"updatedBy\", \"deleted_by\": \"deletedBy\", \"source_crn\": \"sourceCrn\", \"name\": \"name\", \"crn\": \"crn\", \"state\": \"state\", \"account_id\": \"accountId\", \"resource_group_id\": \"resourceGroupId\", \"resource_id\": \"resourceId\", \"onetime_credentials\": true, \"credentials\": {\"REDACTED\": \"REDACTED\", \"apikey\": \"apikey\", \"iam_apikey_description\": \"iamApikeyDescription\", \"iam_apikey_name\": \"iamApikeyName\", \"iam_role_crn\": \"iamRoleCrn\", \"iam_serviceid_crn\": \"iamServiceidCrn\"}, \"iam_compatible\": false, \"migrated\": true, \"resource_instance_url\": \"resourceInstanceUrl\", \"resource_alias_url\": \"resourceAliasUrl\"}"; String updateResourceKeyPath = "/v2/resource_keys/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1303,7 +1304,7 @@ public void testListResourceBindingsWithPagerGetNext() throws Throwable { } assertEquals(allResults.size(), 2); } - + // Test the listResourceBindings operation using the ResourceBindingsPager.getAll() method @Test public void testListResourceBindingsWithPagerGetAll() throws Throwable { @@ -1339,7 +1340,7 @@ public void testListResourceBindingsWithPagerGetAll() throws Throwable { assertNotNull(allResults); assertEquals(allResults.size(), 2); } - + // Test the createResourceBinding operation with a valid options model parameter @Test public void testCreateResourceBindingWOptions() throws Throwable { @@ -1657,7 +1658,7 @@ public void testListResourceAliasesWithPagerGetNext() throws Throwable { } assertEquals(allResults.size(), 2); } - + // Test the listResourceAliases operation using the ResourceAliasesPager.getAll() method @Test public void testListResourceAliasesWithPagerGetAll() throws Throwable { @@ -1694,7 +1695,7 @@ public void testListResourceAliasesWithPagerGetAll() throws Throwable { assertNotNull(allResults); assertEquals(allResults.size(), 2); } - + // Test the createResourceAlias operation with a valid options model parameter @Test public void testCreateResourceAliasWOptions() throws Throwable { @@ -1991,7 +1992,7 @@ public void testListResourceBindingsForAliasWithPagerGetNext() throws Throwable } assertEquals(allResults.size(), 2); } - + // Test the listResourceBindingsForAlias operation using the ResourceBindingsForAliasPager.getAll() method @Test public void testListResourceBindingsForAliasWithPagerGetAll() throws Throwable { @@ -2021,7 +2022,7 @@ public void testListResourceBindingsForAliasWithPagerGetAll() throws Throwable { assertNotNull(allResults); assertEquals(allResults.size(), 2); } - + // Test the listReclamations operation with a valid options model parameter @Test public void testListReclamationsWOptions() throws Throwable { @@ -2037,6 +2038,7 @@ public void testListReclamationsWOptions() throws Throwable { ListReclamationsOptions listReclamationsOptionsModel = new ListReclamationsOptions.Builder() .accountId("testString") .resourceInstanceId("testString") + .resourceGroupId("testString") .build(); // Invoke listReclamations() with a valid options model and verify the result @@ -2057,6 +2059,7 @@ public void testListReclamationsWOptions() throws Throwable { assertNotNull(query); assertEquals(query.get("account_id"), "testString"); assertEquals(query.get("resource_instance_id"), "testString"); + assertEquals(query.get("resource_group_id"), "testString"); } // Test the listReclamations operation with and without retries enabled diff --git a/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceInstanceTest.java b/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceInstanceTest.java index 026b2f8702..8d265c204c 100644 --- a/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceInstanceTest.java +++ b/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceInstanceTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2022. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -56,6 +56,7 @@ public void testResourceInstance() throws Throwable { assertNull(resourceInstanceModel.getResourceGroupId()); assertNull(resourceInstanceModel.getResourceGroupCrn()); assertNull(resourceInstanceModel.getTargetCrn()); + assertNull(resourceInstanceModel.isOnetimeCredentials()); assertNull(resourceInstanceModel.getParameters()); assertNull(resourceInstanceModel.isAllowCleanup()); assertNull(resourceInstanceModel.getCrn()); diff --git a/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceKeyTest.java b/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceKeyTest.java index 698c63f07d..18d57385ac 100644 --- a/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceKeyTest.java +++ b/modules/resource-controller/src/test/java/com/ibm/cloud/platform_services/resource_controller/v2/model/ResourceKeyTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2022. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -49,6 +49,7 @@ public void testResourceKey() throws Throwable { assertNull(resourceKeyModel.getAccountId()); assertNull(resourceKeyModel.getResourceGroupId()); assertNull(resourceKeyModel.getResourceId()); + assertNull(resourceKeyModel.isOnetimeCredentials()); assertNull(resourceKeyModel.getCredentials()); assertNull(resourceKeyModel.isIamCompatible()); assertNull(resourceKeyModel.isMigrated());