From b31e8fcc52218f7058ca6cccb37fe8129d2ac4ea Mon Sep 17 00:00:00 2001 From: Sirija Reddy Date: Thu, 30 Apr 2026 21:13:55 +0530 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20Update=20CIS=20SDK=20=E2=80=94=20CI?= =?UTF-8?q?S=5FFrontend=5FAPI=5FSpec-Lists=20(#4682e9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sirija Reddy --- .../networking/lists_api/v1/ListsApi.java | 692 +++++++++++++++++ .../v1/model/CreateCustomListsOptions.java | 159 ++++ .../v1/model/CreateListItemsOptions.java | 111 +++ .../v1/model/CreateListItemsReqItem.java | 172 +++++ .../lists_api/v1/model/CustomListResp.java | 74 ++ .../lists_api/v1/model/CustomListResult.java | 101 +++ .../lists_api/v1/model/CustomListsResp.java | 74 ++ .../v1/model/DeleteCustomListOptions.java | 29 + .../v1/model/DeleteListItemsOptions.java | 111 +++ .../v1/model/DeleteListItemsReqItemsItem.java | 91 +++ .../v1/model/DeleteResourceResp.java | 74 ++ .../v1/model/DeleteResourceRespResult.java | 36 + .../v1/model/GetCustomListOptions.java | 29 + .../v1/model/GetCustomListsOptions.java | 29 + .../v1/model/GetListItemOptions.java | 29 + .../v1/model/GetListItemsOptions.java | 147 ++++ .../v1/model/GetManagedListsOptions.java | 29 + .../v1/model/GetOperationStatusOptions.java | 29 + .../lists_api/v1/model/ListCursor.java | 50 ++ .../lists_api/v1/model/ListItem.java | 108 +++ .../lists_api/v1/model/ListItemResp.java | 74 ++ .../lists_api/v1/model/ListItemsResp.java | 86 +++ .../v1/model/ListItemsResultInfo.java | 36 + .../lists_api/v1/model/ListOperationResp.java | 74 ++ .../v1/model/ListOperationRespResult.java | 38 + .../lists_api/v1/model/ManagedListsResp.java | 74 ++ .../v1/model/ManagedListsResultItem.java | 62 ++ .../v1/model/OperationStatusResp.java | 74 ++ .../v1/model/OperationStatusRespResult.java | 79 ++ .../v1/model/UpdateCustomListOptions.java | 93 +++ .../v1/model/UpdateListItemsOptions.java | 111 +++ .../networking/lists_api/v1/package-info.java | 17 + .../networking/lists_api/v1/ListsApiIT.java | 416 +++++++++++ .../networking/lists_api/v1/ListsApiTest.java | 696 ++++++++++++++++++ .../model/CreateCustomListsOptionsTest.java | 43 ++ .../v1/model/CreateListItemsOptionsTest.java | 51 ++ .../v1/model/CreateListItemsReqItemTest.java | 54 ++ .../v1/model/CustomListRespTest.java | 41 ++ .../v1/model/CustomListResultTest.java | 42 ++ .../v1/model/CustomListsRespTest.java | 41 ++ .../v1/model/DeleteCustomListOptionsTest.java | 37 + .../v1/model/DeleteListItemsOptionsTest.java | 45 ++ .../DeleteListItemsReqItemsItemTest.java | 45 ++ .../model/DeleteResourceRespResultTest.java | 37 + .../v1/model/DeleteResourceRespTest.java | 41 ++ .../v1/model/GetCustomListOptionsTest.java | 37 + .../v1/model/GetCustomListsOptionsTest.java | 37 + .../v1/model/GetListItemOptionsTest.java | 37 + .../v1/model/GetListItemsOptionsTest.java | 43 ++ .../v1/model/GetManagedListsOptionsTest.java | 37 + .../model/GetOperationStatusOptionsTest.java | 37 + .../lists_api/v1/model/ListCursorTest.java | 38 + .../lists_api/v1/model/ListItemRespTest.java | 41 ++ .../lists_api/v1/model/ListItemTest.java | 43 ++ .../lists_api/v1/model/ListItemsRespTest.java | 44 ++ .../v1/model/ListItemsResultInfoTest.java | 38 + .../v1/model/ListOperationRespResultTest.java | 37 + .../v1/model/ListOperationRespTest.java | 41 ++ .../v1/model/ManagedListsRespTest.java | 41 ++ .../v1/model/ManagedListsResultItemTest.java | 39 + .../model/OperationStatusRespResultTest.java | 40 + .../v1/model/OperationStatusRespTest.java | 41 ++ .../v1/model/UpdateCustomListOptionsTest.java | 39 + .../v1/model/UpdateListItemsOptionsTest.java | 51 ++ .../lists_api/v1/utils/TestUtilities.java | 131 ++++ 65 files changed, 5473 insertions(+) create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/ListsApi.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateCustomListsOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsReqItem.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResp.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResult.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListsResp.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteCustomListOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsReqItemsItem.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceResp.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespResult.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListsOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemsOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetManagedListsOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetOperationStatusOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListCursor.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItem.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemResp.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResp.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResultInfo.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationResp.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespResult.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResp.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResultItem.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusResp.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespResult.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateCustomListOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateListItemsOptions.java create mode 100644 modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/package-info.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiIT.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateCustomListsOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsReqItemTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListRespTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResultTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListsRespTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteCustomListOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsReqItemsItemTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespResultTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListsOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemsOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetManagedListsOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetOperationStatusOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListCursorTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemRespTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsRespTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResultInfoTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespResultTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsRespTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResultItemTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespResultTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateCustomListOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateListItemsOptionsTest.java create mode 100644 modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/utils/TestUtilities.java diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/ListsApi.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/ListsApi.java new file mode 100644 index 000000000..64d264b7a --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/ListsApi.java @@ -0,0 +1,692 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.114.0-a902401e-20260427-192904 + */ + +package com.ibm.cloud.networking.lists_api.v1; + +import com.google.gson.JsonObject; +import com.ibm.cloud.networking.common.SdkCommon; +import com.ibm.cloud.networking.lists_api.v1.model.CreateCustomListsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListResp; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListsResp; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteResourceResp; +import com.ibm.cloud.networking.lists_api.v1.model.GetCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetCustomListsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetListItemOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetManagedListsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetOperationStatusOptions; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemsResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListOperationResp; +import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsResp; +import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusResp; +import com.ibm.cloud.networking.lists_api.v1.model.UpdateCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.model.UpdateListItemsOptions; +import com.ibm.cloud.sdk.core.http.RequestBuilder; +import com.ibm.cloud.sdk.core.http.ResponseConverter; +import com.ibm.cloud.sdk.core.http.ServiceCall; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; +import com.ibm.cloud.sdk.core.service.BaseService; +import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * CIS Lists. + * + * API Version: 1.0.0 + */ +public class ListsApi extends BaseService { + + /** + * Default service name used when configuring the `ListsApi` client. + */ + public static final String DEFAULT_SERVICE_NAME = "lists_api"; + + /** + * Default service endpoint URL. + */ + public static final String DEFAULT_SERVICE_URL = "https://api.cis.cloud.ibm.com"; + + private String crn; + + private String itemId; + + private String listId; + + private String operationId; + + /** + * Class method which constructs an instance of the `ListsApi` client. + * The default service name is used to configure the client instance. + * + * @param crn Full URL-encoded CRN of the service instance. + * @param itemId List item identifier. + * @param listId List identifier. + * @param operationId List operation identifier. + * @return an instance of the `ListsApi` client using external configuration + */ + public static ListsApi newInstance(String crn, String itemId, String listId, String operationId) { + return newInstance(crn, itemId, listId, operationId, DEFAULT_SERVICE_NAME); + } + + /** + * Class method which constructs an instance of the `ListsApi` client. + * The specified service name is used to configure the client instance. + * + * @param crn Full URL-encoded CRN of the service instance. + * @param itemId List item identifier. + * @param listId List identifier. + * @param operationId List operation identifier. + * @param serviceName the service name to be used when configuring the client instance + * @return an instance of the `ListsApi` client using external configuration + */ + public static ListsApi newInstance(String crn, String itemId, String listId, String operationId, String serviceName) { + Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); + ListsApi service = new ListsApi(crn, itemId, listId, operationId, serviceName, authenticator); + service.configureService(serviceName); + return service; + } + + /** + * Constructs an instance of the `ListsApi` client. + * The specified service name and authenticator are used to configure the client instance. + * + * @param crn Full URL-encoded CRN of the service instance. + * @param itemId List item identifier. + * @param listId List identifier. + * @param operationId List operation identifier. + * @param serviceName the service name to be used when configuring the client instance + * @param authenticator the {@link Authenticator} instance to be configured for this client + */ + public ListsApi(String crn, String itemId, String listId, String operationId, String serviceName, Authenticator authenticator) { + super(serviceName, authenticator); + setServiceUrl(DEFAULT_SERVICE_URL); + setCrn(crn); + setItemId(itemId); + setListId(listId); + setOperationId(operationId); + } + + /** + * Gets the crn. + * + * Full URL-encoded CRN of the service instance. + * + * @return the crn + */ + public String getCrn() { + return this.crn; + } + + /** + * Sets the crn. + * + * @param crn the new crn + */ + public void setCrn(final String crn) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(crn, "crn cannot be empty."); + this.crn = crn; + } + + /** + * Gets the itemId. + * + * List item identifier. + * + * @return the itemId + */ + public String getItemId() { + return this.itemId; + } + + /** + * Sets the itemId. + * + * @param itemId the new itemId + */ + public void setItemId(final String itemId) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(itemId, "itemId cannot be empty."); + this.itemId = itemId; + } + + /** + * Gets the listId. + * + * List identifier. + * + * @return the listId + */ + public String getListId() { + return this.listId; + } + + /** + * Sets the listId. + * + * @param listId the new listId + */ + public void setListId(final String listId) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(listId, "listId cannot be empty."); + this.listId = listId; + } + + /** + * Gets the operationId. + * + * List operation identifier. + * + * @return the operationId + */ + public String getOperationId() { + return this.operationId; + } + + /** + * Sets the operationId. + * + * @param operationId the new operationId + */ + public void setOperationId(final String operationId) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(operationId, "operationId cannot be empty."); + this.operationId = operationId; + } + + /** + * List Managed Lists. + * + * List available managed lists for your instance. + * + * @param getManagedListsOptions the {@link GetManagedListsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ManagedListsResp} + */ + public ServiceCall getManagedLists(GetManagedListsOptions getManagedListsOptions) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/managed_lists", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "getManagedLists"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List Managed Lists. + * + * List available managed lists for your instance. + * + * @return a {@link ServiceCall} with a result of type {@link ManagedListsResp} + */ + public ServiceCall getManagedLists() { + return getManagedLists(null); + } + + /** + * List Custom Lists. + * + * List the custom lists for your instance. + * + * @param getCustomListsOptions the {@link GetCustomListsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomListsResp} + */ + public ServiceCall getCustomLists(GetCustomListsOptions getCustomListsOptions) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "getCustomLists"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List Custom Lists. + * + * List the custom lists for your instance. + * + * @return a {@link ServiceCall} with a result of type {@link CustomListsResp} + */ + public ServiceCall getCustomLists() { + return getCustomLists(null); + } + + /** + * Create Custom List. + * + * Create a custom list for your instance. + * + * @param createCustomListsOptions the {@link CreateCustomListsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomListResp} + */ + public ServiceCall createCustomLists(CreateCustomListsOptions createCustomListsOptions) { + boolean skipBody = false; + if (createCustomListsOptions == null) { + createCustomListsOptions = new CreateCustomListsOptions.Builder().build(); + skipBody = true; + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "createCustomLists"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (!skipBody) { + final JsonObject contentJson = new JsonObject(); + if (createCustomListsOptions.kind() != null) { + contentJson.addProperty("kind", createCustomListsOptions.kind()); + } + if (createCustomListsOptions.name() != null) { + contentJson.addProperty("name", createCustomListsOptions.name()); + } + if (createCustomListsOptions.description() != null) { + contentJson.addProperty("description", createCustomListsOptions.description()); + } + builder.bodyJson(contentJson); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create Custom List. + * + * Create a custom list for your instance. + * + * @return a {@link ServiceCall} with a result of type {@link CustomListResp} + */ + public ServiceCall createCustomLists() { + return createCustomLists(null); + } + + /** + * Get Custom List. + * + * Get a custom list for your instance. + * + * @param getCustomListOptions the {@link GetCustomListOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomListResp} + */ + public ServiceCall getCustomList(GetCustomListOptions getCustomListOptions) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("list_id", this.listId); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists/{list_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "getCustomList"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get Custom List. + * + * Get a custom list for your instance. + * + * @return a {@link ServiceCall} with a result of type {@link CustomListResp} + */ + public ServiceCall getCustomList() { + return getCustomList(null); + } + + /** + * Update Custom List. + * + * Update the description of a custom list. + * + * @param updateCustomListOptions the {@link UpdateCustomListOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CustomListResp} + */ + public ServiceCall updateCustomList(UpdateCustomListOptions updateCustomListOptions) { + boolean skipBody = false; + if (updateCustomListOptions == null) { + updateCustomListOptions = new UpdateCustomListOptions.Builder().build(); + skipBody = true; + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("list_id", this.listId); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists/{list_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "updateCustomList"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (!skipBody) { + final JsonObject contentJson = new JsonObject(); + if (updateCustomListOptions.description() != null) { + contentJson.addProperty("description", updateCustomListOptions.description()); + } + builder.bodyJson(contentJson); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update Custom List. + * + * Update the description of a custom list. + * + * @return a {@link ServiceCall} with a result of type {@link CustomListResp} + */ + public ServiceCall updateCustomList() { + return updateCustomList(null); + } + + /** + * Delete Custom List. + * + * Delete a custom list for your instance. + * + * @param deleteCustomListOptions the {@link DeleteCustomListOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link DeleteResourceResp} + */ + public ServiceCall deleteCustomList(DeleteCustomListOptions deleteCustomListOptions) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("list_id", this.listId); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists/{list_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "deleteCustomList"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete Custom List. + * + * Delete a custom list for your instance. + * + * @return a {@link ServiceCall} with a result of type {@link DeleteResourceResp} + */ + public ServiceCall deleteCustomList() { + return deleteCustomList(null); + } + + /** + * Get List Items. + * + * Get the list items for a custom list. + * + * @param getListItemsOptions the {@link GetListItemsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListItemsResp} + */ + public ServiceCall getListItems(GetListItemsOptions getListItemsOptions) { + if (getListItemsOptions == null) { + getListItemsOptions = new GetListItemsOptions.Builder().build(); + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("list_id", this.listId); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists/{list_id}/items", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "getListItems"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getListItemsOptions.cursor() != null) { + builder.query("cursor", String.valueOf(getListItemsOptions.cursor())); + } + if (getListItemsOptions.perPage() != null) { + builder.query("per_page", String.valueOf(getListItemsOptions.perPage())); + } + if (getListItemsOptions.search() != null) { + builder.query("search", String.valueOf(getListItemsOptions.search())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get List Items. + * + * Get the list items for a custom list. + * + * @return a {@link ServiceCall} with a result of type {@link ListItemsResp} + */ + public ServiceCall getListItems() { + return getListItems(null); + } + + /** + * Create List Items. + * + * Create list items for your custom list. This operation is asynchronous. To get current the operation status, use + * the get operation status API. + * + * @param createListItemsOptions the {@link CreateListItemsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListOperationResp} + */ + public ServiceCall createListItems(CreateListItemsOptions createListItemsOptions) { + if (createListItemsOptions == null) { + createListItemsOptions = new CreateListItemsOptions.Builder().build(); + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("list_id", this.listId); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists/{list_id}/items", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "createListItems"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createListItemsOptions.createListItemsReqItem() != null) { + builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(createListItemsOptions.createListItemsReqItem()), "application/json"); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create List Items. + * + * Create list items for your custom list. This operation is asynchronous. To get current the operation status, use + * the get operation status API. + * + * @return a {@link ServiceCall} with a result of type {@link ListOperationResp} + */ + public ServiceCall createListItems() { + return createListItems(null); + } + + /** + * Delete List Items. + * + * Remove one or more list items from your custom list. This operation is asynchronous. To get current the operation + * status, use the get operation status API. + * + * @param deleteListItemsOptions the {@link DeleteListItemsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListOperationResp} + */ + public ServiceCall deleteListItems(DeleteListItemsOptions deleteListItemsOptions) { + boolean skipBody = false; + if (deleteListItemsOptions == null) { + deleteListItemsOptions = new DeleteListItemsOptions.Builder().build(); + skipBody = true; + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("list_id", this.listId); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists/{list_id}/items", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "deleteListItems"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (!skipBody) { + final JsonObject contentJson = new JsonObject(); + if (deleteListItemsOptions.items() != null) { + contentJson.add("items", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(deleteListItemsOptions.items())); + } + builder.bodyJson(contentJson); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete List Items. + * + * Remove one or more list items from your custom list. This operation is asynchronous. To get current the operation + * status, use the get operation status API. + * + * @return a {@link ServiceCall} with a result of type {@link ListOperationResp} + */ + public ServiceCall deleteListItems() { + return deleteListItems(null); + } + + /** + * Update All List Items. + * + * Update all list items for your custom list. This removes existing items from the list. This operation is + * asynchronous. To get current the operation status, use the get operation status API. + * + * @param updateListItemsOptions the {@link UpdateListItemsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListOperationResp} + */ + public ServiceCall updateListItems(UpdateListItemsOptions updateListItemsOptions) { + if (updateListItemsOptions == null) { + updateListItemsOptions = new UpdateListItemsOptions.Builder().build(); + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("list_id", this.listId); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists/{list_id}/items", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "updateListItems"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (updateListItemsOptions.createListItemsReqItem() != null) { + builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(updateListItemsOptions.createListItemsReqItem()), "application/json"); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update All List Items. + * + * Update all list items for your custom list. This removes existing items from the list. This operation is + * asynchronous. To get current the operation status, use the get operation status API. + * + * @return a {@link ServiceCall} with a result of type {@link ListOperationResp} + */ + public ServiceCall updateListItems() { + return updateListItems(null); + } + + /** + * Get List Item. + * + * Get a specific list item. + * + * @param getListItemOptions the {@link GetListItemOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListItemResp} + */ + public ServiceCall getListItem(GetListItemOptions getListItemOptions) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("list_id", this.listId); + pathParamsMap.put("item_id", this.itemId); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists/{list_id}/items/{item_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "getListItem"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get List Item. + * + * Get a specific list item. + * + * @return a {@link ServiceCall} with a result of type {@link ListItemResp} + */ + public ServiceCall getListItem() { + return getListItem(null); + } + + /** + * Get List Operation Status. + * + * Get the operation status for a custom list operation. + * + * @param getOperationStatusOptions the {@link GetOperationStatusOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link OperationStatusResp} + */ + public ServiceCall getOperationStatus(GetOperationStatusOptions getOperationStatusOptions) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("operation_id", this.operationId); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/rules/lists/bulk_operations/{operation_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("lists_api", "v1", "getOperationStatus"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get List Operation Status. + * + * Get the operation status for a custom list operation. + * + * @return a {@link ServiceCall} with a result of type {@link OperationStatusResp} + */ + public ServiceCall getOperationStatus() { + return getOperationStatus(null); + } + +} diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateCustomListsOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateCustomListsOptions.java new file mode 100644 index 000000000..439070138 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateCustomListsOptions.java @@ -0,0 +1,159 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createCustomLists options. + */ +public class CreateCustomListsOptions extends GenericModel { + + /** + * The type of list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects). + */ + public interface Kind { + /** ip. */ + String IP = "ip"; + /** redirect. */ + String REDIRECT = "redirect"; + /** hostname. */ + String HOSTNAME = "hostname"; + /** asn. */ + String ASN = "asn"; + } + + protected String kind; + protected String name; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String kind; + private String name; + private String description; + + /** + * Instantiates a new Builder from an existing CreateCustomListsOptions instance. + * + * @param createCustomListsOptions the instance to initialize the Builder with + */ + private Builder(CreateCustomListsOptions createCustomListsOptions) { + this.kind = createCustomListsOptions.kind; + this.name = createCustomListsOptions.name; + this.description = createCustomListsOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a CreateCustomListsOptions. + * + * @return the new CreateCustomListsOptions instance + */ + public CreateCustomListsOptions build() { + return new CreateCustomListsOptions(this); + } + + /** + * Set the kind. + * + * @param kind the kind + * @return the CreateCustomListsOptions builder + */ + public Builder kind(String kind) { + this.kind = kind; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateCustomListsOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateCustomListsOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected CreateCustomListsOptions() { } + + protected CreateCustomListsOptions(Builder builder) { + kind = builder.kind; + name = builder.name; + description = builder.description; + } + + /** + * New builder. + * + * @return a CreateCustomListsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the kind. + * + * The type of list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects). + * + * @return the kind + */ + public String kind() { + return kind; + } + + /** + * Gets the name. + * + * An informative name for the list. Use this name in rule expressions. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * An informative summary of the list. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsOptions.java new file mode 100644 index 000000000..ab37463aa --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsOptions.java @@ -0,0 +1,111 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createListItems options. + */ +public class CreateListItemsOptions extends GenericModel { + + protected List createListItemsReqItem; + + /** + * Builder. + */ + public static class Builder { + private List createListItemsReqItem; + + /** + * Instantiates a new Builder from an existing CreateListItemsOptions instance. + * + * @param createListItemsOptions the instance to initialize the Builder with + */ + private Builder(CreateListItemsOptions createListItemsOptions) { + this.createListItemsReqItem = createListItemsOptions.createListItemsReqItem; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a CreateListItemsOptions. + * + * @return the new CreateListItemsOptions instance + */ + public CreateListItemsOptions build() { + return new CreateListItemsOptions(this); + } + + /** + * Adds a new element to createListItemsReqItem. + * + * @param createListItemsReqItem the new element to be added + * @return the CreateListItemsOptions builder + */ + public Builder addCreateListItemsReqItem(CreateListItemsReqItem createListItemsReqItem) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createListItemsReqItem, + "createListItemsReqItem cannot be null"); + if (this.createListItemsReqItem == null) { + this.createListItemsReqItem = new ArrayList(); + } + this.createListItemsReqItem.add(createListItemsReqItem); + return this; + } + + /** + * Set the createListItemsReqItem. + * Existing createListItemsReqItem will be replaced. + * + * @param createListItemsReqItem the createListItemsReqItem + * @return the CreateListItemsOptions builder + */ + public Builder createListItemsReqItem(List createListItemsReqItem) { + this.createListItemsReqItem = createListItemsReqItem; + return this; + } + } + + protected CreateListItemsOptions() { } + + protected CreateListItemsOptions(Builder builder) { + createListItemsReqItem = builder.createListItemsReqItem; + } + + /** + * New builder. + * + * @return a CreateListItemsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the createListItemsReqItem. + * + * @return the createListItemsReqItem + */ + public List createListItemsReqItem() { + return createListItemsReqItem; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsReqItem.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsReqItem.java new file mode 100644 index 000000000..60cf31744 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsReqItem.java @@ -0,0 +1,172 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * CreateListItemsReqItem. + */ +public class CreateListItemsReqItem extends GenericModel { + + protected Double asn; + protected String comment; + protected String hostname; + protected String ip; + + /** + * Builder. + */ + public static class Builder { + private Double asn; + private String comment; + private String hostname; + private String ip; + + /** + * Instantiates a new Builder from an existing CreateListItemsReqItem instance. + * + * @param createListItemsReqItem the instance to initialize the Builder with + */ + private Builder(CreateListItemsReqItem createListItemsReqItem) { + this.asn = createListItemsReqItem.asn; + this.comment = createListItemsReqItem.comment; + this.hostname = createListItemsReqItem.hostname; + this.ip = createListItemsReqItem.ip; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a CreateListItemsReqItem. + * + * @return the new CreateListItemsReqItem instance + */ + public CreateListItemsReqItem build() { + return new CreateListItemsReqItem(this); + } + + /** + * Set the asn. + * + * @param asn the asn + * @return the CreateListItemsReqItem builder + */ + public Builder asn(Double asn) { + this.asn = asn; + return this; + } + + /** + * Set the comment. + * + * @param comment the comment + * @return the CreateListItemsReqItem builder + */ + public Builder comment(String comment) { + this.comment = comment; + return this; + } + + /** + * Set the hostname. + * + * @param hostname the hostname + * @return the CreateListItemsReqItem builder + */ + public Builder hostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Set the ip. + * + * @param ip the ip + * @return the CreateListItemsReqItem builder + */ + public Builder ip(String ip) { + this.ip = ip; + return this; + } + } + + protected CreateListItemsReqItem() { } + + protected CreateListItemsReqItem(Builder builder) { + asn = builder.asn; + comment = builder.comment; + hostname = builder.hostname; + ip = builder.ip; + } + + /** + * New builder. + * + * @return a CreateListItemsReqItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the asn. + * + * An autonomous system number. + * + * @return the asn + */ + public Double asn() { + return asn; + } + + /** + * Gets the comment. + * + * An informative summary of the list item. + * + * @return the comment + */ + public String comment() { + return comment; + } + + /** + * Gets the hostname. + * + * Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the + * hyphen (-). + * + * @return the hostname + */ + public String hostname() { + return hostname; + } + + /** + * Gets the ip. + * + * An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64. + * + * @return the ip + */ + public String ip() { + return ip; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResp.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResp.java new file mode 100644 index 000000000..be588e1a1 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResp.java @@ -0,0 +1,74 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Create Custom List Response. + */ +public class CustomListResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected CustomListResult result; + + protected CustomListResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public CustomListResult getResult() { + return result; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResult.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResult.java new file mode 100644 index 000000000..ca06739d7 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResult.java @@ -0,0 +1,101 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * CustomListResult. + */ +public class CustomListResult extends GenericModel { + + protected String name; + protected String id; + protected String description; + protected String kind; + @SerializedName("num_items") + protected Double numItems; + @SerializedName("num_referencing_filters") + protected Double numReferencingFilters; + + protected CustomListResult() { } + + /** + * Gets the name. + * + * The name of the list to be referenced by rule expressions. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the id. + * + * The unique ID of the list. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the description. + * + * Describes the contents of the list. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the kind. + * + * The type of resource this list contains. + * + * @return the kind + */ + public String getKind() { + return kind; + } + + /** + * Gets the numItems. + * + * How many items the list contains. + * + * @return the numItems + */ + public Double getNumItems() { + return numItems; + } + + /** + * Gets the numReferencingFilters. + * + * How many times the list is used by rule expressions. + * + * @return the numReferencingFilters + */ + public Double getNumReferencingFilters() { + return numReferencingFilters; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListsResp.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListsResp.java new file mode 100644 index 000000000..3c1c48611 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListsResp.java @@ -0,0 +1,74 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * List Custom Lists Response. + */ +public class CustomListsResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected List result; + + protected CustomListsResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public List getResult() { + return result; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteCustomListOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteCustomListOptions.java new file mode 100644 index 000000000..d76633434 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteCustomListOptions.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteCustomList options. + */ +public class DeleteCustomListOptions extends GenericModel { + + /** + * Construct a new instance of DeleteCustomListOptions. + */ + public DeleteCustomListOptions() { + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsOptions.java new file mode 100644 index 000000000..0a3b4cca7 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsOptions.java @@ -0,0 +1,111 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteListItems options. + */ +public class DeleteListItemsOptions extends GenericModel { + + protected List items; + + /** + * Builder. + */ + public static class Builder { + private List items; + + /** + * Instantiates a new Builder from an existing DeleteListItemsOptions instance. + * + * @param deleteListItemsOptions the instance to initialize the Builder with + */ + private Builder(DeleteListItemsOptions deleteListItemsOptions) { + this.items = deleteListItemsOptions.items; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a DeleteListItemsOptions. + * + * @return the new DeleteListItemsOptions instance + */ + public DeleteListItemsOptions build() { + return new DeleteListItemsOptions(this); + } + + /** + * Adds a new element to items. + * + * @param items the new element to be added + * @return the DeleteListItemsOptions builder + */ + public Builder addItems(DeleteListItemsReqItemsItem items) { + com.ibm.cloud.sdk.core.util.Validator.notNull(items, + "items cannot be null"); + if (this.items == null) { + this.items = new ArrayList(); + } + this.items.add(items); + return this; + } + + /** + * Set the items. + * Existing items will be replaced. + * + * @param items the items + * @return the DeleteListItemsOptions builder + */ + public Builder items(List items) { + this.items = items; + return this; + } + } + + protected DeleteListItemsOptions() { } + + protected DeleteListItemsOptions(Builder builder) { + items = builder.items; + } + + /** + * New builder. + * + * @return a DeleteListItemsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the items. + * + * @return the items + */ + public List items() { + return items; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsReqItemsItem.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsReqItemsItem.java new file mode 100644 index 000000000..f01c13402 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsReqItemsItem.java @@ -0,0 +1,91 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * DeleteListItemsReqItemsItem. + */ +public class DeleteListItemsReqItemsItem extends GenericModel { + + protected String id; + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing DeleteListItemsReqItemsItem instance. + * + * @param deleteListItemsReqItemsItem the instance to initialize the Builder with + */ + private Builder(DeleteListItemsReqItemsItem deleteListItemsReqItemsItem) { + this.id = deleteListItemsReqItemsItem.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a DeleteListItemsReqItemsItem. + * + * @return the new DeleteListItemsReqItemsItem instance + */ + public DeleteListItemsReqItemsItem build() { + return new DeleteListItemsReqItemsItem(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the DeleteListItemsReqItemsItem builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected DeleteListItemsReqItemsItem() { } + + protected DeleteListItemsReqItemsItem(Builder builder) { + id = builder.id; + } + + /** + * New builder. + * + * @return a DeleteListItemsReqItemsItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * @return the id + */ + public String id() { + return id; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceResp.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceResp.java new file mode 100644 index 000000000..af25dddc1 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceResp.java @@ -0,0 +1,74 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * DeleteResourceResp. + */ +public class DeleteResourceResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected DeleteResourceRespResult result; + + protected DeleteResourceResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public DeleteResourceRespResult getResult() { + return result; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespResult.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespResult.java new file mode 100644 index 000000000..c1f806598 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespResult.java @@ -0,0 +1,36 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * DeleteResourceRespResult. + */ +public class DeleteResourceRespResult extends GenericModel { + + protected String id; + + protected DeleteResourceRespResult() { } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListOptions.java new file mode 100644 index 000000000..d810fc736 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListOptions.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getCustomList options. + */ +public class GetCustomListOptions extends GenericModel { + + /** + * Construct a new instance of GetCustomListOptions. + */ + public GetCustomListOptions() { + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListsOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListsOptions.java new file mode 100644 index 000000000..f96ab8908 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListsOptions.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getCustomLists options. + */ +public class GetCustomListsOptions extends GenericModel { + + /** + * Construct a new instance of GetCustomListsOptions. + */ + public GetCustomListsOptions() { + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemOptions.java new file mode 100644 index 000000000..b63d162aa --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemOptions.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getListItem options. + */ +public class GetListItemOptions extends GenericModel { + + /** + * Construct a new instance of GetListItemOptions. + */ + public GetListItemOptions() { + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemsOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemsOptions.java new file mode 100644 index 000000000..2ef98681c --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemsOptions.java @@ -0,0 +1,147 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getListItems options. + */ +public class GetListItemsOptions extends GenericModel { + + protected String cursor; + protected Long perPage; + protected String search; + + /** + * Builder. + */ + public static class Builder { + private String cursor; + private Long perPage; + private String search; + + /** + * Instantiates a new Builder from an existing GetListItemsOptions instance. + * + * @param getListItemsOptions the instance to initialize the Builder with + */ + private Builder(GetListItemsOptions getListItemsOptions) { + this.cursor = getListItemsOptions.cursor; + this.perPage = getListItemsOptions.perPage; + this.search = getListItemsOptions.search; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a GetListItemsOptions. + * + * @return the new GetListItemsOptions instance + */ + public GetListItemsOptions build() { + return new GetListItemsOptions(this); + } + + /** + * Set the cursor. + * + * @param cursor the cursor + * @return the GetListItemsOptions builder + */ + public Builder cursor(String cursor) { + this.cursor = cursor; + return this; + } + + /** + * Set the perPage. + * + * @param perPage the perPage + * @return the GetListItemsOptions builder + */ + public Builder perPage(long perPage) { + this.perPage = perPage; + return this; + } + + /** + * Set the search. + * + * @param search the search + * @return the GetListItemsOptions builder + */ + public Builder search(String search) { + this.search = search; + return this; + } + } + + protected GetListItemsOptions() { } + + protected GetListItemsOptions(Builder builder) { + cursor = builder.cursor; + perPage = builder.perPage; + search = builder.search; + } + + /** + * New builder. + * + * @return a GetListItemsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the cursor. + * + * The pagination cursor. An opaque string token indicating the position from which to continue when requesting the + * next/previous set of records. Cursor values are provided under result_info.cursors in the response. + * + * @return the cursor + */ + public String cursor() { + return cursor; + } + + /** + * Gets the perPage. + * + * Amount of results to include in each paginated response. A non-negative 32 bit integer. Minimum 1, maximum 500. + * + * @return the perPage + */ + public Long perPage() { + return perPage; + } + + /** + * Gets the search. + * + * A search query to filter returned items. Its meaning depends on the list type: IP addresses must start with the + * provided string, hostnames and bulk redirects must contain the string, and ASNs must match the string exactly. + * + * @return the search + */ + public String search() { + return search; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetManagedListsOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetManagedListsOptions.java new file mode 100644 index 000000000..e7fa77c3d --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetManagedListsOptions.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getManagedLists options. + */ +public class GetManagedListsOptions extends GenericModel { + + /** + * Construct a new instance of GetManagedListsOptions. + */ + public GetManagedListsOptions() { + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetOperationStatusOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetOperationStatusOptions.java new file mode 100644 index 000000000..8204161fe --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/GetOperationStatusOptions.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getOperationStatus options. + */ +public class GetOperationStatusOptions extends GenericModel { + + /** + * Construct a new instance of GetOperationStatusOptions. + */ + public GetOperationStatusOptions() { + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListCursor.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListCursor.java new file mode 100644 index 000000000..2d24880cd --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListCursor.java @@ -0,0 +1,50 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ListCursor. + */ +public class ListCursor extends GenericModel { + + protected String after; + protected String before; + + protected ListCursor() { } + + /** + * Gets the after. + * + * The cursor token to fetch the next page of results. + * + * @return the after + */ + public String getAfter() { + return after; + } + + /** + * Gets the before. + * + * The cursor token to fetch the previous page of results. + * + * @return the before + */ + public String getBefore() { + return before; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItem.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItem.java new file mode 100644 index 000000000..1b8e7e18e --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItem.java @@ -0,0 +1,108 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ListItem. + */ +public class ListItem extends GenericModel { + + protected String id; + protected Double asn; + protected String comment; + protected String hostname; + protected String ip; + @SerializedName("created_on") + protected String createdOn; + @SerializedName("modified_on") + protected String modifiedOn; + + protected ListItem() { } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the asn. + * + * An autonomous system number. + * + * @return the asn + */ + public Double getAsn() { + return asn; + } + + /** + * Gets the comment. + * + * An informative summary of the list item. + * + * @return the comment + */ + public String getComment() { + return comment; + } + + /** + * Gets the hostname. + * + * Valid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the + * hyphen (-). + * + * @return the hostname + */ + public String getHostname() { + return hostname; + } + + /** + * Gets the ip. + * + * An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a maximum of /64. + * + * @return the ip + */ + public String getIp() { + return ip; + } + + /** + * Gets the createdOn. + * + * @return the createdOn + */ + public String getCreatedOn() { + return createdOn; + } + + /** + * Gets the modifiedOn. + * + * @return the modifiedOn + */ + public String getModifiedOn() { + return modifiedOn; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemResp.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemResp.java new file mode 100644 index 000000000..db93f1e91 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemResp.java @@ -0,0 +1,74 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ListItemResp. + */ +public class ListItemResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected ListItem result; + + protected ListItemResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public ListItem getResult() { + return result; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResp.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResp.java new file mode 100644 index 000000000..d66978874 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResp.java @@ -0,0 +1,86 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ListItemsResp. + */ +public class ListItemsResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected List result; + @SerializedName("result_info") + protected ListItemsResultInfo resultInfo; + + protected ListItemsResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public List getResult() { + return result; + } + + /** + * Gets the resultInfo. + * + * @return the resultInfo + */ + public ListItemsResultInfo getResultInfo() { + return resultInfo; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResultInfo.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResultInfo.java new file mode 100644 index 000000000..99392c206 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResultInfo.java @@ -0,0 +1,36 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ListItemsResultInfo. + */ +public class ListItemsResultInfo extends GenericModel { + + protected ListCursor cursors; + + protected ListItemsResultInfo() { } + + /** + * Gets the cursors. + * + * @return the cursors + */ + public ListCursor getCursors() { + return cursors; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationResp.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationResp.java new file mode 100644 index 000000000..5686c2f34 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationResp.java @@ -0,0 +1,74 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ListOperationResp. + */ +public class ListOperationResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected ListOperationRespResult result; + + protected ListOperationResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public ListOperationRespResult getResult() { + return result; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespResult.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespResult.java new file mode 100644 index 000000000..ce552665c --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespResult.java @@ -0,0 +1,38 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ListOperationRespResult. + */ +public class ListOperationRespResult extends GenericModel { + + @SerializedName("operation_id") + protected String operationId; + + protected ListOperationRespResult() { } + + /** + * Gets the operationId. + * + * @return the operationId + */ + public String getOperationId() { + return operationId; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResp.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResp.java new file mode 100644 index 000000000..456d6a2b9 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResp.java @@ -0,0 +1,74 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * List Managed Lists Response. + */ +public class ManagedListsResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected List result; + + protected ManagedListsResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public List getResult() { + return result; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResultItem.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResultItem.java new file mode 100644 index 000000000..ab8feb6b8 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResultItem.java @@ -0,0 +1,62 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ManagedListsResultItem. + */ +public class ManagedListsResultItem extends GenericModel { + + protected String name; + protected String description; + protected String kind; + + protected ManagedListsResultItem() { } + + /** + * Gets the name. + * + * The name of the list to be referenced by rule expressions. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Describes the contents of the managed list. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the kind. + * + * The type of resource this list contains. + * + * @return the kind + */ + public String getKind() { + return kind; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusResp.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusResp.java new file mode 100644 index 000000000..96b4ada85 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusResp.java @@ -0,0 +1,74 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * OperationStatusResp. + */ +public class OperationStatusResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected OperationStatusRespResult result; + + protected OperationStatusResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public OperationStatusRespResult getResult() { + return result; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespResult.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespResult.java new file mode 100644 index 000000000..c72caa0d4 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespResult.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * OperationStatusRespResult. + */ +public class OperationStatusRespResult extends GenericModel { + + public interface Status { + /** pending. */ + String PENDING = "pending"; + /** running. */ + String RUNNING = "running"; + /** completed. */ + String COMPLETED = "completed"; + /** failed. */ + String FAILED = "failed"; + } + + protected String id; + protected String status; + protected String completed; + protected String error; + + protected OperationStatusRespResult() { } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the completed. + * + * @return the completed + */ + public String getCompleted() { + return completed; + } + + /** + * Gets the error. + * + * A message describing the error when the status is failed. + * + * @return the error + */ + public String getError() { + return error; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateCustomListOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateCustomListOptions.java new file mode 100644 index 000000000..568f60463 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateCustomListOptions.java @@ -0,0 +1,93 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateCustomList options. + */ +public class UpdateCustomListOptions extends GenericModel { + + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String description; + + /** + * Instantiates a new Builder from an existing UpdateCustomListOptions instance. + * + * @param updateCustomListOptions the instance to initialize the Builder with + */ + private Builder(UpdateCustomListOptions updateCustomListOptions) { + this.description = updateCustomListOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a UpdateCustomListOptions. + * + * @return the new UpdateCustomListOptions instance + */ + public UpdateCustomListOptions build() { + return new UpdateCustomListOptions(this); + } + + /** + * Set the description. + * + * @param description the description + * @return the UpdateCustomListOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected UpdateCustomListOptions() { } + + protected UpdateCustomListOptions(Builder builder) { + description = builder.description; + } + + /** + * New builder. + * + * @return a UpdateCustomListOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the description. + * + * An informative summary of the list. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateListItemsOptions.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateListItemsOptions.java new file mode 100644 index 000000000..53096581b --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateListItemsOptions.java @@ -0,0 +1,111 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateListItems options. + */ +public class UpdateListItemsOptions extends GenericModel { + + protected List createListItemsReqItem; + + /** + * Builder. + */ + public static class Builder { + private List createListItemsReqItem; + + /** + * Instantiates a new Builder from an existing UpdateListItemsOptions instance. + * + * @param updateListItemsOptions the instance to initialize the Builder with + */ + private Builder(UpdateListItemsOptions updateListItemsOptions) { + this.createListItemsReqItem = updateListItemsOptions.createListItemsReqItem; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a UpdateListItemsOptions. + * + * @return the new UpdateListItemsOptions instance + */ + public UpdateListItemsOptions build() { + return new UpdateListItemsOptions(this); + } + + /** + * Adds a new element to createListItemsReqItem. + * + * @param createListItemsReqItem the new element to be added + * @return the UpdateListItemsOptions builder + */ + public Builder addCreateListItemsReqItem(CreateListItemsReqItem createListItemsReqItem) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createListItemsReqItem, + "createListItemsReqItem cannot be null"); + if (this.createListItemsReqItem == null) { + this.createListItemsReqItem = new ArrayList(); + } + this.createListItemsReqItem.add(createListItemsReqItem); + return this; + } + + /** + * Set the createListItemsReqItem. + * Existing createListItemsReqItem will be replaced. + * + * @param createListItemsReqItem the createListItemsReqItem + * @return the UpdateListItemsOptions builder + */ + public Builder createListItemsReqItem(List createListItemsReqItem) { + this.createListItemsReqItem = createListItemsReqItem; + return this; + } + } + + protected UpdateListItemsOptions() { } + + protected UpdateListItemsOptions(Builder builder) { + createListItemsReqItem = builder.createListItemsReqItem; + } + + /** + * New builder. + * + * @return a UpdateListItemsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the createListItemsReqItem. + * + * @return the createListItemsReqItem + */ + public List createListItemsReqItem() { + return createListItemsReqItem; + } +} + diff --git a/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/package-info.java b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/package-info.java new file mode 100644 index 000000000..ed49859b0 --- /dev/null +++ b/modules/lists-api/src/main/java/com/ibm/cloud/networking/lists_api/v1/package-info.java @@ -0,0 +1,17 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +/** + * Lists API v1. + */ +package com.ibm.cloud.networking.lists_api.v1; diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiIT.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiIT.java new file mode 100644 index 000000000..30bba0e7e --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiIT.java @@ -0,0 +1,416 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1; + +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.networking.test.SdkIntegrationTestBase; +import com.ibm.cloud.sdk.core.util.CredentialUtils; + +import com.ibm.cloud.networking.lists_api.v1.ListsApi; +import com.ibm.cloud.networking.lists_api.v1.model.CreateCustomListsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsReqItem; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListResp; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListRespResult; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListsResp; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListsRespResultItem; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsReqItemsItem; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteResourceResp; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteResourceRespResult; +import com.ibm.cloud.networking.lists_api.v1.model.GetCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetCustomListsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetListItemOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetManagedListsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetOperationStatusOptions; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemRespResult; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemsResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemsRespResultItem; +import com.ibm.cloud.networking.lists_api.v1.model.ListOperationResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListOperationRespResult; +import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsResp; +import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsRespResultItem; +import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusResp; +import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusRespResult; +import com.ibm.cloud.networking.lists_api.v1.model.UpdateCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.model.UpdateListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.testng.annotations.Test; +import static org.testng.Assert.*; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; + +public class ListsApiIT extends SdkIntegrationTestBase { + public ListsApi listsApiService = null; + public static Map config = null; + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + String crn = null; + String itemId = null; + String listId = null; + String operationId = null; + + /** + * This method provides our config filename to the base class. + */ + public String getConfigFilename() { + return "../../cloud_internet_services.env"; + } + + @BeforeClass + public void constructService() { + // Ask super if we should skip the tests. + if (skipTests()) { + return; + } + + final String serviceName = "cloud_internet_services"; + + // Load up the config properties for this service. + config = CredentialUtils.getServiceProperties(serviceName); + + // Load Config + crn = config.get("CRN"); + itemId = "test-item-id"; + listId = "test-list-id"; + operationId = "test-operation-id"; + + // set mock values for global params + try { + listsApiService = ListsApi.newInstance(crn, itemId, listId, operationId, serviceName); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println("Setup complete."); + } + + @Test + public void testGetManagedListsWOptions() throws Exception { + try { + GetManagedListsOptions getManagedListsOptionsModel = new GetManagedListsOptions(); + + // Invoke operation + Response response = listsApiService.getManagedLists(getManagedListsOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ManagedListsResp managedListsRespResult = response.getResult(); + List managedListsItems = managedListsRespResult.getResult(); + + assertNotNull(managedListsRespResult); + assertNotNull(managedListsItems); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testGetCustomListsWOptions() throws Exception { + try { + GetCustomListsOptions getCustomListsOptionsModel = new GetCustomListsOptions(); + + // Invoke operation + Response response = listsApiService.getCustomLists(getCustomListsOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + CustomListsResp customListsRespResult = response.getResult(); + List customListsItems = customListsRespResult.getResult(); + + assertNotNull(customListsRespResult); + assertNotNull(customListsItems); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testCreateCustomListsWOptions() throws Exception { + try { + CreateCustomListsOptions createCustomListsOptionsModel = new CreateCustomListsOptions.Builder() + .kind("ip") + .name("Test Custom List") + .description("A test custom list for integration testing") + .build(); + + // Invoke operation + Response response = listsApiService.createCustomLists(createCustomListsOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + CustomListResp customListRespResult = response.getResult(); + CustomListRespResult createdList = customListRespResult.getResult(); + listId = createdList.getId(); + + assertNotNull(customListRespResult); + assertNotNull(createdList); + assertNotNull(listId); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testGetCustomListWOptions() throws Exception { + try { + GetCustomListOptions getCustomListOptionsModel = new GetCustomListOptions(); + + // Invoke operation + Response response = listsApiService.getCustomList(getCustomListOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + CustomListResp customListRespResult = response.getResult(); + CustomListRespResult customList = customListRespResult.getResult(); + + assertNotNull(customListRespResult); + assertNotNull(customList); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testUpdateCustomListWOptions() throws Exception { + try { + UpdateCustomListOptions updateCustomListOptionsModel = new UpdateCustomListOptions.Builder() + .description("Updated description for test custom list") + .build(); + + // Invoke operation + Response response = listsApiService.updateCustomList(updateCustomListOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + CustomListResp customListRespResult = response.getResult(); + CustomListRespResult updatedList = customListRespResult.getResult(); + + assertNotNull(customListRespResult); + assertNotNull(updatedList); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testGetListItemsWOptions() throws Exception { + try { + GetListItemsOptions getListItemsOptionsModel = new GetListItemsOptions.Builder() + .cursor("test-cursor") + .perPage(Long.valueOf("25")) + .search("192.168") + .build(); + + // Invoke operation + Response response = listsApiService.getListItems(getListItemsOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ListItemsResp listItemsRespResult = response.getResult(); + List listItems = listItemsRespResult.getResult(); + + assertNotNull(listItemsRespResult); + assertNotNull(listItems); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testCreateListItemsWOptions() throws Exception { + try { + CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() + .ip("192.168.1.1") + .comment("Test IP address") + .build(); + + CreateListItemsOptions createListItemsOptionsModel = new CreateListItemsOptions.Builder() + .createListItemsReqItem(new java.util.ArrayList( + java.util.Arrays.asList(createListItemsReqItemModel))) + .build(); + + // Invoke operation + Response response = listsApiService.createListItems(createListItemsOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ListOperationResp listOperationRespResult = response.getResult(); + ListOperationRespResult operationResult = listOperationRespResult.getResult(); + operationId = operationResult.getId(); + + assertNotNull(listOperationRespResult); + assertNotNull(operationResult); + assertNotNull(operationId); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testUpdateListItemsWOptions() throws Exception { + try { + CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() + .ip("192.168.1.2") + .comment("Updated test IP address") + .build(); + + UpdateListItemsOptions updateListItemsOptionsModel = new UpdateListItemsOptions.Builder() + .createListItemsReqItem(new java.util.ArrayList( + java.util.Arrays.asList(createListItemsReqItemModel))) + .build(); + + // Invoke operation + Response response = listsApiService.updateListItems(updateListItemsOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ListOperationResp listOperationRespResult = response.getResult(); + ListOperationRespResult operationResult = listOperationRespResult.getResult(); + + assertNotNull(listOperationRespResult); + assertNotNull(operationResult); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testGetListItemWOptions() throws Exception { + try { + GetListItemOptions getListItemOptionsModel = new GetListItemOptions(); + + // Invoke operation + Response response = listsApiService.getListItem(getListItemOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ListItemResp listItemRespResult = response.getResult(); + ListItemRespResult listItem = listItemRespResult.getResult(); + + assertNotNull(listItemRespResult); + assertNotNull(listItem); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testGetOperationStatusWOptions() throws Exception { + try { + GetOperationStatusOptions getOperationStatusOptionsModel = new GetOperationStatusOptions(); + + // Invoke operation + Response response = listsApiService.getOperationStatus(getOperationStatusOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + OperationStatusResp operationStatusRespResult = response.getResult(); + OperationStatusRespResult operationStatus = operationStatusRespResult.getResult(); + + assertNotNull(operationStatusRespResult); + assertNotNull(operationStatus); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testDeleteListItemsWOptions() throws Exception { + try { + DeleteListItemsReqItemsItem deleteListItemsReqItemsItemModel = new DeleteListItemsReqItemsItem.Builder() + .id(itemId) + .build(); + + DeleteListItemsOptions deleteListItemsOptionsModel = new DeleteListItemsOptions.Builder() + .items(new java.util.ArrayList( + java.util.Arrays.asList(deleteListItemsReqItemsItemModel))) + .build(); + + // Invoke operation + Response response = listsApiService.deleteListItems(deleteListItemsOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ListOperationResp listOperationRespResult = response.getResult(); + ListOperationRespResult operationResult = listOperationRespResult.getResult(); + + assertNotNull(listOperationRespResult); + assertNotNull(operationResult); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testDeleteCustomListWOptions() throws Exception { + try { + DeleteCustomListOptions deleteCustomListOptionsModel = new DeleteCustomListOptions(); + + // Invoke operation + Response response = listsApiService.deleteCustomList(deleteCustomListOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + DeleteResourceResp deleteResourceRespResult = response.getResult(); + DeleteResourceRespResult deleteResult = deleteResourceRespResult.getResult(); + + assertNotNull(deleteResourceRespResult); + assertNotNull(deleteResult); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @AfterClass + public void tearDown() { + // Add any clean up logic here + System.out.println("Clean up complete."); + } +} diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiTest.java new file mode 100644 index 000000000..88d017a34 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiTest.java @@ -0,0 +1,696 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1; + +import com.ibm.cloud.networking.lists_api.v1.ListsApi; +import com.ibm.cloud.networking.lists_api.v1.model.CreateCustomListsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsReqItem; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListResp; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListResult; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListsResp; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsReqItemsItem; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteResourceResp; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteResourceRespResult; +import com.ibm.cloud.networking.lists_api.v1.model.GetCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetCustomListsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetListItemOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetManagedListsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.GetOperationStatusOptions; +import com.ibm.cloud.networking.lists_api.v1.model.ListCursor; +import com.ibm.cloud.networking.lists_api.v1.model.ListItem; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemsResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemsResultInfo; +import com.ibm.cloud.networking.lists_api.v1.model.ListOperationResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListOperationRespResult; +import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsResp; +import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsResultItem; +import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusResp; +import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusRespResult; +import com.ibm.cloud.networking.lists_api.v1.model.UpdateCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.model.UpdateListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.IOException; +import java.io.InputStream; +import java.util.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 ListsApi service. + */ +public class ListsApiTest { + + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + protected MockWebServer server; + protected ListsApi listsApiService; + + // Construct the service with a null authenticator (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testConstructorWithNullAuthenticator() throws Throwable { + final String serviceName = "testService"; + // Set mock values for global params + String crn = "testString"; + String itemId = "testString"; + String listId = "testString"; + String operationId = "testString"; + new ListsApi(crn, itemId, listId, operationId, serviceName, null); + } + + + // Test the getter for the crn global parameter + @Test + public void testGetCrn() throws Throwable { + assertEquals(listsApiService.getCrn(), "testString"); + } + + + // Test the getter for the itemId global parameter + @Test + public void testGetItemId() throws Throwable { + assertEquals(listsApiService.getItemId(), "testString"); + } + + + // Test the getter for the listId global parameter + @Test + public void testGetListId() throws Throwable { + assertEquals(listsApiService.getListId(), "testString"); + } + + + // Test the getter for the operationId global parameter + @Test + public void testGetOperationId() throws Throwable { + assertEquals(listsApiService.getOperationId(), "testString"); + } + + // Test the getManagedLists operation with a valid options model parameter + @Test + public void testGetManagedListsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": [{\"name\": \"cf.malware\", \"description\": \"description\", \"kind\": \"ip\"}]}"; + String getManagedListsPath = "/v1/testString/rules/managed_lists"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetManagedListsOptions model + GetManagedListsOptions getManagedListsOptionsModel = new GetManagedListsOptions(); + + // Invoke getManagedLists() with a valid options model and verify the result + Response response = listsApiService.getManagedLists(getManagedListsOptionsModel).execute(); + assertNotNull(response); + ManagedListsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getManagedListsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getManagedLists operation with and without retries enabled + @Test + public void testGetManagedListsWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testGetManagedListsWOptions(); + + listsApiService.disableRetries(); + testGetManagedListsWOptions(); + } + + // Test the getCustomLists operation with a valid options model parameter + @Test + public void testGetCustomListsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": [{\"name\": \"good_ips\", \"id\": \"id\", \"description\": \"description\", \"kind\": \"ip\", \"num_items\": 10, \"num_referencing_filters\": 5}]}"; + String getCustomListsPath = "/v1/testString/rules/lists"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetCustomListsOptions model + GetCustomListsOptions getCustomListsOptionsModel = new GetCustomListsOptions(); + + // Invoke getCustomLists() with a valid options model and verify the result + Response response = listsApiService.getCustomLists(getCustomListsOptionsModel).execute(); + assertNotNull(response); + CustomListsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getCustomListsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getCustomLists operation with and without retries enabled + @Test + public void testGetCustomListsWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testGetCustomListsWOptions(); + + listsApiService.disableRetries(); + testGetCustomListsWOptions(); + } + + // Test the createCustomLists operation with a valid options model parameter + @Test + public void testCreateCustomListsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"name\": \"good_ips\", \"id\": \"id\", \"description\": \"description\", \"kind\": \"ip\", \"num_items\": 10, \"num_referencing_filters\": 5}}"; + String createCustomListsPath = "/v1/testString/rules/lists"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateCustomListsOptions model + CreateCustomListsOptions createCustomListsOptionsModel = new CreateCustomListsOptions.Builder() + .kind("ip") + .name("testString") + .description("testString") + .build(); + + // Invoke createCustomLists() with a valid options model and verify the result + Response response = listsApiService.createCustomLists(createCustomListsOptionsModel).execute(); + assertNotNull(response); + CustomListResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createCustomListsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createCustomLists operation with and without retries enabled + @Test + public void testCreateCustomListsWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testCreateCustomListsWOptions(); + + listsApiService.disableRetries(); + testCreateCustomListsWOptions(); + } + + // Test the getCustomList operation with a valid options model parameter + @Test + public void testGetCustomListWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"name\": \"good_ips\", \"id\": \"id\", \"description\": \"description\", \"kind\": \"ip\", \"num_items\": 10, \"num_referencing_filters\": 5}}"; + String getCustomListPath = "/v1/testString/rules/lists/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetCustomListOptions model + GetCustomListOptions getCustomListOptionsModel = new GetCustomListOptions(); + + // Invoke getCustomList() with a valid options model and verify the result + Response response = listsApiService.getCustomList(getCustomListOptionsModel).execute(); + assertNotNull(response); + CustomListResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getCustomListPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getCustomList operation with and without retries enabled + @Test + public void testGetCustomListWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testGetCustomListWOptions(); + + listsApiService.disableRetries(); + testGetCustomListWOptions(); + } + + // Test the updateCustomList operation with a valid options model parameter + @Test + public void testUpdateCustomListWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"name\": \"good_ips\", \"id\": \"id\", \"description\": \"description\", \"kind\": \"ip\", \"num_items\": 10, \"num_referencing_filters\": 5}}"; + String updateCustomListPath = "/v1/testString/rules/lists/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateCustomListOptions model + UpdateCustomListOptions updateCustomListOptionsModel = new UpdateCustomListOptions.Builder() + .description("testString") + .build(); + + // Invoke updateCustomList() with a valid options model and verify the result + Response response = listsApiService.updateCustomList(updateCustomListOptionsModel).execute(); + assertNotNull(response); + CustomListResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "PUT"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateCustomListPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateCustomList operation with and without retries enabled + @Test + public void testUpdateCustomListWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testUpdateCustomListWOptions(); + + listsApiService.disableRetries(); + testUpdateCustomListWOptions(); + } + + // Test the deleteCustomList operation with a valid options model parameter + @Test + public void testDeleteCustomListWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"34b12448945f11eaa1b71c4d701ab86e\"}}"; + String deleteCustomListPath = "/v1/testString/rules/lists/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteCustomListOptions model + DeleteCustomListOptions deleteCustomListOptionsModel = new DeleteCustomListOptions(); + + // Invoke deleteCustomList() with a valid options model and verify the result + Response response = listsApiService.deleteCustomList(deleteCustomListOptionsModel).execute(); + assertNotNull(response); + DeleteResourceResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "DELETE"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, deleteCustomListPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteCustomList operation with and without retries enabled + @Test + public void testDeleteCustomListWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testDeleteCustomListWOptions(); + + listsApiService.disableRetries(); + testDeleteCustomListWOptions(); + } + + // Test the getListItems operation with a valid options model parameter + @Test + public void testGetListItemsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": [{\"id\": \"70c2009751b24ffc9ed1ab462ba957b4\", \"asn\": 19604, \"comment\": \"My list of developer IPs.\", \"hostname\": \"cloud.ibm.com\", \"ip\": \"172.64.0.0/13\", \"created_on\": \"2025-03-21T16:19:21Z\", \"modified_on\": \"2025-03-21T16:19:37Z\"}], \"result_info\": {\"cursors\": {\"after\": \"yyy\", \"before\": \"xxx\"}}}"; + String getListItemsPath = "/v1/testString/rules/lists/testString/items"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetListItemsOptions model + GetListItemsOptions getListItemsOptionsModel = new GetListItemsOptions.Builder() + .cursor("testString") + .perPage(Long.valueOf("1")) + .search("testString") + .build(); + + // Invoke getListItems() with a valid options model and verify the result + Response response = listsApiService.getListItems(getListItemsOptionsModel).execute(); + assertNotNull(response); + ListItemsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getListItemsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("cursor"), "testString"); + assertEquals(Long.valueOf(query.get("per_page")), Long.valueOf("1")); + assertEquals(query.get("search"), "testString"); + } + + // Test the getListItems operation with and without retries enabled + @Test + public void testGetListItemsWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testGetListItemsWOptions(); + + listsApiService.disableRetries(); + testGetListItemsWOptions(); + } + + // Test the createListItems operation with a valid options model parameter + @Test + public void testCreateListItemsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"operation_id\": \"53d73a83d33d4e3b8791764a9b9f2412\"}}"; + String createListItemsPath = "/v1/testString/rules/lists/testString/items"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateListItemsReqItem model + CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() + .asn(Double.valueOf("19604")) + .comment("My list of developer IPs.") + .hostname("cloud.ibm.com") + .ip("172.64.0.0/13") + .build(); + + // Construct an instance of the CreateListItemsOptions model + CreateListItemsOptions createListItemsOptionsModel = new CreateListItemsOptions.Builder() + .createListItemsReqItem(java.util.Arrays.asList(createListItemsReqItemModel)) + .build(); + + // Invoke createListItems() with a valid options model and verify the result + Response response = listsApiService.createListItems(createListItemsOptionsModel).execute(); + assertNotNull(response); + ListOperationResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createListItemsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createListItems operation with and without retries enabled + @Test + public void testCreateListItemsWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testCreateListItemsWOptions(); + + listsApiService.disableRetries(); + testCreateListItemsWOptions(); + } + + // Test the deleteListItems operation with a valid options model parameter + @Test + public void testDeleteListItemsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"operation_id\": \"53d73a83d33d4e3b8791764a9b9f2412\"}}"; + String deleteListItemsPath = "/v1/testString/rules/lists/testString/items"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteListItemsReqItemsItem model + DeleteListItemsReqItemsItem deleteListItemsReqItemsItemModel = new DeleteListItemsReqItemsItem.Builder() + .id("70c2009751b24ffc9ed1ab462ba957b4") + .build(); + + // Construct an instance of the DeleteListItemsOptions model + DeleteListItemsOptions deleteListItemsOptionsModel = new DeleteListItemsOptions.Builder() + .items(java.util.Arrays.asList(deleteListItemsReqItemsItemModel)) + .build(); + + // Invoke deleteListItems() with a valid options model and verify the result + Response response = listsApiService.deleteListItems(deleteListItemsOptionsModel).execute(); + assertNotNull(response); + ListOperationResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "DELETE"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, deleteListItemsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteListItems operation with and without retries enabled + @Test + public void testDeleteListItemsWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testDeleteListItemsWOptions(); + + listsApiService.disableRetries(); + testDeleteListItemsWOptions(); + } + + // Test the updateListItems operation with a valid options model parameter + @Test + public void testUpdateListItemsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"operation_id\": \"53d73a83d33d4e3b8791764a9b9f2412\"}}"; + String updateListItemsPath = "/v1/testString/rules/lists/testString/items"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateListItemsReqItem model + CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() + .asn(Double.valueOf("19604")) + .comment("My list of developer IPs.") + .hostname("cloud.ibm.com") + .ip("172.64.0.0/13") + .build(); + + // Construct an instance of the UpdateListItemsOptions model + UpdateListItemsOptions updateListItemsOptionsModel = new UpdateListItemsOptions.Builder() + .createListItemsReqItem(java.util.Arrays.asList(createListItemsReqItemModel)) + .build(); + + // Invoke updateListItems() with a valid options model and verify the result + Response response = listsApiService.updateListItems(updateListItemsOptionsModel).execute(); + assertNotNull(response); + ListOperationResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "PUT"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateListItemsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateListItems operation with and without retries enabled + @Test + public void testUpdateListItemsWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testUpdateListItemsWOptions(); + + listsApiService.disableRetries(); + testUpdateListItemsWOptions(); + } + + // Test the getListItem operation with a valid options model parameter + @Test + public void testGetListItemWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"70c2009751b24ffc9ed1ab462ba957b4\", \"asn\": 19604, \"comment\": \"My list of developer IPs.\", \"hostname\": \"cloud.ibm.com\", \"ip\": \"172.64.0.0/13\", \"created_on\": \"2025-03-21T16:19:21Z\", \"modified_on\": \"2025-03-21T16:19:37Z\"}}"; + String getListItemPath = "/v1/testString/rules/lists/testString/items/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetListItemOptions model + GetListItemOptions getListItemOptionsModel = new GetListItemOptions(); + + // Invoke getListItem() with a valid options model and verify the result + Response response = listsApiService.getListItem(getListItemOptionsModel).execute(); + assertNotNull(response); + ListItemResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getListItemPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getListItem operation with and without retries enabled + @Test + public void testGetListItemWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testGetListItemWOptions(); + + listsApiService.disableRetries(); + testGetListItemWOptions(); + } + + // Test the getOperationStatus operation with a valid options model parameter + @Test + public void testGetOperationStatusWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"0147be950d5c42b8b47c07792c5015e3\", \"status\": \"completed\", \"completed\": \"2025-03-21T16:07:41.782564Z\", \"error\": \"error\"}}"; + String getOperationStatusPath = "/v1/testString/rules/lists/bulk_operations/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetOperationStatusOptions model + GetOperationStatusOptions getOperationStatusOptionsModel = new GetOperationStatusOptions(); + + // Invoke getOperationStatus() with a valid options model and verify the result + Response response = listsApiService.getOperationStatus(getOperationStatusOptionsModel).execute(); + assertNotNull(response); + OperationStatusResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getOperationStatusPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getOperationStatus operation with and without retries enabled + @Test + public void testGetOperationStatusWRetries() throws Throwable { + listsApiService.enableRetries(4, 30); + testGetOperationStatusWOptions(); + + listsApiService.disableRetries(); + testGetOperationStatusWOptions(); + } + + // Perform setup needed before each test method + @BeforeMethod + public void beforeEachTest() { + // Start the mock server. + try { + server = new MockWebServer(); + server.start(); + } catch (IOException err) { + fail("Failed to instantiate mock web server"); + } + + // Construct an instance of the service + constructClientService(); + } + + // Perform tear down after each test method + @AfterMethod + public void afterEachTest() throws IOException { + server.shutdown(); + listsApiService = null; + } + + // Constructs an instance of the service to be used by the tests + public void constructClientService() { + System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); + final String serviceName = "testService"; + // set mock values for global params + String crn = "testString"; + String itemId = "testString"; + String listId = "testString"; + String operationId = "testString"; + + listsApiService = ListsApi.newInstance(crn, itemId, listId, operationId, serviceName); + String url = server.url("/").toString(); + listsApiService.setServiceUrl(url); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateCustomListsOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateCustomListsOptionsTest.java new file mode 100644 index 000000000..6c618d2c5 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateCustomListsOptionsTest.java @@ -0,0 +1,43 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.CreateCustomListsOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateCustomListsOptions model. + */ +public class CreateCustomListsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateCustomListsOptions() throws Throwable { + CreateCustomListsOptions createCustomListsOptionsModel = new CreateCustomListsOptions.Builder() + .kind("ip") + .name("testString") + .description("testString") + .build(); + assertEquals(createCustomListsOptionsModel.kind(), "ip"); + assertEquals(createCustomListsOptionsModel.name(), "testString"); + assertEquals(createCustomListsOptionsModel.description(), "testString"); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsOptionsTest.java new file mode 100644 index 000000000..970e04283 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsOptionsTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsReqItem; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateListItemsOptions model. + */ +public class CreateListItemsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateListItemsOptions() throws Throwable { + CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() + .asn(Double.valueOf("19604")) + .comment("My list of developer IPs.") + .hostname("cloud.ibm.com") + .ip("172.64.0.0/13") + .build(); + assertEquals(createListItemsReqItemModel.asn(), Double.valueOf("19604")); + assertEquals(createListItemsReqItemModel.comment(), "My list of developer IPs."); + assertEquals(createListItemsReqItemModel.hostname(), "cloud.ibm.com"); + assertEquals(createListItemsReqItemModel.ip(), "172.64.0.0/13"); + + CreateListItemsOptions createListItemsOptionsModel = new CreateListItemsOptions.Builder() + .createListItemsReqItem(java.util.Arrays.asList(createListItemsReqItemModel)) + .build(); + assertEquals(createListItemsOptionsModel.createListItemsReqItem(), java.util.Arrays.asList(createListItemsReqItemModel)); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsReqItemTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsReqItemTest.java new file mode 100644 index 000000000..9c438cef6 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CreateListItemsReqItemTest.java @@ -0,0 +1,54 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsReqItem; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateListItemsReqItem model. + */ +public class CreateListItemsReqItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateListItemsReqItem() throws Throwable { + CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() + .asn(Double.valueOf("19604")) + .comment("My list of developer IPs.") + .hostname("cloud.ibm.com") + .ip("172.64.0.0/13") + .build(); + assertEquals(createListItemsReqItemModel.asn(), Double.valueOf("19604")); + assertEquals(createListItemsReqItemModel.comment(), "My list of developer IPs."); + assertEquals(createListItemsReqItemModel.hostname(), "cloud.ibm.com"); + assertEquals(createListItemsReqItemModel.ip(), "172.64.0.0/13"); + + String json = TestUtilities.serialize(createListItemsReqItemModel); + + CreateListItemsReqItem createListItemsReqItemModelNew = TestUtilities.deserialize(json, CreateListItemsReqItem.class); + assertTrue(createListItemsReqItemModelNew instanceof CreateListItemsReqItem); + assertEquals(createListItemsReqItemModelNew.asn(), Double.valueOf("19604")); + assertEquals(createListItemsReqItemModelNew.comment(), "My list of developer IPs."); + assertEquals(createListItemsReqItemModelNew.hostname(), "cloud.ibm.com"); + assertEquals(createListItemsReqItemModelNew.ip(), "172.64.0.0/13"); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListRespTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListRespTest.java new file mode 100644 index 000000000..1f1c667de --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListRespTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.CustomListResp; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListResult; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CustomListResp model. + */ +public class CustomListRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCustomListResp() throws Throwable { + CustomListResp customListRespModel = new CustomListResp(); + assertNull(customListRespModel.isSuccess()); + assertNull(customListRespModel.getErrors()); + assertNull(customListRespModel.getMessages()); + assertNull(customListRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResultTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResultTest.java new file mode 100644 index 000000000..7ba04eb74 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListResultTest.java @@ -0,0 +1,42 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.CustomListResult; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CustomListResult model. + */ +public class CustomListResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCustomListResult() throws Throwable { + CustomListResult customListResultModel = new CustomListResult(); + assertNull(customListResultModel.getName()); + assertNull(customListResultModel.getId()); + assertNull(customListResultModel.getDescription()); + assertNull(customListResultModel.getKind()); + assertNull(customListResultModel.getNumItems()); + assertNull(customListResultModel.getNumReferencingFilters()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListsRespTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListsRespTest.java new file mode 100644 index 000000000..cf59ffb95 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/CustomListsRespTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.CustomListResult; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListsResp; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CustomListsResp model. + */ +public class CustomListsRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCustomListsResp() throws Throwable { + CustomListsResp customListsRespModel = new CustomListsResp(); + assertNull(customListsRespModel.isSuccess()); + assertNull(customListsRespModel.getErrors()); + assertNull(customListsRespModel.getMessages()); + assertNull(customListsRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteCustomListOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteCustomListOptionsTest.java new file mode 100644 index 000000000..195e74a01 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteCustomListOptionsTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.DeleteCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteCustomListOptions model. + */ +public class DeleteCustomListOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteCustomListOptions() throws Throwable { + DeleteCustomListOptions deleteCustomListOptionsModel = new DeleteCustomListOptions(); + assertNotNull(deleteCustomListOptionsModel); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsOptionsTest.java new file mode 100644 index 000000000..3ecff862d --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsOptionsTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsReqItemsItem; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteListItemsOptions model. + */ +public class DeleteListItemsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteListItemsOptions() throws Throwable { + DeleteListItemsReqItemsItem deleteListItemsReqItemsItemModel = new DeleteListItemsReqItemsItem.Builder() + .id("70c2009751b24ffc9ed1ab462ba957b4") + .build(); + assertEquals(deleteListItemsReqItemsItemModel.id(), "70c2009751b24ffc9ed1ab462ba957b4"); + + DeleteListItemsOptions deleteListItemsOptionsModel = new DeleteListItemsOptions.Builder() + .items(java.util.Arrays.asList(deleteListItemsReqItemsItemModel)) + .build(); + assertEquals(deleteListItemsOptionsModel.items(), java.util.Arrays.asList(deleteListItemsReqItemsItemModel)); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsReqItemsItemTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsReqItemsItemTest.java new file mode 100644 index 000000000..3ee34ffa9 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsReqItemsItemTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsReqItemsItem; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteListItemsReqItemsItem model. + */ +public class DeleteListItemsReqItemsItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteListItemsReqItemsItem() throws Throwable { + DeleteListItemsReqItemsItem deleteListItemsReqItemsItemModel = new DeleteListItemsReqItemsItem.Builder() + .id("70c2009751b24ffc9ed1ab462ba957b4") + .build(); + assertEquals(deleteListItemsReqItemsItemModel.id(), "70c2009751b24ffc9ed1ab462ba957b4"); + + String json = TestUtilities.serialize(deleteListItemsReqItemsItemModel); + + DeleteListItemsReqItemsItem deleteListItemsReqItemsItemModelNew = TestUtilities.deserialize(json, DeleteListItemsReqItemsItem.class); + assertTrue(deleteListItemsReqItemsItemModelNew instanceof DeleteListItemsReqItemsItem); + assertEquals(deleteListItemsReqItemsItemModelNew.id(), "70c2009751b24ffc9ed1ab462ba957b4"); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespResultTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespResultTest.java new file mode 100644 index 000000000..bae791be5 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespResultTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.DeleteResourceRespResult; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteResourceRespResult model. + */ +public class DeleteResourceRespResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteResourceRespResult() throws Throwable { + DeleteResourceRespResult deleteResourceRespResultModel = new DeleteResourceRespResult(); + assertNull(deleteResourceRespResultModel.getId()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespTest.java new file mode 100644 index 000000000..cc0a065d5 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteResourceRespTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.DeleteResourceResp; +import com.ibm.cloud.networking.lists_api.v1.model.DeleteResourceRespResult; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteResourceResp model. + */ +public class DeleteResourceRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteResourceResp() throws Throwable { + DeleteResourceResp deleteResourceRespModel = new DeleteResourceResp(); + assertNull(deleteResourceRespModel.isSuccess()); + assertNull(deleteResourceRespModel.getErrors()); + assertNull(deleteResourceRespModel.getMessages()); + assertNull(deleteResourceRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListOptionsTest.java new file mode 100644 index 000000000..6d89d2f71 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListOptionsTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.GetCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetCustomListOptions model. + */ +public class GetCustomListOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetCustomListOptions() throws Throwable { + GetCustomListOptions getCustomListOptionsModel = new GetCustomListOptions(); + assertNotNull(getCustomListOptionsModel); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListsOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListsOptionsTest.java new file mode 100644 index 000000000..f371f40f5 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetCustomListsOptionsTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.GetCustomListsOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetCustomListsOptions model. + */ +public class GetCustomListsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetCustomListsOptions() throws Throwable { + GetCustomListsOptions getCustomListsOptionsModel = new GetCustomListsOptions(); + assertNotNull(getCustomListsOptionsModel); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemOptionsTest.java new file mode 100644 index 000000000..2d8fc56db --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemOptionsTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.GetListItemOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetListItemOptions model. + */ +public class GetListItemOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetListItemOptions() throws Throwable { + GetListItemOptions getListItemOptionsModel = new GetListItemOptions(); + assertNotNull(getListItemOptionsModel); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemsOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemsOptionsTest.java new file mode 100644 index 000000000..ef08aeef7 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetListItemsOptionsTest.java @@ -0,0 +1,43 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.GetListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetListItemsOptions model. + */ +public class GetListItemsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetListItemsOptions() throws Throwable { + GetListItemsOptions getListItemsOptionsModel = new GetListItemsOptions.Builder() + .cursor("testString") + .perPage(Long.valueOf("1")) + .search("testString") + .build(); + assertEquals(getListItemsOptionsModel.cursor(), "testString"); + assertEquals(getListItemsOptionsModel.perPage(), Long.valueOf("1")); + assertEquals(getListItemsOptionsModel.search(), "testString"); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetManagedListsOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetManagedListsOptionsTest.java new file mode 100644 index 000000000..95a5e08af --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetManagedListsOptionsTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.GetManagedListsOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetManagedListsOptions model. + */ +public class GetManagedListsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetManagedListsOptions() throws Throwable { + GetManagedListsOptions getManagedListsOptionsModel = new GetManagedListsOptions(); + assertNotNull(getManagedListsOptionsModel); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetOperationStatusOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetOperationStatusOptionsTest.java new file mode 100644 index 000000000..c50a71fe6 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/GetOperationStatusOptionsTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.GetOperationStatusOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetOperationStatusOptions model. + */ +public class GetOperationStatusOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetOperationStatusOptions() throws Throwable { + GetOperationStatusOptions getOperationStatusOptionsModel = new GetOperationStatusOptions(); + assertNotNull(getOperationStatusOptionsModel); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListCursorTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListCursorTest.java new file mode 100644 index 000000000..8550c3f33 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListCursorTest.java @@ -0,0 +1,38 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.ListCursor; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListCursor model. + */ +public class ListCursorTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListCursor() throws Throwable { + ListCursor listCursorModel = new ListCursor(); + assertNull(listCursorModel.getAfter()); + assertNull(listCursorModel.getBefore()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemRespTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemRespTest.java new file mode 100644 index 000000000..f3b278eb4 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemRespTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.ListItem; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemResp; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListItemResp model. + */ +public class ListItemRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListItemResp() throws Throwable { + ListItemResp listItemRespModel = new ListItemResp(); + assertNull(listItemRespModel.isSuccess()); + assertNull(listItemRespModel.getErrors()); + assertNull(listItemRespModel.getMessages()); + assertNull(listItemRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemTest.java new file mode 100644 index 000000000..253893858 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemTest.java @@ -0,0 +1,43 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.ListItem; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListItem model. + */ +public class ListItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListItem() throws Throwable { + ListItem listItemModel = new ListItem(); + assertNull(listItemModel.getId()); + assertNull(listItemModel.getAsn()); + assertNull(listItemModel.getComment()); + assertNull(listItemModel.getHostname()); + assertNull(listItemModel.getIp()); + assertNull(listItemModel.getCreatedOn()); + assertNull(listItemModel.getModifiedOn()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsRespTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsRespTest.java new file mode 100644 index 000000000..d84531e45 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsRespTest.java @@ -0,0 +1,44 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.ListCursor; +import com.ibm.cloud.networking.lists_api.v1.model.ListItem; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemsResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemsResultInfo; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListItemsResp model. + */ +public class ListItemsRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListItemsResp() throws Throwable { + ListItemsResp listItemsRespModel = new ListItemsResp(); + assertNull(listItemsRespModel.isSuccess()); + assertNull(listItemsRespModel.getErrors()); + assertNull(listItemsRespModel.getMessages()); + assertNull(listItemsRespModel.getResult()); + assertNull(listItemsRespModel.getResultInfo()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResultInfoTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResultInfoTest.java new file mode 100644 index 000000000..93534d309 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListItemsResultInfoTest.java @@ -0,0 +1,38 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.ListCursor; +import com.ibm.cloud.networking.lists_api.v1.model.ListItemsResultInfo; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListItemsResultInfo model. + */ +public class ListItemsResultInfoTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListItemsResultInfo() throws Throwable { + ListItemsResultInfo listItemsResultInfoModel = new ListItemsResultInfo(); + assertNull(listItemsResultInfoModel.getCursors()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespResultTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespResultTest.java new file mode 100644 index 000000000..6cabfa3cb --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespResultTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.ListOperationRespResult; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListOperationRespResult model. + */ +public class ListOperationRespResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListOperationRespResult() throws Throwable { + ListOperationRespResult listOperationRespResultModel = new ListOperationRespResult(); + assertNull(listOperationRespResultModel.getOperationId()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespTest.java new file mode 100644 index 000000000..2fda2a0cb --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ListOperationRespTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.ListOperationResp; +import com.ibm.cloud.networking.lists_api.v1.model.ListOperationRespResult; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListOperationResp model. + */ +public class ListOperationRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListOperationResp() throws Throwable { + ListOperationResp listOperationRespModel = new ListOperationResp(); + assertNull(listOperationRespModel.isSuccess()); + assertNull(listOperationRespModel.getErrors()); + assertNull(listOperationRespModel.getMessages()); + assertNull(listOperationRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsRespTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsRespTest.java new file mode 100644 index 000000000..65c553c13 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsRespTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsResp; +import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsResultItem; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ManagedListsResp model. + */ +public class ManagedListsRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testManagedListsResp() throws Throwable { + ManagedListsResp managedListsRespModel = new ManagedListsResp(); + assertNull(managedListsRespModel.isSuccess()); + assertNull(managedListsRespModel.getErrors()); + assertNull(managedListsRespModel.getMessages()); + assertNull(managedListsRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResultItemTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResultItemTest.java new file mode 100644 index 000000000..ca5658fe5 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/ManagedListsResultItemTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsResultItem; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ManagedListsResultItem model. + */ +public class ManagedListsResultItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testManagedListsResultItem() throws Throwable { + ManagedListsResultItem managedListsResultItemModel = new ManagedListsResultItem(); + assertNull(managedListsResultItemModel.getName()); + assertNull(managedListsResultItemModel.getDescription()); + assertNull(managedListsResultItemModel.getKind()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespResultTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespResultTest.java new file mode 100644 index 000000000..5c8f22592 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespResultTest.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusRespResult; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the OperationStatusRespResult model. + */ +public class OperationStatusRespResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testOperationStatusRespResult() throws Throwable { + OperationStatusRespResult operationStatusRespResultModel = new OperationStatusRespResult(); + assertNull(operationStatusRespResultModel.getId()); + assertNull(operationStatusRespResultModel.getStatus()); + assertNull(operationStatusRespResultModel.getCompleted()); + assertNull(operationStatusRespResultModel.getError()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespTest.java new file mode 100644 index 000000000..7899082be --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/OperationStatusRespTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusResp; +import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusRespResult; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the OperationStatusResp model. + */ +public class OperationStatusRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testOperationStatusResp() throws Throwable { + OperationStatusResp operationStatusRespModel = new OperationStatusResp(); + assertNull(operationStatusRespModel.isSuccess()); + assertNull(operationStatusRespModel.getErrors()); + assertNull(operationStatusRespModel.getMessages()); + assertNull(operationStatusRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateCustomListOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateCustomListOptionsTest.java new file mode 100644 index 000000000..0b6049ffe --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateCustomListOptionsTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.UpdateCustomListOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateCustomListOptions model. + */ +public class UpdateCustomListOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateCustomListOptions() throws Throwable { + UpdateCustomListOptions updateCustomListOptionsModel = new UpdateCustomListOptions.Builder() + .description("testString") + .build(); + assertEquals(updateCustomListOptionsModel.description(), "testString"); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateListItemsOptionsTest.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateListItemsOptionsTest.java new file mode 100644 index 000000000..6673ef2dd --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/UpdateListItemsOptionsTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.model; + +import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsReqItem; +import com.ibm.cloud.networking.lists_api.v1.model.UpdateListItemsOptions; +import com.ibm.cloud.networking.lists_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateListItemsOptions model. + */ +public class UpdateListItemsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateListItemsOptions() throws Throwable { + CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() + .asn(Double.valueOf("19604")) + .comment("My list of developer IPs.") + .hostname("cloud.ibm.com") + .ip("172.64.0.0/13") + .build(); + assertEquals(createListItemsReqItemModel.asn(), Double.valueOf("19604")); + assertEquals(createListItemsReqItemModel.comment(), "My list of developer IPs."); + assertEquals(createListItemsReqItemModel.hostname(), "cloud.ibm.com"); + assertEquals(createListItemsReqItemModel.ip(), "172.64.0.0/13"); + + UpdateListItemsOptions updateListItemsOptionsModel = new UpdateListItemsOptions.Builder() + .createListItemsReqItem(java.util.Arrays.asList(createListItemsReqItemModel)) + .build(); + assertEquals(updateListItemsOptionsModel.createListItemsReqItem(), java.util.Arrays.asList(createListItemsReqItemModel)); + } +} \ No newline at end of file diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/utils/TestUtilities.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/utils/TestUtilities.java new file mode 100644 index 000000000..c1bb0b980 --- /dev/null +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/utils/TestUtilities.java @@ -0,0 +1,131 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.lists_api.v1.utils; + +import java.util.Base64; +import java.util.Map; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.io.InputStream; +import java.io.ByteArrayInputStream; + +import okhttp3.mockwebserver.RecordedRequest; +import okhttp3.HttpUrl; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.sdk.core.util.GsonSingleton; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; + +/** + * A class used by the unit tests containing utility functions. + */ +public class TestUtilities { + public static Map createMockMap() { + Map mockMap = new HashMap<>(); + mockMap.put("foo", "bar"); + return mockMap; + } + + public static HashMap createMockStreamMap() { + return new HashMap() { + { put("key1", createMockStream("This is a mock file.")); } + }; + } + + public static Map parseQueryString(RecordedRequest req) { + Map queryMap = new HashMap<>(); + + try { + HttpUrl requestUrl = req.getRequestUrl(); + + if (requestUrl != null) { + Set queryParamsNames = requestUrl.queryParameterNames(); + // map the parameter name to its corresponding value + for (String p : queryParamsNames) { + // get the corresponding value for the parameter (p) + List val = requestUrl.queryParameterValues(p); + if (val != null && !val.isEmpty()) { + String joinedQuery = String.join(",", val); + queryMap.put(p, joinedQuery); + } + } + } + if (queryMap.isEmpty()) { + return null; + } + } catch (Exception e) { + return null; + } + + return queryMap; + } + + public static String parseReqPath(RecordedRequest req) { + String parsedPath = null; + + try { + String fullPath = req.getPath(); + if (fullPath != null && !fullPath.isEmpty()) { + // retrieve the path segment before the query parameter + parsedPath = fullPath.split("\\?", 2)[0]; + } + if (parsedPath.isEmpty() || parsedPath == null) { + return null; + } + + } catch (Exception e) { + return null; + } + + return parsedPath; + } + + public static String serialize(Object obj) { + return GsonSingleton.getGson().toJson(obj); + } + + public static T deserialize(String json, Class clazz) { + return GsonSingleton.getGson().fromJson(json, clazz); + } + + public static InputStream createMockStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + public static List creatMockListFileWithMetadata() { + List list = new ArrayList(); + byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; + InputStream inputStream = new ByteArrayInputStream(fileBytes); + FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); + builder.data(inputStream); + FileWithMetadata fileWithMetadata = builder.build(); + list.add(fileWithMetadata); + + return list; + } + + public static byte[] createMockByteArray(String encodedString) throws Exception { + return Base64.getDecoder().decode(encodedString); + } + + public static Date createMockDate(String date) throws Exception { + return DateUtils.parseAsDate(date); + } + + public static Date createMockDateTime(String date) throws Exception { + return DateUtils.parseAsDateTime(date); + } +} \ No newline at end of file From 832bd3fb355eef62deebedaa3f6425be051fb548 Mon Sep 17 00:00:00 2001 From: Sirija Reddy Date: Thu, 30 Apr 2026 21:41:54 +0530 Subject: [PATCH 2/3] fix: update secrets.baseline file Signed-off-by: Sirija Reddy --- .secrets.baseline | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 075ee76ed..7a933e952 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "package-lock.json|go.sum|^.secrets.baseline$", "lines": null }, - "generated_at": "2026-02-21T04:01:49Z", + "generated_at": "2026-04-30T16:11:17Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -70,7 +70,7 @@ "hashed_secret": "b8fb27ac44ff8a4d5237588af39c5fb65bbedc3f", "is_secret": false, "is_verified": false, - "line_number": 42, + "line_number": 34, "type": "Secret Keyword", "verified_result": null } @@ -465,6 +465,36 @@ "verified_result": null } ], + "modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiTest.java": [ + { + "hashed_secret": "8b925687481f5976edfc3091ec3a146a18af9736", + "is_secret": false, + "is_verified": false, + "line_number": 488, + "type": "Hex High Entropy String", + "verified_result": null + } + ], + "modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsOptionsTest.java": [ + { + "hashed_secret": "8b925687481f5976edfc3091ec3a146a18af9736", + "is_secret": false, + "is_verified": false, + "line_number": 38, + "type": "Hex High Entropy String", + "verified_result": null + } + ], + "modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/model/DeleteListItemsReqItemsItemTest.java": [ + { + "hashed_secret": "8b925687481f5976edfc3091ec3a146a18af9736", + "is_secret": false, + "is_verified": false, + "line_number": 43, + "type": "Hex High Entropy String", + "verified_result": null + } + ], "modules/ssl-certificate-api/src/test/java/com/ibm/cloud/networking/ssl_certificate_api/v1/SslCertificateApiIT.java": [ { "hashed_secret": "5293490d2fcdff1d7481271e4fb549ed36b75140", From e03fdf1a668487ccf00cef62a96e0ce008c4408c Mon Sep 17 00:00:00 2001 From: Sirija Reddy Date: Sun, 3 May 2026 14:45:48 +0530 Subject: [PATCH 3/3] fix: add pom.xml files Signed-off-by: Sirija Reddy --- modules/lists-api/pom.xml | 63 ++++++++ .../networking/lists_api/v1/ListsApiIT.java | 150 +++++++++--------- pom.xml | 1 + 3 files changed, 141 insertions(+), 73 deletions(-) create mode 100644 modules/lists-api/pom.xml diff --git a/modules/lists-api/pom.xml b/modules/lists-api/pom.xml new file mode 100644 index 000000000..17c04128b --- /dev/null +++ b/modules/lists-api/pom.xml @@ -0,0 +1,63 @@ + + 4.0.0 + + + networking + com.ibm.cloud + 99-SNAPSHOT + ../.. + + + lists-api + + Cloud Internet Services lists-api + jar + + + + com.ibm.cloud + sdk-core + + + networking-common + ${project.groupId} + + + networking-common + ${project.groupId} + test-jar + tests + test + + + org.testng + testng + test + + + com.squareup.okhttp3 + mockwebserver + test + + + org.powermock + powermock-api-mockito2 + test + + + org.powermock + powermock-module-testng + test + + + + + + IBM Cloud DevX SDK Development + devxsdk@us.ibm.com + https://www.ibm.com/ + + + + diff --git a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiIT.java b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiIT.java index 30bba0e7e..5ab802cc7 100644 --- a/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiIT.java +++ b/modules/lists-api/src/test/java/com/ibm/cloud/networking/lists_api/v1/ListsApiIT.java @@ -24,9 +24,8 @@ import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsOptions; import com.ibm.cloud.networking.lists_api.v1.model.CreateListItemsReqItem; import com.ibm.cloud.networking.lists_api.v1.model.CustomListResp; -import com.ibm.cloud.networking.lists_api.v1.model.CustomListRespResult; +import com.ibm.cloud.networking.lists_api.v1.model.CustomListResult; import com.ibm.cloud.networking.lists_api.v1.model.CustomListsResp; -import com.ibm.cloud.networking.lists_api.v1.model.CustomListsRespResultItem; import com.ibm.cloud.networking.lists_api.v1.model.DeleteCustomListOptions; import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsOptions; import com.ibm.cloud.networking.lists_api.v1.model.DeleteListItemsReqItemsItem; @@ -38,14 +37,13 @@ import com.ibm.cloud.networking.lists_api.v1.model.GetListItemsOptions; import com.ibm.cloud.networking.lists_api.v1.model.GetManagedListsOptions; import com.ibm.cloud.networking.lists_api.v1.model.GetOperationStatusOptions; +import com.ibm.cloud.networking.lists_api.v1.model.ListItem; import com.ibm.cloud.networking.lists_api.v1.model.ListItemResp; -import com.ibm.cloud.networking.lists_api.v1.model.ListItemRespResult; import com.ibm.cloud.networking.lists_api.v1.model.ListItemsResp; -import com.ibm.cloud.networking.lists_api.v1.model.ListItemsRespResultItem; import com.ibm.cloud.networking.lists_api.v1.model.ListOperationResp; import com.ibm.cloud.networking.lists_api.v1.model.ListOperationRespResult; import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsResp; -import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsRespResultItem; +import com.ibm.cloud.networking.lists_api.v1.model.ManagedListsResultItem; import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusResp; import com.ibm.cloud.networking.lists_api.v1.model.OperationStatusRespResult; import com.ibm.cloud.networking.lists_api.v1.model.UpdateCustomListOptions; @@ -93,9 +91,9 @@ public void constructService() { // Load Config crn = config.get("CRN"); - itemId = "test-item-id"; - listId = "test-list-id"; - operationId = "test-operation-id"; + itemId = "00000000000000000000000000000001"; + listId = "00000000000000000000000000000001"; + operationId = "00000000000000000000000000000001"; // set mock values for global params try { @@ -107,7 +105,7 @@ public void constructService() { System.out.println("Setup complete."); } - @Test + @Test(priority = 1) public void testGetManagedListsWOptions() throws Exception { try { GetManagedListsOptions getManagedListsOptionsModel = new GetManagedListsOptions(); @@ -119,7 +117,7 @@ public void testGetManagedListsWOptions() throws Exception { assertEquals(response.getStatusCode(), 200); ManagedListsResp managedListsRespResult = response.getResult(); - List managedListsItems = managedListsRespResult.getResult(); + List managedListsItems = managedListsRespResult.getResult(); assertNotNull(managedListsRespResult); assertNotNull(managedListsItems); @@ -129,7 +127,7 @@ public void testGetManagedListsWOptions() throws Exception { } } - @Test + @Test(priority = 2) public void testGetCustomListsWOptions() throws Exception { try { GetCustomListsOptions getCustomListsOptionsModel = new GetCustomListsOptions(); @@ -141,7 +139,7 @@ public void testGetCustomListsWOptions() throws Exception { assertEquals(response.getStatusCode(), 200); CustomListsResp customListsRespResult = response.getResult(); - List customListsItems = customListsRespResult.getResult(); + List customListsItems = customListsRespResult.getResult(); assertNotNull(customListsRespResult); assertNotNull(customListsItems); @@ -151,12 +149,12 @@ public void testGetCustomListsWOptions() throws Exception { } } - @Test + @Test(priority = 3) public void testCreateCustomListsWOptions() throws Exception { try { CreateCustomListsOptions createCustomListsOptionsModel = new CreateCustomListsOptions.Builder() .kind("ip") - .name("Test Custom List") + .name("test_custom_list") .description("A test custom list for integration testing") .build(); @@ -167,8 +165,9 @@ public void testCreateCustomListsWOptions() throws Exception { assertEquals(response.getStatusCode(), 200); CustomListResp customListRespResult = response.getResult(); - CustomListRespResult createdList = customListRespResult.getResult(); + CustomListResult createdList = customListRespResult.getResult(); listId = createdList.getId(); + listsApiService.setListId(listId); assertNotNull(customListRespResult); assertNotNull(createdList); @@ -179,7 +178,7 @@ public void testCreateCustomListsWOptions() throws Exception { } } - @Test + @Test(priority = 4) public void testGetCustomListWOptions() throws Exception { try { GetCustomListOptions getCustomListOptionsModel = new GetCustomListOptions(); @@ -191,7 +190,7 @@ public void testGetCustomListWOptions() throws Exception { assertEquals(response.getStatusCode(), 200); CustomListResp customListRespResult = response.getResult(); - CustomListRespResult customList = customListRespResult.getResult(); + CustomListResult customList = customListRespResult.getResult(); assertNotNull(customListRespResult); assertNotNull(customList); @@ -201,7 +200,7 @@ public void testGetCustomListWOptions() throws Exception { } } - @Test + @Test(priority = 5) public void testUpdateCustomListWOptions() throws Exception { try { UpdateCustomListOptions updateCustomListOptionsModel = new UpdateCustomListOptions.Builder() @@ -215,7 +214,7 @@ public void testUpdateCustomListWOptions() throws Exception { assertEquals(response.getStatusCode(), 200); CustomListResp customListRespResult = response.getResult(); - CustomListRespResult updatedList = customListRespResult.getResult(); + CustomListResult updatedList = customListRespResult.getResult(); assertNotNull(customListRespResult); assertNotNull(updatedList); @@ -225,33 +224,7 @@ public void testUpdateCustomListWOptions() throws Exception { } } - @Test - public void testGetListItemsWOptions() throws Exception { - try { - GetListItemsOptions getListItemsOptionsModel = new GetListItemsOptions.Builder() - .cursor("test-cursor") - .perPage(Long.valueOf("25")) - .search("192.168") - .build(); - - // Invoke operation - Response response = listsApiService.getListItems(getListItemsOptionsModel).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ListItemsResp listItemsRespResult = response.getResult(); - List listItems = listItemsRespResult.getResult(); - - assertNotNull(listItemsRespResult); - assertNotNull(listItems); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); - } - } - - @Test + @Test(priority = 6) public void testCreateListItemsWOptions() throws Exception { try { CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() @@ -272,7 +245,8 @@ public void testCreateListItemsWOptions() throws Exception { ListOperationResp listOperationRespResult = response.getResult(); ListOperationRespResult operationResult = listOperationRespResult.getResult(); - operationId = operationResult.getId(); + operationId = operationResult.getOperationId(); + listsApiService.setOperationId(operationId); assertNotNull(listOperationRespResult); assertNotNull(operationResult); @@ -283,37 +257,59 @@ public void testCreateListItemsWOptions() throws Exception { } } - @Test - public void testUpdateListItemsWOptions() throws Exception { + @Test(priority = 7) + public void testGetOperationStatusWOptions() throws Exception { try { - CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() - .ip("192.168.1.2") - .comment("Updated test IP address") - .build(); + GetOperationStatusOptions getOperationStatusOptionsModel = new GetOperationStatusOptions(); - UpdateListItemsOptions updateListItemsOptionsModel = new UpdateListItemsOptions.Builder() - .createListItemsReqItem(new java.util.ArrayList( - java.util.Arrays.asList(createListItemsReqItemModel))) + // Invoke operation + Response response = listsApiService.getOperationStatus(getOperationStatusOptionsModel).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + OperationStatusResp operationStatusRespResult = response.getResult(); + OperationStatusRespResult operationStatus = operationStatusRespResult.getResult(); + + assertNotNull(operationStatusRespResult); + assertNotNull(operationStatus); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(priority = 8) + public void testGetListItemsWOptions() throws Exception { + try { + GetListItemsOptions getListItemsOptionsModel = new GetListItemsOptions.Builder() + .perPage(Long.valueOf("25")) .build(); // Invoke operation - Response response = listsApiService.updateListItems(updateListItemsOptionsModel).execute(); + Response response = listsApiService.getListItems(getListItemsOptionsModel).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ListOperationResp listOperationRespResult = response.getResult(); - ListOperationRespResult operationResult = listOperationRespResult.getResult(); + ListItemsResp listItemsRespResult = response.getResult(); + List listItems = listItemsRespResult.getResult(); - assertNotNull(listOperationRespResult); - assertNotNull(operationResult); + assertNotNull(listItemsRespResult); + assertNotNull(listItems); + + // Capture an item ID for subsequent tests + if (listItems != null && !listItems.isEmpty()) { + itemId = listItems.get(0).getId(); + listsApiService.setItemId(itemId); + } } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test + @Test(priority = 9) public void testGetListItemWOptions() throws Exception { try { GetListItemOptions getListItemOptionsModel = new GetListItemOptions(); @@ -325,7 +321,7 @@ public void testGetListItemWOptions() throws Exception { assertEquals(response.getStatusCode(), 200); ListItemResp listItemRespResult = response.getResult(); - ListItemRespResult listItem = listItemRespResult.getResult(); + ListItem listItem = listItemRespResult.getResult(); assertNotNull(listItemRespResult); assertNotNull(listItem); @@ -335,29 +331,37 @@ public void testGetListItemWOptions() throws Exception { } } - @Test - public void testGetOperationStatusWOptions() throws Exception { + @Test(priority = 10) + public void testUpdateListItemsWOptions() throws Exception { try { - GetOperationStatusOptions getOperationStatusOptionsModel = new GetOperationStatusOptions(); + CreateListItemsReqItem createListItemsReqItemModel = new CreateListItemsReqItem.Builder() + .ip("192.168.1.2") + .comment("Updated test IP address") + .build(); + + UpdateListItemsOptions updateListItemsOptionsModel = new UpdateListItemsOptions.Builder() + .createListItemsReqItem(new java.util.ArrayList( + java.util.Arrays.asList(createListItemsReqItemModel))) + .build(); // Invoke operation - Response response = listsApiService.getOperationStatus(getOperationStatusOptionsModel).execute(); + Response response = listsApiService.updateListItems(updateListItemsOptionsModel).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - OperationStatusResp operationStatusRespResult = response.getResult(); - OperationStatusRespResult operationStatus = operationStatusRespResult.getResult(); + ListOperationResp listOperationRespResult = response.getResult(); + ListOperationRespResult operationResult = listOperationRespResult.getResult(); - assertNotNull(operationStatusRespResult); - assertNotNull(operationStatus); + assertNotNull(listOperationRespResult); + assertNotNull(operationResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test + @Test(priority = 11) public void testDeleteListItemsWOptions() throws Exception { try { DeleteListItemsReqItemsItem deleteListItemsReqItemsItemModel = new DeleteListItemsReqItemsItem.Builder() @@ -386,7 +390,7 @@ public void testDeleteListItemsWOptions() throws Exception { } } - @Test + @Test(priority = 12) public void testDeleteCustomListWOptions() throws Exception { try { DeleteCustomListOptions deleteCustomListOptionsModel = new DeleteCustomListOptions(); diff --git a/pom.xml b/pom.xml index 3bc6049e0..4ca5d9761 100644 --- a/pom.xml +++ b/pom.xml @@ -102,6 +102,7 @@ modules/coverage-reports + modules/lists-api