From 05a43c5fdb3ef6ce8558a66bed644074e8e922b0 Mon Sep 17 00:00:00 2001 From: Sirija Reddy Date: Wed, 6 May 2026 20:01:40 +0530 Subject: [PATCH] =?UTF-8?q?feat:=20Update=20CIS=20SDK=20=E2=80=94=20CIS=5F?= =?UTF-8?q?Frontend=5FAPI=5FSpec-Mtls=20(#f9b620)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sirija Reddy --- .../ibm/cloud/networking/mtls/v1/Mtls.java | 698 +++++++++++ .../mtls/v1/model/AccessAppResp.java | 76 ++ .../mtls/v1/model/AccessCertResp.java | 76 ++ .../model/AccessCertSettingsInputArray.java | 134 ++ .../mtls/v1/model/AccessCertSettingsResp.java | 74 ++ .../mtls/v1/model/AccessOrgResp.java | 74 ++ .../mtls/v1/model/AccessOrgRespResult.java | 83 ++ .../mtls/v1/model/AccessPolicyResp.java | 76 ++ .../networking/mtls/v1/model/AppResult.java | 176 +++ .../networking/mtls/v1/model/CertResult.java | 117 ++ .../mtls/v1/model/CertSettingsResult.java | 59 + .../mtls/v1/model/CreateAccessAppResp.java | 76 ++ .../v1/model/CreateAccessAppRespResult.java | 155 +++ .../model/CreateAccessApplicationOptions.java | 182 +++ .../model/CreateAccessCertificateOptions.java | 202 +++ .../CreateAccessOrganizationOptions.java | 119 ++ .../v1/model/CreateAccessPolicyOptions.java | 240 ++++ .../mtls/v1/model/DeleteAccessAppResp.java | 74 ++ .../v1/model/DeleteAccessAppRespResult.java | 38 + .../model/DeleteAccessApplicationOptions.java | 134 ++ .../mtls/v1/model/DeleteAccessCertResp.java | 74 ++ .../v1/model/DeleteAccessCertRespResult.java | 38 + .../model/DeleteAccessCertificateOptions.java | 134 ++ .../v1/model/DeleteAccessPolicyOptions.java | 164 +++ .../mtls/v1/model/DeleteAccessPolicyResp.java | 74 ++ .../model/DeleteAccessPolicyRespResult.java | 38 + .../v1/model/GetAccessApplicationOptions.java | 134 ++ .../model/GetAccessCertSettingsOptions.java | 104 ++ .../v1/model/GetAccessCertificateOptions.java | 134 ++ .../mtls/v1/model/GetAccessPolicyOptions.java | 164 +++ .../model/ListAccessApplicationsOptions.java | 104 ++ .../mtls/v1/model/ListAccessAppsResp.java | 74 ++ .../model/ListAccessCertificatesOptions.java | 104 ++ .../mtls/v1/model/ListAccessCertsResp.java | 74 ++ .../v1/model/ListAccessPoliciesOptions.java | 134 ++ .../mtls/v1/model/ListAccessPoliciesResp.java | 74 ++ .../mtls/v1/model/PolicyCnRuleCommonName.java | 106 ++ .../mtls/v1/model/PolicyResult.java | 151 +++ .../networking/mtls/v1/model/PolicyRule.java | 54 + .../v1/model/PolicyRulePolicyCertRule.java | 81 ++ .../mtls/v1/model/PolicyRulePolicyCnRule.java | 90 ++ .../model/UpdateAccessApplicationOptions.java | 212 ++++ .../UpdateAccessCertSettingsOptions.java | 148 +++ .../model/UpdateAccessCertificateOptions.java | 206 +++ .../v1/model/UpdateAccessPolicyOptions.java | 270 ++++ .../networking/mtls/v1/package-info.java | 17 + .../cloud/networking/mtls/v1/MtlsTest.java | 1099 +++++++++++++++++ .../mtls/v1/model/AccessAppRespTest.java | 43 + .../mtls/v1/model/AccessCertRespTest.java | 41 + .../AccessCertSettingsInputArrayTest.java | 54 + .../v1/model/AccessCertSettingsRespTest.java | 41 + .../v1/model/AccessOrgRespResultTest.java | 41 + .../mtls/v1/model/AccessOrgRespTest.java | 41 + .../mtls/v1/model/AccessPolicyRespTest.java | 42 + .../mtls/v1/model/AppResultTest.java | 50 + .../mtls/v1/model/CertResultTest.java | 43 + .../mtls/v1/model/CertSettingsResultTest.java | 39 + .../model/CreateAccessAppRespResultTest.java | 48 + .../v1/model/CreateAccessAppRespTest.java | 41 + .../CreateAccessApplicationOptionsTest.java | 51 + .../CreateAccessCertificateOptionsTest.java | 51 + .../CreateAccessOrganizationOptionsTest.java | 41 + .../model/CreateAccessPolicyOptionsTest.java | 59 + .../model/DeleteAccessAppRespResultTest.java | 37 + .../v1/model/DeleteAccessAppRespTest.java | 41 + .../DeleteAccessApplicationOptionsTest.java | 47 + .../model/DeleteAccessCertRespResultTest.java | 37 + .../v1/model/DeleteAccessCertRespTest.java | 41 + .../DeleteAccessCertificateOptionsTest.java | 47 + .../model/DeleteAccessPolicyOptionsTest.java | 49 + .../DeleteAccessPolicyRespResultTest.java | 37 + .../v1/model/DeleteAccessPolicyRespTest.java | 41 + .../GetAccessApplicationOptionsTest.java | 47 + .../GetAccessCertSettingsOptionsTest.java | 45 + .../GetAccessCertificateOptionsTest.java | 47 + .../v1/model/GetAccessPolicyOptionsTest.java | 49 + .../ListAccessApplicationsOptionsTest.java | 45 + .../mtls/v1/model/ListAccessAppsRespTest.java | 43 + .../ListAccessCertificatesOptionsTest.java | 45 + .../v1/model/ListAccessCertsRespTest.java | 41 + .../model/ListAccessPoliciesOptionsTest.java | 47 + .../v1/model/ListAccessPoliciesRespTest.java | 42 + .../v1/model/PolicyCnRuleCommonNameTest.java | 51 + .../mtls/v1/model/PolicyResultTest.java | 47 + .../model/PolicyRulePolicyCertRuleTest.java | 45 + .../v1/model/PolicyRulePolicyCnRuleTest.java | 57 + .../mtls/v1/model/PolicyRuleTest.java | 38 + .../UpdateAccessApplicationOptionsTest.java | 53 + .../UpdateAccessCertSettingsOptionsTest.java | 55 + .../UpdateAccessCertificateOptionsTest.java | 51 + .../model/UpdateAccessPolicyOptionsTest.java | 61 + .../mtls/v1/utils/TestUtilities.java | 131 ++ 92 files changed, 9062 insertions(+) create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/Mtls.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessAppResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsInputArray.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespResult.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessPolicyResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AppResult.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CertResult.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CertSettingsResult.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespResult.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessApplicationOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessCertificateOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessOrganizationOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessPolicyOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespResult.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessApplicationOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespResult.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertificateOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespResult.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessApplicationOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertSettingsOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertificateOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessPolicyOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessApplicationsOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessAppsResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertificatesOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertsResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesResp.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyCnRuleCommonName.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyResult.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRule.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCertRule.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCnRule.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessApplicationOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertSettingsOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertificateOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessPolicyOptions.java create mode 100644 modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/package-info.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/MtlsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessAppRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsInputArrayTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespResultTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessPolicyRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AppResultTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CertResultTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CertSettingsResultTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespResultTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessApplicationOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessCertificateOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessOrganizationOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessPolicyOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespResultTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessApplicationOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespResultTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertificateOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespResultTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessApplicationOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertSettingsOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertificateOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessPolicyOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessApplicationsOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessAppsRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertificatesOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertsRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesRespTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyCnRuleCommonNameTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyResultTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCertRuleTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCnRuleTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRuleTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessApplicationOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertSettingsOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertificateOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessPolicyOptionsTest.java create mode 100644 modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/utils/TestUtilities.java diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/Mtls.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/Mtls.java new file mode 100644 index 000000000..9fdb0676e --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/Mtls.java @@ -0,0 +1,698 @@ +/* + * (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.mtls.v1; + +import com.google.gson.JsonObject; +import com.ibm.cloud.networking.common.SdkCommon; +import com.ibm.cloud.networking.mtls.v1.model.AccessAppResp; +import com.ibm.cloud.networking.mtls.v1.model.AccessCertResp; +import com.ibm.cloud.networking.mtls.v1.model.AccessCertSettingsResp; +import com.ibm.cloud.networking.mtls.v1.model.AccessOrgResp; +import com.ibm.cloud.networking.mtls.v1.model.AccessPolicyResp; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessAppResp; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessOrganizationOptions; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessAppResp; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessCertResp; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessPolicyResp; +import com.ibm.cloud.networking.mtls.v1.model.GetAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.model.GetAccessCertSettingsOptions; +import com.ibm.cloud.networking.mtls.v1.model.GetAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.model.GetAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessApplicationsOptions; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessAppsResp; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessCertificatesOptions; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessCertsResp; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessPoliciesOptions; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessPoliciesResp; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessCertSettingsOptions; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessPolicyOptions; +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; + +/** + * MTLS. + * + * API Version: 1.0.0 + */ +public class Mtls extends BaseService { + + /** + * Default service name used when configuring the `Mtls` client. + */ + public static final String DEFAULT_SERVICE_NAME = "mtls"; + + /** + * Default service endpoint URL. + */ + public static final String DEFAULT_SERVICE_URL = "https://api.cis.cloud.ibm.com"; + + private String crn; + + /** + * Class method which constructs an instance of the `Mtls` client. + * The default service name is used to configure the client instance. + * + * @param crn Cloud resource name. + * @return an instance of the `Mtls` client using external configuration + */ + public static Mtls newInstance(String crn) { + return newInstance(crn, DEFAULT_SERVICE_NAME); + } + + /** + * Class method which constructs an instance of the `Mtls` client. + * The specified service name is used to configure the client instance. + * + * @param crn Cloud resource name. + * @param serviceName the service name to be used when configuring the client instance + * @return an instance of the `Mtls` client using external configuration + */ + public static Mtls newInstance(String crn, String serviceName) { + Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); + Mtls service = new Mtls(crn, serviceName, authenticator); + service.configureService(serviceName); + return service; + } + + /** + * Constructs an instance of the `Mtls` client. + * The specified service name and authenticator are used to configure the client instance. + * + * @param crn Cloud resource name. + * @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 Mtls(String crn, String serviceName, Authenticator authenticator) { + super(serviceName, authenticator); + setServiceUrl(DEFAULT_SERVICE_URL); + setCrn(crn); + } + + /** + * Gets the crn. + * + * Cloud resource name. + * + * @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; + } + + /** + * List access certificates. + * + * List access certificates. + * + * @param listAccessCertificatesOptions the {@link ListAccessCertificatesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListAccessCertsResp} + */ + public ServiceCall listAccessCertificates(ListAccessCertificatesOptions listAccessCertificatesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listAccessCertificatesOptions, + "listAccessCertificatesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", listAccessCertificatesOptions.zoneId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/certificates", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "listAccessCertificates"); + 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); + } + + /** + * Create access certificate. + * + * Create access certificate. + * + * @param createAccessCertificateOptions the {@link CreateAccessCertificateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessCertResp} + */ + public ServiceCall createAccessCertificate(CreateAccessCertificateOptions createAccessCertificateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createAccessCertificateOptions, + "createAccessCertificateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", createAccessCertificateOptions.zoneId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/certificates", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "createAccessCertificate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createAccessCertificateOptions.name() != null) { + contentJson.addProperty("name", createAccessCertificateOptions.name()); + } + if (createAccessCertificateOptions.certificate() != null) { + contentJson.addProperty("certificate", createAccessCertificateOptions.certificate()); + } + if (createAccessCertificateOptions.associatedHostnames() != null) { + contentJson.add("associated_hostnames", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createAccessCertificateOptions.associatedHostnames())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get access certificate. + * + * Get access certificate. + * + * @param getAccessCertificateOptions the {@link GetAccessCertificateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessCertResp} + */ + public ServiceCall getAccessCertificate(GetAccessCertificateOptions getAccessCertificateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAccessCertificateOptions, + "getAccessCertificateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", getAccessCertificateOptions.zoneId()); + pathParamsMap.put("cert_id", getAccessCertificateOptions.certId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/certificates/{cert_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "getAccessCertificate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update access certificate. + * + * Update access certificate. + * + * @param updateAccessCertificateOptions the {@link UpdateAccessCertificateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessCertResp} + */ + public ServiceCall updateAccessCertificate(UpdateAccessCertificateOptions updateAccessCertificateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateAccessCertificateOptions, + "updateAccessCertificateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", updateAccessCertificateOptions.zoneId()); + pathParamsMap.put("cert_id", updateAccessCertificateOptions.certId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/certificates/{cert_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "updateAccessCertificate"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (updateAccessCertificateOptions.name() != null) { + contentJson.addProperty("name", updateAccessCertificateOptions.name()); + } + if (updateAccessCertificateOptions.associatedHostnames() != null) { + contentJson.add("associated_hostnames", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAccessCertificateOptions.associatedHostnames())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete access certificate. + * + * Delete access certificate. + * + * @param deleteAccessCertificateOptions the {@link DeleteAccessCertificateOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link DeleteAccessCertResp} + */ + public ServiceCall deleteAccessCertificate(DeleteAccessCertificateOptions deleteAccessCertificateOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAccessCertificateOptions, + "deleteAccessCertificateOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", deleteAccessCertificateOptions.zoneId()); + pathParamsMap.put("cert_id", deleteAccessCertificateOptions.certId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/certificates/{cert_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "deleteAccessCertificate"); + 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 access applications. + * + * List access applications. + * + * @param listAccessApplicationsOptions the {@link ListAccessApplicationsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListAccessAppsResp} + */ + public ServiceCall listAccessApplications(ListAccessApplicationsOptions listAccessApplicationsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listAccessApplicationsOptions, + "listAccessApplicationsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", listAccessApplicationsOptions.zoneId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "listAccessApplications"); + 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); + } + + /** + * Create access application. + * + * Create access application. + * + * @param createAccessApplicationOptions the {@link CreateAccessApplicationOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CreateAccessAppResp} + */ + public ServiceCall createAccessApplication(CreateAccessApplicationOptions createAccessApplicationOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createAccessApplicationOptions, + "createAccessApplicationOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", createAccessApplicationOptions.zoneId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "createAccessApplication"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createAccessApplicationOptions.name() != null) { + contentJson.addProperty("name", createAccessApplicationOptions.name()); + } + if (createAccessApplicationOptions.domain() != null) { + contentJson.addProperty("domain", createAccessApplicationOptions.domain()); + } + if (createAccessApplicationOptions.sessionDuration() != null) { + contentJson.addProperty("session_duration", createAccessApplicationOptions.sessionDuration()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get access application. + * + * Get access application. + * + * @param getAccessApplicationOptions the {@link GetAccessApplicationOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessAppResp} + */ + public ServiceCall getAccessApplication(GetAccessApplicationOptions getAccessApplicationOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAccessApplicationOptions, + "getAccessApplicationOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", getAccessApplicationOptions.zoneId()); + pathParamsMap.put("app_id", getAccessApplicationOptions.appId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps/{app_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "getAccessApplication"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update access application. + * + * Update access application. + * + * @param updateAccessApplicationOptions the {@link UpdateAccessApplicationOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessAppResp} + */ + public ServiceCall updateAccessApplication(UpdateAccessApplicationOptions updateAccessApplicationOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateAccessApplicationOptions, + "updateAccessApplicationOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", updateAccessApplicationOptions.zoneId()); + pathParamsMap.put("app_id", updateAccessApplicationOptions.appId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps/{app_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "updateAccessApplication"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (updateAccessApplicationOptions.name() != null) { + contentJson.addProperty("name", updateAccessApplicationOptions.name()); + } + if (updateAccessApplicationOptions.domain() != null) { + contentJson.addProperty("domain", updateAccessApplicationOptions.domain()); + } + if (updateAccessApplicationOptions.sessionDuration() != null) { + contentJson.addProperty("session_duration", updateAccessApplicationOptions.sessionDuration()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete access application. + * + * Delete access application. + * + * @param deleteAccessApplicationOptions the {@link DeleteAccessApplicationOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link DeleteAccessAppResp} + */ + public ServiceCall deleteAccessApplication(DeleteAccessApplicationOptions deleteAccessApplicationOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAccessApplicationOptions, + "deleteAccessApplicationOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", deleteAccessApplicationOptions.zoneId()); + pathParamsMap.put("app_id", deleteAccessApplicationOptions.appId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps/{app_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "deleteAccessApplication"); + 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 access policies. + * + * List access policies. + * + * @param listAccessPoliciesOptions the {@link ListAccessPoliciesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListAccessPoliciesResp} + */ + public ServiceCall listAccessPolicies(ListAccessPoliciesOptions listAccessPoliciesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listAccessPoliciesOptions, + "listAccessPoliciesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", listAccessPoliciesOptions.zoneId()); + pathParamsMap.put("app_id", listAccessPoliciesOptions.appId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps/{app_id}/policies", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "listAccessPolicies"); + 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); + } + + /** + * Create access policy. + * + * Create access policy. + * + * @param createAccessPolicyOptions the {@link CreateAccessPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessPolicyResp} + */ + public ServiceCall createAccessPolicy(CreateAccessPolicyOptions createAccessPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createAccessPolicyOptions, + "createAccessPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", createAccessPolicyOptions.zoneId()); + pathParamsMap.put("app_id", createAccessPolicyOptions.appId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps/{app_id}/policies", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "createAccessPolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createAccessPolicyOptions.name() != null) { + contentJson.addProperty("name", createAccessPolicyOptions.name()); + } + if (createAccessPolicyOptions.decision() != null) { + contentJson.addProperty("decision", createAccessPolicyOptions.decision()); + } + if (createAccessPolicyOptions.include() != null) { + contentJson.add("include", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createAccessPolicyOptions.include())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get access policy. + * + * Get access policy. + * + * @param getAccessPolicyOptions the {@link GetAccessPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessPolicyResp} + */ + public ServiceCall getAccessPolicy(GetAccessPolicyOptions getAccessPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAccessPolicyOptions, + "getAccessPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", getAccessPolicyOptions.zoneId()); + pathParamsMap.put("app_id", getAccessPolicyOptions.appId()); + pathParamsMap.put("policy_id", getAccessPolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps/{app_id}/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "getAccessPolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update access policy. + * + * Update access policy. + * + * @param updateAccessPolicyOptions the {@link UpdateAccessPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessPolicyResp} + */ + public ServiceCall updateAccessPolicy(UpdateAccessPolicyOptions updateAccessPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateAccessPolicyOptions, + "updateAccessPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", updateAccessPolicyOptions.zoneId()); + pathParamsMap.put("app_id", updateAccessPolicyOptions.appId()); + pathParamsMap.put("policy_id", updateAccessPolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps/{app_id}/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "updateAccessPolicy"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (updateAccessPolicyOptions.name() != null) { + contentJson.addProperty("name", updateAccessPolicyOptions.name()); + } + if (updateAccessPolicyOptions.decision() != null) { + contentJson.addProperty("decision", updateAccessPolicyOptions.decision()); + } + if (updateAccessPolicyOptions.include() != null) { + contentJson.add("include", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAccessPolicyOptions.include())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete access policy. + * + * Delete access policy. + * + * @param deleteAccessPolicyOptions the {@link DeleteAccessPolicyOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link DeleteAccessPolicyResp} + */ + public ServiceCall deleteAccessPolicy(DeleteAccessPolicyOptions deleteAccessPolicyOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteAccessPolicyOptions, + "deleteAccessPolicyOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", deleteAccessPolicyOptions.zoneId()); + pathParamsMap.put("app_id", deleteAccessPolicyOptions.appId()); + pathParamsMap.put("policy_id", deleteAccessPolicyOptions.policyId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/apps/{app_id}/policies/{policy_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "deleteAccessPolicy"); + 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 access certificates settings. + * + * Get access certificates settings. + * + * @param getAccessCertSettingsOptions the {@link GetAccessCertSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessCertSettingsResp} + */ + public ServiceCall getAccessCertSettings(GetAccessCertSettingsOptions getAccessCertSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAccessCertSettingsOptions, + "getAccessCertSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", getAccessCertSettingsOptions.zoneId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/certificates/settings", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "getAccessCertSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update access certificates settings. + * + * Update access certificates settings. + * + * @param updateAccessCertSettingsOptions the {@link UpdateAccessCertSettingsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessCertSettingsResp} + */ + public ServiceCall updateAccessCertSettings(UpdateAccessCertSettingsOptions updateAccessCertSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateAccessCertSettingsOptions, + "updateAccessCertSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", updateAccessCertSettingsOptions.zoneId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/access/certificates/settings", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "updateAccessCertSettings"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (updateAccessCertSettingsOptions.settings() != null) { + contentJson.add("settings", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAccessCertSettingsOptions.settings())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create access organization. + * + * Create access organization. + * + * @param createAccessOrganizationOptions the {@link CreateAccessOrganizationOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link AccessOrgResp} + */ + public ServiceCall createAccessOrganization(CreateAccessOrganizationOptions createAccessOrganizationOptions) { + boolean skipBody = false; + if (createAccessOrganizationOptions == null) { + createAccessOrganizationOptions = new CreateAccessOrganizationOptions.Builder().build(); + skipBody = true; + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/access/organizations", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("mtls", "v1", "createAccessOrganization"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (!skipBody) { + final JsonObject contentJson = new JsonObject(); + if (createAccessOrganizationOptions.name() != null) { + contentJson.addProperty("name", createAccessOrganizationOptions.name()); + } + if (createAccessOrganizationOptions.authDomain() != null) { + contentJson.addProperty("auth_domain", createAccessOrganizationOptions.authDomain()); + } + builder.bodyJson(contentJson); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create access organization. + * + * Create access organization. + * + * @return a {@link ServiceCall} with a result of type {@link AccessOrgResp} + */ + public ServiceCall createAccessOrganization() { + return createAccessOrganization(null); + } + +} diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessAppResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessAppResp.java new file mode 100644 index 000000000..3656beb2b --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessAppResp.java @@ -0,0 +1,76 @@ +/* + * (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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Access application response. + */ +public class AccessAppResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected AppResult result; + + protected AccessAppResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * Access application details. + * + * @return the result + */ + public AppResult getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertResp.java new file mode 100644 index 000000000..e0a284915 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertResp.java @@ -0,0 +1,76 @@ +/* + * (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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Access certificate response. + */ +public class AccessCertResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected CertResult result; + + protected AccessCertResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * Access certificate details. + * + * @return the result + */ + public CertResult getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsInputArray.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsInputArray.java new file mode 100644 index 000000000..3c17d465e --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsInputArray.java @@ -0,0 +1,134 @@ +/* + * (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.mtls.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * AccessCertSettingsInputArray. + */ +public class AccessCertSettingsInputArray extends GenericModel { + + protected String hostname; + @SerializedName("client_certificate_forwarding") + protected Boolean clientCertificateForwarding; + + /** + * Builder. + */ + public static class Builder { + private String hostname; + private Boolean clientCertificateForwarding; + + /** + * Instantiates a new Builder from an existing AccessCertSettingsInputArray instance. + * + * @param accessCertSettingsInputArray the instance to initialize the Builder with + */ + private Builder(AccessCertSettingsInputArray accessCertSettingsInputArray) { + this.hostname = accessCertSettingsInputArray.hostname; + this.clientCertificateForwarding = accessCertSettingsInputArray.clientCertificateForwarding; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param hostname the hostname + * @param clientCertificateForwarding the clientCertificateForwarding + */ + public Builder(String hostname, Boolean clientCertificateForwarding) { + this.hostname = hostname; + this.clientCertificateForwarding = clientCertificateForwarding; + } + + /** + * Builds a AccessCertSettingsInputArray. + * + * @return the new AccessCertSettingsInputArray instance + */ + public AccessCertSettingsInputArray build() { + return new AccessCertSettingsInputArray(this); + } + + /** + * Set the hostname. + * + * @param hostname the hostname + * @return the AccessCertSettingsInputArray builder + */ + public Builder hostname(String hostname) { + this.hostname = hostname; + return this; + } + + /** + * Set the clientCertificateForwarding. + * + * @param clientCertificateForwarding the clientCertificateForwarding + * @return the AccessCertSettingsInputArray builder + */ + public Builder clientCertificateForwarding(Boolean clientCertificateForwarding) { + this.clientCertificateForwarding = clientCertificateForwarding; + return this; + } + } + + protected AccessCertSettingsInputArray() { } + + protected AccessCertSettingsInputArray(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.hostname, + "hostname cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.clientCertificateForwarding, + "clientCertificateForwarding cannot be null"); + hostname = builder.hostname; + clientCertificateForwarding = builder.clientCertificateForwarding; + } + + /** + * New builder. + * + * @return a AccessCertSettingsInputArray builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the hostname. + * + * @return the hostname + */ + public String hostname() { + return hostname; + } + + /** + * Gets the clientCertificateForwarding. + * + * Whether to forward the client certificate. + * + * @return the clientCertificateForwarding + */ + public Boolean clientCertificateForwarding() { + return clientCertificateForwarding; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsResp.java new file mode 100644 index 000000000..a6e8dd3b3 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsResp.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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Access certificates settings response. + */ +public class AccessCertSettingsResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected List result; + + protected AccessCertSettingsResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public List getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgResp.java new file mode 100644 index 000000000..c2115541c --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgResp.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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Access organization response. + */ +public class AccessOrgResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected AccessOrgRespResult result; + + protected AccessOrgResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public AccessOrgRespResult getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespResult.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespResult.java new file mode 100644 index 000000000..c211834ed --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespResult.java @@ -0,0 +1,83 @@ +/* + * (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.mtls.v1.model; + +import java.util.Map; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * AccessOrgRespResult. + */ +public class AccessOrgRespResult extends GenericModel { + + @SerializedName("auth_domain") + protected String authDomain; + protected String name; + @SerializedName("login_design") + protected Map loginDesign; + @SerializedName("created_at") + protected String createdAt; + @SerializedName("updated_at") + protected String updatedAt; + + protected AccessOrgRespResult() { } + + /** + * Gets the authDomain. + * + * @return the authDomain + */ + public String getAuthDomain() { + return authDomain; + } + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the loginDesign. + * + * @return the loginDesign + */ + public Map getLoginDesign() { + return loginDesign; + } + + /** + * Gets the createdAt. + * + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * Gets the updatedAt. + * + * @return the updatedAt + */ + public String getUpdatedAt() { + return updatedAt; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessPolicyResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessPolicyResp.java new file mode 100644 index 000000000..a811f0a72 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AccessPolicyResp.java @@ -0,0 +1,76 @@ +/* + * (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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Access policy response. + */ +public class AccessPolicyResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected PolicyResult result; + + protected AccessPolicyResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * Access policies information. + * + * @return the result + */ + public PolicyResult getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AppResult.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AppResult.java new file mode 100644 index 000000000..5cfa22139 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/AppResult.java @@ -0,0 +1,176 @@ +/* + * (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.mtls.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Access application details. + */ +public class AppResult extends GenericModel { + + protected String id; + protected String name; + protected String domain; + protected String aud; + protected List policies; + @SerializedName("allowed_idps") + protected List allowedIdps; + @SerializedName("auto_redirect_to_identity") + protected Boolean autoRedirectToIdentity; + @SerializedName("session_duration") + protected String sessionDuration; + protected String type; + protected String uid; + @SerializedName("created_at") + protected String createdAt; + @SerializedName("updated_at") + protected String updatedAt; + + protected AppResult() { } + + /** + * Gets the id. + * + * Application ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the name. + * + * Application name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the domain. + * + * The domain and path that Access blocks. + * + * @return the domain + */ + public String getDomain() { + return domain; + } + + /** + * Gets the aud. + * + * @return the aud + */ + public String getAud() { + return aud; + } + + /** + * Gets the policies. + * + * Policies of the application. + * + * @return the policies + */ + public List getPolicies() { + return policies; + } + + /** + * Gets the allowedIdps. + * + * The identity providers selected for application. + * + * @return the allowedIdps + */ + public List getAllowedIdps() { + return allowedIdps; + } + + /** + * Gets the autoRedirectToIdentity. + * + * Option to skip identity provider selection if only one is configured in allowed_idps. + * + * @return the autoRedirectToIdentity + */ + public Boolean isAutoRedirectToIdentity() { + return autoRedirectToIdentity; + } + + /** + * Gets the sessionDuration. + * + * The amount of time that the tokens issued for this application are valid. + * + * @return the sessionDuration + */ + public String getSessionDuration() { + return sessionDuration; + } + + /** + * Gets the type. + * + * Application type. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the uid. + * + * UUID, same as ID. + * + * @return the uid + */ + public String getUid() { + return uid; + } + + /** + * Gets the createdAt. + * + * Created time of the application. + * + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * Gets the updatedAt. + * + * Updated time of the application. + * + * @return the updatedAt + */ + public String getUpdatedAt() { + return updatedAt; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CertResult.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CertResult.java new file mode 100644 index 000000000..3bfdb2ea1 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CertResult.java @@ -0,0 +1,117 @@ +/* + * (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.mtls.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Access certificate details. + */ +public class CertResult extends GenericModel { + + protected String id; + protected String name; + protected String fingerprint; + @SerializedName("associated_hostnames") + protected List associatedHostnames; + @SerializedName("created_at") + protected String createdAt; + @SerializedName("updated_at") + protected String updatedAt; + @SerializedName("expires_on") + protected String expiresOn; + + protected CertResult() { } + + /** + * Gets the id. + * + * Access certificate ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the name. + * + * access certificate name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the fingerprint. + * + * Fingerprint of the certificate. + * + * @return the fingerprint + */ + public String getFingerprint() { + return fingerprint; + } + + /** + * Gets the associatedHostnames. + * + * The hostnames that are prompted for this certificate. + * + * @return the associatedHostnames + */ + public List getAssociatedHostnames() { + return associatedHostnames; + } + + /** + * Gets the createdAt. + * + * Created time of the access certificate. + * + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * Gets the updatedAt. + * + * Updated time of the access certificate. + * + * @return the updatedAt + */ + public String getUpdatedAt() { + return updatedAt; + } + + /** + * Gets the expiresOn. + * + * Expire time of the access certificate. + * + * @return the expiresOn + */ + public String getExpiresOn() { + return expiresOn; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CertSettingsResult.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CertSettingsResult.java new file mode 100644 index 000000000..5579f4876 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CertSettingsResult.java @@ -0,0 +1,59 @@ +/* + * (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.mtls.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * CertSettingsResult. + */ +public class CertSettingsResult extends GenericModel { + + protected String hostname; + @SerializedName("china_network") + protected Boolean chinaNetwork; + @SerializedName("client_certificate_forwarding") + protected Boolean clientCertificateForwarding; + + protected CertSettingsResult() { } + + /** + * Gets the hostname. + * + * @return the hostname + */ + public String getHostname() { + return hostname; + } + + /** + * Gets the chinaNetwork. + * + * @return the chinaNetwork + */ + public Boolean isChinaNetwork() { + return chinaNetwork; + } + + /** + * Gets the clientCertificateForwarding. + * + * @return the clientCertificateForwarding + */ + public Boolean isClientCertificateForwarding() { + return clientCertificateForwarding; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppResp.java new file mode 100644 index 000000000..a22d02008 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppResp.java @@ -0,0 +1,76 @@ +/* + * (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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Create access application response. + */ +public class CreateAccessAppResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected CreateAccessAppRespResult result; + + protected CreateAccessAppResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * Access application details. + * + * @return the result + */ + public CreateAccessAppRespResult getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespResult.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespResult.java new file mode 100644 index 000000000..de46ab2db --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespResult.java @@ -0,0 +1,155 @@ +/* + * (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.mtls.v1.model; + +import java.util.List; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Access application details. + */ +public class CreateAccessAppRespResult extends GenericModel { + + protected String id; + protected String name; + protected String domain; + protected String aud; + protected List> policies; + @SerializedName("allowed_idps") + protected List allowedIdps; + @SerializedName("auto_redirect_to_identity") + protected Boolean autoRedirectToIdentity; + @SerializedName("session_duration") + protected String sessionDuration; + protected String type; + protected String uid; + @SerializedName("created_at") + protected String createdAt; + @SerializedName("updated_at") + protected String updatedAt; + + protected CreateAccessAppRespResult() { } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the domain. + * + * @return the domain + */ + public String getDomain() { + return domain; + } + + /** + * Gets the aud. + * + * @return the aud + */ + public String getAud() { + return aud; + } + + /** + * Gets the policies. + * + * @return the policies + */ + public List> getPolicies() { + return policies; + } + + /** + * Gets the allowedIdps. + * + * @return the allowedIdps + */ + public List getAllowedIdps() { + return allowedIdps; + } + + /** + * Gets the autoRedirectToIdentity. + * + * @return the autoRedirectToIdentity + */ + public Boolean isAutoRedirectToIdentity() { + return autoRedirectToIdentity; + } + + /** + * Gets the sessionDuration. + * + * @return the sessionDuration + */ + public String getSessionDuration() { + return sessionDuration; + } + + /** + * Gets the type. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the uid. + * + * @return the uid + */ + public String getUid() { + return uid; + } + + /** + * Gets the createdAt. + * + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * Gets the updatedAt. + * + * @return the updatedAt + */ + public String getUpdatedAt() { + return updatedAt; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessApplicationOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessApplicationOptions.java new file mode 100644 index 000000000..a13d936a3 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessApplicationOptions.java @@ -0,0 +1,182 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createAccessApplication options. + */ +public class CreateAccessApplicationOptions extends GenericModel { + + protected String zoneId; + protected String name; + protected String domain; + protected String sessionDuration; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String name; + private String domain; + private String sessionDuration; + + /** + * Instantiates a new Builder from an existing CreateAccessApplicationOptions instance. + * + * @param createAccessApplicationOptions the instance to initialize the Builder with + */ + private Builder(CreateAccessApplicationOptions createAccessApplicationOptions) { + this.zoneId = createAccessApplicationOptions.zoneId; + this.name = createAccessApplicationOptions.name; + this.domain = createAccessApplicationOptions.domain; + this.sessionDuration = createAccessApplicationOptions.sessionDuration; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + */ + public Builder(String zoneId) { + this.zoneId = zoneId; + } + + /** + * Builds a CreateAccessApplicationOptions. + * + * @return the new CreateAccessApplicationOptions instance + */ + public CreateAccessApplicationOptions build() { + return new CreateAccessApplicationOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the CreateAccessApplicationOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateAccessApplicationOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the domain. + * + * @param domain the domain + * @return the CreateAccessApplicationOptions builder + */ + public Builder domain(String domain) { + this.domain = domain; + return this; + } + + /** + * Set the sessionDuration. + * + * @param sessionDuration the sessionDuration + * @return the CreateAccessApplicationOptions builder + */ + public Builder sessionDuration(String sessionDuration) { + this.sessionDuration = sessionDuration; + return this; + } + } + + protected CreateAccessApplicationOptions() { } + + protected CreateAccessApplicationOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + zoneId = builder.zoneId; + name = builder.name; + domain = builder.domain; + sessionDuration = builder.sessionDuration; + } + + /** + * New builder. + * + * @return a CreateAccessApplicationOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the name. + * + * Application name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the domain. + * + * The domain and path that Access blocks. + * + * @return the domain + */ + public String domain() { + return domain; + } + + /** + * Gets the sessionDuration. + * + * The amount of time that the tokens issued for this application are valid. + * + * @return the sessionDuration + */ + public String sessionDuration() { + return sessionDuration; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessCertificateOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessCertificateOptions.java new file mode 100644 index 000000000..d1d9d653d --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessCertificateOptions.java @@ -0,0 +1,202 @@ +/* + * (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.mtls.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createAccessCertificate options. + */ +public class CreateAccessCertificateOptions extends GenericModel { + + protected String zoneId; + protected String name; + protected String certificate; + protected List associatedHostnames; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String name; + private String certificate; + private List associatedHostnames; + + /** + * Instantiates a new Builder from an existing CreateAccessCertificateOptions instance. + * + * @param createAccessCertificateOptions the instance to initialize the Builder with + */ + private Builder(CreateAccessCertificateOptions createAccessCertificateOptions) { + this.zoneId = createAccessCertificateOptions.zoneId; + this.name = createAccessCertificateOptions.name; + this.certificate = createAccessCertificateOptions.certificate; + this.associatedHostnames = createAccessCertificateOptions.associatedHostnames; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + */ + public Builder(String zoneId) { + this.zoneId = zoneId; + } + + /** + * Builds a CreateAccessCertificateOptions. + * + * @return the new CreateAccessCertificateOptions instance + */ + public CreateAccessCertificateOptions build() { + return new CreateAccessCertificateOptions(this); + } + + /** + * Adds a new element to associatedHostnames. + * + * @param associatedHostnames the new element to be added + * @return the CreateAccessCertificateOptions builder + */ + public Builder addAssociatedHostnames(String associatedHostnames) { + com.ibm.cloud.sdk.core.util.Validator.notNull(associatedHostnames, + "associatedHostnames cannot be null"); + if (this.associatedHostnames == null) { + this.associatedHostnames = new ArrayList(); + } + this.associatedHostnames.add(associatedHostnames); + return this; + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the CreateAccessCertificateOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateAccessCertificateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the certificate. + * + * @param certificate the certificate + * @return the CreateAccessCertificateOptions builder + */ + public Builder certificate(String certificate) { + this.certificate = certificate; + return this; + } + + /** + * Set the associatedHostnames. + * Existing associatedHostnames will be replaced. + * + * @param associatedHostnames the associatedHostnames + * @return the CreateAccessCertificateOptions builder + */ + public Builder associatedHostnames(List associatedHostnames) { + this.associatedHostnames = associatedHostnames; + return this; + } + } + + protected CreateAccessCertificateOptions() { } + + protected CreateAccessCertificateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + zoneId = builder.zoneId; + name = builder.name; + certificate = builder.certificate; + associatedHostnames = builder.associatedHostnames; + } + + /** + * New builder. + * + * @return a CreateAccessCertificateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the name. + * + * Access certificate name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the certificate. + * + * Access certificate. + * + * @return the certificate + */ + public String certificate() { + return certificate; + } + + /** + * Gets the associatedHostnames. + * + * The hostnames that are prompted for this certificate. + * + * @return the associatedHostnames + */ + public List associatedHostnames() { + return associatedHostnames; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessOrganizationOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessOrganizationOptions.java new file mode 100644 index 000000000..0a28f55b7 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessOrganizationOptions.java @@ -0,0 +1,119 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createAccessOrganization options. + */ +public class CreateAccessOrganizationOptions extends GenericModel { + + protected String name; + protected String authDomain; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String authDomain; + + /** + * Instantiates a new Builder from an existing CreateAccessOrganizationOptions instance. + * + * @param createAccessOrganizationOptions the instance to initialize the Builder with + */ + private Builder(CreateAccessOrganizationOptions createAccessOrganizationOptions) { + this.name = createAccessOrganizationOptions.name; + this.authDomain = createAccessOrganizationOptions.authDomain; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a CreateAccessOrganizationOptions. + * + * @return the new CreateAccessOrganizationOptions instance + */ + public CreateAccessOrganizationOptions build() { + return new CreateAccessOrganizationOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateAccessOrganizationOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the authDomain. + * + * @param authDomain the authDomain + * @return the CreateAccessOrganizationOptions builder + */ + public Builder authDomain(String authDomain) { + this.authDomain = authDomain; + return this; + } + } + + protected CreateAccessOrganizationOptions() { } + + protected CreateAccessOrganizationOptions(Builder builder) { + name = builder.name; + authDomain = builder.authDomain; + } + + /** + * New builder. + * + * @return a CreateAccessOrganizationOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * Name of the access organization. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the authDomain. + * + * The domain that you are redirected to on Access login attempts. + * + * @return the authDomain + */ + public String authDomain() { + return authDomain; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessPolicyOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessPolicyOptions.java new file mode 100644 index 000000000..9dff6affe --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessPolicyOptions.java @@ -0,0 +1,240 @@ +/* + * (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.mtls.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createAccessPolicy options. + */ +public class CreateAccessPolicyOptions extends GenericModel { + + /** + * Defines the action Access takes if the policy matches the user. + */ + public interface Decision { + /** non_identity. */ + String NON_IDENTITY = "non_identity"; + } + + protected String zoneId; + protected String appId; + protected String name; + protected String decision; + protected List include; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String appId; + private String name; + private String decision; + private List include; + + /** + * Instantiates a new Builder from an existing CreateAccessPolicyOptions instance. + * + * @param createAccessPolicyOptions the instance to initialize the Builder with + */ + private Builder(CreateAccessPolicyOptions createAccessPolicyOptions) { + this.zoneId = createAccessPolicyOptions.zoneId; + this.appId = createAccessPolicyOptions.appId; + this.name = createAccessPolicyOptions.name; + this.decision = createAccessPolicyOptions.decision; + this.include = createAccessPolicyOptions.include; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param appId the appId + */ + public Builder(String zoneId, String appId) { + this.zoneId = zoneId; + this.appId = appId; + } + + /** + * Builds a CreateAccessPolicyOptions. + * + * @return the new CreateAccessPolicyOptions instance + */ + public CreateAccessPolicyOptions build() { + return new CreateAccessPolicyOptions(this); + } + + /** + * Adds a new element to include. + * + * @param include the new element to be added + * @return the CreateAccessPolicyOptions builder + */ + public Builder addInclude(PolicyRule include) { + com.ibm.cloud.sdk.core.util.Validator.notNull(include, + "include cannot be null"); + if (this.include == null) { + this.include = new ArrayList(); + } + this.include.add(include); + return this; + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the CreateAccessPolicyOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the appId. + * + * @param appId the appId + * @return the CreateAccessPolicyOptions builder + */ + public Builder appId(String appId) { + this.appId = appId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateAccessPolicyOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the decision. + * + * @param decision the decision + * @return the CreateAccessPolicyOptions builder + */ + public Builder decision(String decision) { + this.decision = decision; + return this; + } + + /** + * Set the include. + * Existing include will be replaced. + * + * @param include the include + * @return the CreateAccessPolicyOptions builder + */ + public Builder include(List include) { + this.include = include; + return this; + } + } + + protected CreateAccessPolicyOptions() { } + + protected CreateAccessPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.appId, + "appId cannot be empty"); + zoneId = builder.zoneId; + appId = builder.appId; + name = builder.name; + decision = builder.decision; + include = builder.include; + } + + /** + * New builder. + * + * @return a CreateAccessPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the appId. + * + * Access application ID. + * + * @return the appId + */ + public String appId() { + return appId; + } + + /** + * Gets the name. + * + * Policy name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the decision. + * + * Defines the action Access takes if the policy matches the user. + * + * @return the decision + */ + public String decision() { + return decision; + } + + /** + * Gets the include. + * + * The include policy works like an OR logical operator. The user must satisfy one of the rules in includes. + * + * @return the include + */ + public List include() { + return include; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppResp.java new file mode 100644 index 000000000..85d571e04 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppResp.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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Delete access application response. + */ +public class DeleteAccessAppResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected DeleteAccessAppRespResult result; + + protected DeleteAccessAppResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public DeleteAccessAppRespResult getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespResult.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespResult.java new file mode 100644 index 000000000..b7fa51eac --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespResult.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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * DeleteAccessAppRespResult. + */ +public class DeleteAccessAppRespResult extends GenericModel { + + protected String id; + + protected DeleteAccessAppRespResult() { } + + /** + * Gets the id. + * + * Application ID. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessApplicationOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessApplicationOptions.java new file mode 100644 index 000000000..70644a12e --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessApplicationOptions.java @@ -0,0 +1,134 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteAccessApplication options. + */ +public class DeleteAccessApplicationOptions extends GenericModel { + + protected String zoneId; + protected String appId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String appId; + + /** + * Instantiates a new Builder from an existing DeleteAccessApplicationOptions instance. + * + * @param deleteAccessApplicationOptions the instance to initialize the Builder with + */ + private Builder(DeleteAccessApplicationOptions deleteAccessApplicationOptions) { + this.zoneId = deleteAccessApplicationOptions.zoneId; + this.appId = deleteAccessApplicationOptions.appId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param appId the appId + */ + public Builder(String zoneId, String appId) { + this.zoneId = zoneId; + this.appId = appId; + } + + /** + * Builds a DeleteAccessApplicationOptions. + * + * @return the new DeleteAccessApplicationOptions instance + */ + public DeleteAccessApplicationOptions build() { + return new DeleteAccessApplicationOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the DeleteAccessApplicationOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the appId. + * + * @param appId the appId + * @return the DeleteAccessApplicationOptions builder + */ + public Builder appId(String appId) { + this.appId = appId; + return this; + } + } + + protected DeleteAccessApplicationOptions() { } + + protected DeleteAccessApplicationOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.appId, + "appId cannot be empty"); + zoneId = builder.zoneId; + appId = builder.appId; + } + + /** + * New builder. + * + * @return a DeleteAccessApplicationOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the appId. + * + * Access application ID. + * + * @return the appId + */ + public String appId() { + return appId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertResp.java new file mode 100644 index 000000000..f079f3aca --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertResp.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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Delete access certificate response. + */ +public class DeleteAccessCertResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected DeleteAccessCertRespResult result; + + protected DeleteAccessCertResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public DeleteAccessCertRespResult getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespResult.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespResult.java new file mode 100644 index 000000000..db012b186 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespResult.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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * DeleteAccessCertRespResult. + */ +public class DeleteAccessCertRespResult extends GenericModel { + + protected String id; + + protected DeleteAccessCertRespResult() { } + + /** + * Gets the id. + * + * Certificate ID. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertificateOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertificateOptions.java new file mode 100644 index 000000000..48b6eccd8 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertificateOptions.java @@ -0,0 +1,134 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteAccessCertificate options. + */ +public class DeleteAccessCertificateOptions extends GenericModel { + + protected String zoneId; + protected String certId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String certId; + + /** + * Instantiates a new Builder from an existing DeleteAccessCertificateOptions instance. + * + * @param deleteAccessCertificateOptions the instance to initialize the Builder with + */ + private Builder(DeleteAccessCertificateOptions deleteAccessCertificateOptions) { + this.zoneId = deleteAccessCertificateOptions.zoneId; + this.certId = deleteAccessCertificateOptions.certId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param certId the certId + */ + public Builder(String zoneId, String certId) { + this.zoneId = zoneId; + this.certId = certId; + } + + /** + * Builds a DeleteAccessCertificateOptions. + * + * @return the new DeleteAccessCertificateOptions instance + */ + public DeleteAccessCertificateOptions build() { + return new DeleteAccessCertificateOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the DeleteAccessCertificateOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the certId. + * + * @param certId the certId + * @return the DeleteAccessCertificateOptions builder + */ + public Builder certId(String certId) { + this.certId = certId; + return this; + } + } + + protected DeleteAccessCertificateOptions() { } + + protected DeleteAccessCertificateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.certId, + "certId cannot be empty"); + zoneId = builder.zoneId; + certId = builder.certId; + } + + /** + * New builder. + * + * @return a DeleteAccessCertificateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the certId. + * + * Access certificate ID. + * + * @return the certId + */ + public String certId() { + return certId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyOptions.java new file mode 100644 index 000000000..c491358ea --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyOptions.java @@ -0,0 +1,164 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteAccessPolicy options. + */ +public class DeleteAccessPolicyOptions extends GenericModel { + + protected String zoneId; + protected String appId; + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String appId; + private String policyId; + + /** + * Instantiates a new Builder from an existing DeleteAccessPolicyOptions instance. + * + * @param deleteAccessPolicyOptions the instance to initialize the Builder with + */ + private Builder(DeleteAccessPolicyOptions deleteAccessPolicyOptions) { + this.zoneId = deleteAccessPolicyOptions.zoneId; + this.appId = deleteAccessPolicyOptions.appId; + this.policyId = deleteAccessPolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param appId the appId + * @param policyId the policyId + */ + public Builder(String zoneId, String appId, String policyId) { + this.zoneId = zoneId; + this.appId = appId; + this.policyId = policyId; + } + + /** + * Builds a DeleteAccessPolicyOptions. + * + * @return the new DeleteAccessPolicyOptions instance + */ + public DeleteAccessPolicyOptions build() { + return new DeleteAccessPolicyOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the DeleteAccessPolicyOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the appId. + * + * @param appId the appId + * @return the DeleteAccessPolicyOptions builder + */ + public Builder appId(String appId) { + this.appId = appId; + return this; + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the DeleteAccessPolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected DeleteAccessPolicyOptions() { } + + protected DeleteAccessPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.appId, + "appId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + zoneId = builder.zoneId; + appId = builder.appId; + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a DeleteAccessPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the appId. + * + * Access application ID. + * + * @return the appId + */ + public String appId() { + return appId; + } + + /** + * Gets the policyId. + * + * Access policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyResp.java new file mode 100644 index 000000000..063b1e82e --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyResp.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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Delete access policy response. + */ +public class DeleteAccessPolicyResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected DeleteAccessPolicyRespResult result; + + protected DeleteAccessPolicyResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public DeleteAccessPolicyRespResult getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespResult.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespResult.java new file mode 100644 index 000000000..f1b1d36c1 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespResult.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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * DeleteAccessPolicyRespResult. + */ +public class DeleteAccessPolicyRespResult extends GenericModel { + + protected String id; + + protected DeleteAccessPolicyRespResult() { } + + /** + * Gets the id. + * + * Policy ID. + * + * @return the id + */ + public String getId() { + return id; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessApplicationOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessApplicationOptions.java new file mode 100644 index 000000000..47152503a --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessApplicationOptions.java @@ -0,0 +1,134 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getAccessApplication options. + */ +public class GetAccessApplicationOptions extends GenericModel { + + protected String zoneId; + protected String appId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String appId; + + /** + * Instantiates a new Builder from an existing GetAccessApplicationOptions instance. + * + * @param getAccessApplicationOptions the instance to initialize the Builder with + */ + private Builder(GetAccessApplicationOptions getAccessApplicationOptions) { + this.zoneId = getAccessApplicationOptions.zoneId; + this.appId = getAccessApplicationOptions.appId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param appId the appId + */ + public Builder(String zoneId, String appId) { + this.zoneId = zoneId; + this.appId = appId; + } + + /** + * Builds a GetAccessApplicationOptions. + * + * @return the new GetAccessApplicationOptions instance + */ + public GetAccessApplicationOptions build() { + return new GetAccessApplicationOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the GetAccessApplicationOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the appId. + * + * @param appId the appId + * @return the GetAccessApplicationOptions builder + */ + public Builder appId(String appId) { + this.appId = appId; + return this; + } + } + + protected GetAccessApplicationOptions() { } + + protected GetAccessApplicationOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.appId, + "appId cannot be empty"); + zoneId = builder.zoneId; + appId = builder.appId; + } + + /** + * New builder. + * + * @return a GetAccessApplicationOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the appId. + * + * Access application ID. + * + * @return the appId + */ + public String appId() { + return appId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertSettingsOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertSettingsOptions.java new file mode 100644 index 000000000..7cf8e95f1 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertSettingsOptions.java @@ -0,0 +1,104 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getAccessCertSettings options. + */ +public class GetAccessCertSettingsOptions extends GenericModel { + + protected String zoneId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + + /** + * Instantiates a new Builder from an existing GetAccessCertSettingsOptions instance. + * + * @param getAccessCertSettingsOptions the instance to initialize the Builder with + */ + private Builder(GetAccessCertSettingsOptions getAccessCertSettingsOptions) { + this.zoneId = getAccessCertSettingsOptions.zoneId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + */ + public Builder(String zoneId) { + this.zoneId = zoneId; + } + + /** + * Builds a GetAccessCertSettingsOptions. + * + * @return the new GetAccessCertSettingsOptions instance + */ + public GetAccessCertSettingsOptions build() { + return new GetAccessCertSettingsOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the GetAccessCertSettingsOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + } + + protected GetAccessCertSettingsOptions() { } + + protected GetAccessCertSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + zoneId = builder.zoneId; + } + + /** + * New builder. + * + * @return a GetAccessCertSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertificateOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertificateOptions.java new file mode 100644 index 000000000..5b035db3e --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertificateOptions.java @@ -0,0 +1,134 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getAccessCertificate options. + */ +public class GetAccessCertificateOptions extends GenericModel { + + protected String zoneId; + protected String certId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String certId; + + /** + * Instantiates a new Builder from an existing GetAccessCertificateOptions instance. + * + * @param getAccessCertificateOptions the instance to initialize the Builder with + */ + private Builder(GetAccessCertificateOptions getAccessCertificateOptions) { + this.zoneId = getAccessCertificateOptions.zoneId; + this.certId = getAccessCertificateOptions.certId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param certId the certId + */ + public Builder(String zoneId, String certId) { + this.zoneId = zoneId; + this.certId = certId; + } + + /** + * Builds a GetAccessCertificateOptions. + * + * @return the new GetAccessCertificateOptions instance + */ + public GetAccessCertificateOptions build() { + return new GetAccessCertificateOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the GetAccessCertificateOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the certId. + * + * @param certId the certId + * @return the GetAccessCertificateOptions builder + */ + public Builder certId(String certId) { + this.certId = certId; + return this; + } + } + + protected GetAccessCertificateOptions() { } + + protected GetAccessCertificateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.certId, + "certId cannot be empty"); + zoneId = builder.zoneId; + certId = builder.certId; + } + + /** + * New builder. + * + * @return a GetAccessCertificateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the certId. + * + * Access certificate ID. + * + * @return the certId + */ + public String certId() { + return certId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessPolicyOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessPolicyOptions.java new file mode 100644 index 000000000..b101a2bff --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessPolicyOptions.java @@ -0,0 +1,164 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getAccessPolicy options. + */ +public class GetAccessPolicyOptions extends GenericModel { + + protected String zoneId; + protected String appId; + protected String policyId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String appId; + private String policyId; + + /** + * Instantiates a new Builder from an existing GetAccessPolicyOptions instance. + * + * @param getAccessPolicyOptions the instance to initialize the Builder with + */ + private Builder(GetAccessPolicyOptions getAccessPolicyOptions) { + this.zoneId = getAccessPolicyOptions.zoneId; + this.appId = getAccessPolicyOptions.appId; + this.policyId = getAccessPolicyOptions.policyId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param appId the appId + * @param policyId the policyId + */ + public Builder(String zoneId, String appId, String policyId) { + this.zoneId = zoneId; + this.appId = appId; + this.policyId = policyId; + } + + /** + * Builds a GetAccessPolicyOptions. + * + * @return the new GetAccessPolicyOptions instance + */ + public GetAccessPolicyOptions build() { + return new GetAccessPolicyOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the GetAccessPolicyOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the appId. + * + * @param appId the appId + * @return the GetAccessPolicyOptions builder + */ + public Builder appId(String appId) { + this.appId = appId; + return this; + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the GetAccessPolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + } + + protected GetAccessPolicyOptions() { } + + protected GetAccessPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.appId, + "appId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + zoneId = builder.zoneId; + appId = builder.appId; + policyId = builder.policyId; + } + + /** + * New builder. + * + * @return a GetAccessPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the appId. + * + * Access application ID. + * + * @return the appId + */ + public String appId() { + return appId; + } + + /** + * Gets the policyId. + * + * Access policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessApplicationsOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessApplicationsOptions.java new file mode 100644 index 000000000..dad5e045c --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessApplicationsOptions.java @@ -0,0 +1,104 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listAccessApplications options. + */ +public class ListAccessApplicationsOptions extends GenericModel { + + protected String zoneId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + + /** + * Instantiates a new Builder from an existing ListAccessApplicationsOptions instance. + * + * @param listAccessApplicationsOptions the instance to initialize the Builder with + */ + private Builder(ListAccessApplicationsOptions listAccessApplicationsOptions) { + this.zoneId = listAccessApplicationsOptions.zoneId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + */ + public Builder(String zoneId) { + this.zoneId = zoneId; + } + + /** + * Builds a ListAccessApplicationsOptions. + * + * @return the new ListAccessApplicationsOptions instance + */ + public ListAccessApplicationsOptions build() { + return new ListAccessApplicationsOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the ListAccessApplicationsOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + } + + protected ListAccessApplicationsOptions() { } + + protected ListAccessApplicationsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + zoneId = builder.zoneId; + } + + /** + * New builder. + * + * @return a ListAccessApplicationsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessAppsResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessAppsResp.java new file mode 100644 index 000000000..0df46575b --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessAppsResp.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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * List access applications response. + */ +public class ListAccessAppsResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected List result; + + protected ListAccessAppsResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public List getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertificatesOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertificatesOptions.java new file mode 100644 index 000000000..fd131f7df --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertificatesOptions.java @@ -0,0 +1,104 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listAccessCertificates options. + */ +public class ListAccessCertificatesOptions extends GenericModel { + + protected String zoneId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + + /** + * Instantiates a new Builder from an existing ListAccessCertificatesOptions instance. + * + * @param listAccessCertificatesOptions the instance to initialize the Builder with + */ + private Builder(ListAccessCertificatesOptions listAccessCertificatesOptions) { + this.zoneId = listAccessCertificatesOptions.zoneId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + */ + public Builder(String zoneId) { + this.zoneId = zoneId; + } + + /** + * Builds a ListAccessCertificatesOptions. + * + * @return the new ListAccessCertificatesOptions instance + */ + public ListAccessCertificatesOptions build() { + return new ListAccessCertificatesOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the ListAccessCertificatesOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + } + + protected ListAccessCertificatesOptions() { } + + protected ListAccessCertificatesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + zoneId = builder.zoneId; + } + + /** + * New builder. + * + * @return a ListAccessCertificatesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertsResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertsResp.java new file mode 100644 index 000000000..635d9633f --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertsResp.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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * List access certificate response. + */ +public class ListAccessCertsResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected List result; + + protected ListAccessCertsResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public List getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesOptions.java new file mode 100644 index 000000000..54ca9b01c --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesOptions.java @@ -0,0 +1,134 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listAccessPolicies options. + */ +public class ListAccessPoliciesOptions extends GenericModel { + + protected String zoneId; + protected String appId; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String appId; + + /** + * Instantiates a new Builder from an existing ListAccessPoliciesOptions instance. + * + * @param listAccessPoliciesOptions the instance to initialize the Builder with + */ + private Builder(ListAccessPoliciesOptions listAccessPoliciesOptions) { + this.zoneId = listAccessPoliciesOptions.zoneId; + this.appId = listAccessPoliciesOptions.appId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param appId the appId + */ + public Builder(String zoneId, String appId) { + this.zoneId = zoneId; + this.appId = appId; + } + + /** + * Builds a ListAccessPoliciesOptions. + * + * @return the new ListAccessPoliciesOptions instance + */ + public ListAccessPoliciesOptions build() { + return new ListAccessPoliciesOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the ListAccessPoliciesOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the appId. + * + * @param appId the appId + * @return the ListAccessPoliciesOptions builder + */ + public Builder appId(String appId) { + this.appId = appId; + return this; + } + } + + protected ListAccessPoliciesOptions() { } + + protected ListAccessPoliciesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.appId, + "appId cannot be empty"); + zoneId = builder.zoneId; + appId = builder.appId; + } + + /** + * New builder. + * + * @return a ListAccessPoliciesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the appId. + * + * Access application ID. + * + * @return the appId + */ + public String appId() { + return appId; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesResp.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesResp.java new file mode 100644 index 000000000..44a4d6cde --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesResp.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.mtls.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * List access policies response. + */ +public class ListAccessPoliciesResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected List result; + + protected ListAccessPoliciesResp() { } + + /** + * Gets the success. + * + * Was operation successful. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * Array of errors encountered. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * Array of messages returned. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * @return the result + */ + public List getResult() { + return result; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyCnRuleCommonName.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyCnRuleCommonName.java new file mode 100644 index 000000000..ff30525eb --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyCnRuleCommonName.java @@ -0,0 +1,106 @@ +/* + * (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.mtls.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * PolicyCnRuleCommonName. + */ +public class PolicyCnRuleCommonName extends GenericModel { + + @SerializedName("common_name") + protected String commonName; + + /** + * Builder. + */ + public static class Builder { + private String commonName; + + /** + * Instantiates a new Builder from an existing PolicyCnRuleCommonName instance. + * + * @param policyCnRuleCommonName the instance to initialize the Builder with + */ + private Builder(PolicyCnRuleCommonName policyCnRuleCommonName) { + this.commonName = policyCnRuleCommonName.commonName; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param commonName the commonName + */ + public Builder(String commonName) { + this.commonName = commonName; + } + + /** + * Builds a PolicyCnRuleCommonName. + * + * @return the new PolicyCnRuleCommonName instance + */ + public PolicyCnRuleCommonName build() { + return new PolicyCnRuleCommonName(this); + } + + /** + * Set the commonName. + * + * @param commonName the commonName + * @return the PolicyCnRuleCommonName builder + */ + public Builder commonName(String commonName) { + this.commonName = commonName; + return this; + } + } + + protected PolicyCnRuleCommonName() { } + + protected PolicyCnRuleCommonName(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.commonName, + "commonName cannot be null"); + commonName = builder.commonName; + } + + /** + * New builder. + * + * @return a PolicyCnRuleCommonName builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the commonName. + * + * Common name of client certificate. + * + * @return the commonName + */ + public String commonName() { + return commonName; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyResult.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyResult.java new file mode 100644 index 000000000..c0a12eb1c --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyResult.java @@ -0,0 +1,151 @@ +/* + * (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.mtls.v1.model; + +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Access policies information. + */ +public class PolicyResult extends GenericModel { + + protected String id; + protected String name; + protected String decision; + protected List include; + protected List exclude; + protected Long precedence; + protected List require; + protected String uid; + @SerializedName("created_at") + protected String createdAt; + @SerializedName("updated_at") + protected String updatedAt; + + protected PolicyResult() { } + + /** + * Gets the id. + * + * Policy ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the name. + * + * Policy name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the decision. + * + * The action Access takes if the policy matches the user. + * + * @return the decision + */ + public String getDecision() { + return decision; + } + + /** + * Gets the include. + * + * The include policy works like an OR logical operator. + * + * @return the include + */ + public List getInclude() { + return include; + } + + /** + * Gets the exclude. + * + * The exclude policy works like a NOT logical operator. + * + * @return the exclude + */ + public List getExclude() { + return exclude; + } + + /** + * Gets the precedence. + * + * The unique precedence for policies on a single application. + * + * @return the precedence + */ + public Long getPrecedence() { + return precedence; + } + + /** + * Gets the require. + * + * The require policy works like a AND logical operator. + * + * @return the require + */ + public List getRequire() { + return require; + } + + /** + * Gets the uid. + * + * UUID, same as ID. + * + * @return the uid + */ + public String getUid() { + return uid; + } + + /** + * Gets the createdAt. + * + * Created time of the policy. + * + * @return the createdAt + */ + public String getCreatedAt() { + return createdAt; + } + + /** + * Gets the updatedAt. + * + * Updated time of the policy. + * + * @return the updatedAt + */ + public String getUpdatedAt() { + return updatedAt; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRule.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRule.java new file mode 100644 index 000000000..692922658 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRule.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.mtls.v1.model; + +import java.util.Map; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Policy rule. + * + * Classes which extend this class: + * - PolicyRulePolicyCertRule + * - PolicyRulePolicyCnRule + */ +public class PolicyRule extends GenericModel { + + protected Map certificate; + @SerializedName("common_name") + protected PolicyCnRuleCommonName commonName; + + protected PolicyRule() { } + + /** + * Gets the certificate. + * + * @return the certificate + */ + public Map certificate() { + return certificate; + } + + /** + * Gets the commonName. + * + * @return the commonName + */ + public PolicyCnRuleCommonName commonName() { + return commonName; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCertRule.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCertRule.java new file mode 100644 index 000000000..75c4a34b8 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCertRule.java @@ -0,0 +1,81 @@ +/* + * (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.mtls.v1.model; + +import java.util.Map; + +/** + * Policy rule of certificate. + */ +public class PolicyRulePolicyCertRule extends PolicyRule { + + + /** + * Builder. + */ + public static class Builder { + private Map certificate; + + /** + * Instantiates a new Builder from an existing PolicyRulePolicyCertRule instance. + * + * @param policyRulePolicyCertRule the instance to initialize the Builder with + */ + public Builder(PolicyRule policyRulePolicyCertRule) { + this.certificate = policyRulePolicyCertRule.certificate; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a PolicyRulePolicyCertRule. + * + * @return the new PolicyRulePolicyCertRule instance + */ + public PolicyRulePolicyCertRule build() { + return new PolicyRulePolicyCertRule(this); + } + + /** + * Set the certificate. + * + * @param certificate the certificate + * @return the PolicyRulePolicyCertRule builder + */ + public Builder certificate(Map certificate) { + this.certificate = certificate; + return this; + } + } + + protected PolicyRulePolicyCertRule() { } + + protected PolicyRulePolicyCertRule(Builder builder) { + certificate = builder.certificate; + } + + /** + * New builder. + * + * @return a PolicyRulePolicyCertRule builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCnRule.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCnRule.java new file mode 100644 index 000000000..776aac40d --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCnRule.java @@ -0,0 +1,90 @@ +/* + * (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.mtls.v1.model; + +/** + * Policy rule of common name. + */ +public class PolicyRulePolicyCnRule extends PolicyRule { + + + /** + * Builder. + */ + public static class Builder { + private PolicyCnRuleCommonName commonName; + + /** + * Instantiates a new Builder from an existing PolicyRulePolicyCnRule instance. + * + * @param policyRulePolicyCnRule the instance to initialize the Builder with + */ + public Builder(PolicyRule policyRulePolicyCnRule) { + this.commonName = policyRulePolicyCnRule.commonName; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param commonName the commonName + */ + public Builder(PolicyCnRuleCommonName commonName) { + this.commonName = commonName; + } + + /** + * Builds a PolicyRulePolicyCnRule. + * + * @return the new PolicyRulePolicyCnRule instance + */ + public PolicyRulePolicyCnRule build() { + return new PolicyRulePolicyCnRule(this); + } + + /** + * Set the commonName. + * + * @param commonName the commonName + * @return the PolicyRulePolicyCnRule builder + */ + public Builder commonName(PolicyCnRuleCommonName commonName) { + this.commonName = commonName; + return this; + } + } + + protected PolicyRulePolicyCnRule() { } + + protected PolicyRulePolicyCnRule(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.commonName, + "commonName cannot be null"); + commonName = builder.commonName; + } + + /** + * New builder. + * + * @return a PolicyRulePolicyCnRule builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessApplicationOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessApplicationOptions.java new file mode 100644 index 000000000..aa3f9add6 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessApplicationOptions.java @@ -0,0 +1,212 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateAccessApplication options. + */ +public class UpdateAccessApplicationOptions extends GenericModel { + + protected String zoneId; + protected String appId; + protected String name; + protected String domain; + protected String sessionDuration; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String appId; + private String name; + private String domain; + private String sessionDuration; + + /** + * Instantiates a new Builder from an existing UpdateAccessApplicationOptions instance. + * + * @param updateAccessApplicationOptions the instance to initialize the Builder with + */ + private Builder(UpdateAccessApplicationOptions updateAccessApplicationOptions) { + this.zoneId = updateAccessApplicationOptions.zoneId; + this.appId = updateAccessApplicationOptions.appId; + this.name = updateAccessApplicationOptions.name; + this.domain = updateAccessApplicationOptions.domain; + this.sessionDuration = updateAccessApplicationOptions.sessionDuration; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param appId the appId + */ + public Builder(String zoneId, String appId) { + this.zoneId = zoneId; + this.appId = appId; + } + + /** + * Builds a UpdateAccessApplicationOptions. + * + * @return the new UpdateAccessApplicationOptions instance + */ + public UpdateAccessApplicationOptions build() { + return new UpdateAccessApplicationOptions(this); + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the UpdateAccessApplicationOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the appId. + * + * @param appId the appId + * @return the UpdateAccessApplicationOptions builder + */ + public Builder appId(String appId) { + this.appId = appId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateAccessApplicationOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the domain. + * + * @param domain the domain + * @return the UpdateAccessApplicationOptions builder + */ + public Builder domain(String domain) { + this.domain = domain; + return this; + } + + /** + * Set the sessionDuration. + * + * @param sessionDuration the sessionDuration + * @return the UpdateAccessApplicationOptions builder + */ + public Builder sessionDuration(String sessionDuration) { + this.sessionDuration = sessionDuration; + return this; + } + } + + protected UpdateAccessApplicationOptions() { } + + protected UpdateAccessApplicationOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.appId, + "appId cannot be empty"); + zoneId = builder.zoneId; + appId = builder.appId; + name = builder.name; + domain = builder.domain; + sessionDuration = builder.sessionDuration; + } + + /** + * New builder. + * + * @return a UpdateAccessApplicationOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the appId. + * + * Access application ID. + * + * @return the appId + */ + public String appId() { + return appId; + } + + /** + * Gets the name. + * + * Application name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the domain. + * + * The domain and path that Access blocks. + * + * @return the domain + */ + public String domain() { + return domain; + } + + /** + * Gets the sessionDuration. + * + * The amount of time that the tokens issued for this application are valid. + * + * @return the sessionDuration + */ + public String sessionDuration() { + return sessionDuration; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertSettingsOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertSettingsOptions.java new file mode 100644 index 000000000..ceb1f13ed --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertSettingsOptions.java @@ -0,0 +1,148 @@ +/* + * (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.mtls.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateAccessCertSettings options. + */ +public class UpdateAccessCertSettingsOptions extends GenericModel { + + protected String zoneId; + protected List settings; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private List settings; + + /** + * Instantiates a new Builder from an existing UpdateAccessCertSettingsOptions instance. + * + * @param updateAccessCertSettingsOptions the instance to initialize the Builder with + */ + private Builder(UpdateAccessCertSettingsOptions updateAccessCertSettingsOptions) { + this.zoneId = updateAccessCertSettingsOptions.zoneId; + this.settings = updateAccessCertSettingsOptions.settings; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + */ + public Builder(String zoneId) { + this.zoneId = zoneId; + } + + /** + * Builds a UpdateAccessCertSettingsOptions. + * + * @return the new UpdateAccessCertSettingsOptions instance + */ + public UpdateAccessCertSettingsOptions build() { + return new UpdateAccessCertSettingsOptions(this); + } + + /** + * Adds a new element to settings. + * + * @param settings the new element to be added + * @return the UpdateAccessCertSettingsOptions builder + */ + public Builder addSettings(AccessCertSettingsInputArray settings) { + com.ibm.cloud.sdk.core.util.Validator.notNull(settings, + "settings cannot be null"); + if (this.settings == null) { + this.settings = new ArrayList(); + } + this.settings.add(settings); + return this; + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the UpdateAccessCertSettingsOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the settings. + * Existing settings will be replaced. + * + * @param settings the settings + * @return the UpdateAccessCertSettingsOptions builder + */ + public Builder settings(List settings) { + this.settings = settings; + return this; + } + } + + protected UpdateAccessCertSettingsOptions() { } + + protected UpdateAccessCertSettingsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + zoneId = builder.zoneId; + settings = builder.settings; + } + + /** + * New builder. + * + * @return a UpdateAccessCertSettingsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the settings. + * + * @return the settings + */ + public List settings() { + return settings; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertificateOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertificateOptions.java new file mode 100644 index 000000000..8ca4070c3 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertificateOptions.java @@ -0,0 +1,206 @@ +/* + * (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.mtls.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateAccessCertificate options. + */ +public class UpdateAccessCertificateOptions extends GenericModel { + + protected String zoneId; + protected String certId; + protected String name; + protected List associatedHostnames; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String certId; + private String name; + private List associatedHostnames; + + /** + * Instantiates a new Builder from an existing UpdateAccessCertificateOptions instance. + * + * @param updateAccessCertificateOptions the instance to initialize the Builder with + */ + private Builder(UpdateAccessCertificateOptions updateAccessCertificateOptions) { + this.zoneId = updateAccessCertificateOptions.zoneId; + this.certId = updateAccessCertificateOptions.certId; + this.name = updateAccessCertificateOptions.name; + this.associatedHostnames = updateAccessCertificateOptions.associatedHostnames; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param certId the certId + */ + public Builder(String zoneId, String certId) { + this.zoneId = zoneId; + this.certId = certId; + } + + /** + * Builds a UpdateAccessCertificateOptions. + * + * @return the new UpdateAccessCertificateOptions instance + */ + public UpdateAccessCertificateOptions build() { + return new UpdateAccessCertificateOptions(this); + } + + /** + * Adds a new element to associatedHostnames. + * + * @param associatedHostnames the new element to be added + * @return the UpdateAccessCertificateOptions builder + */ + public Builder addAssociatedHostnames(String associatedHostnames) { + com.ibm.cloud.sdk.core.util.Validator.notNull(associatedHostnames, + "associatedHostnames cannot be null"); + if (this.associatedHostnames == null) { + this.associatedHostnames = new ArrayList(); + } + this.associatedHostnames.add(associatedHostnames); + return this; + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the UpdateAccessCertificateOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the certId. + * + * @param certId the certId + * @return the UpdateAccessCertificateOptions builder + */ + public Builder certId(String certId) { + this.certId = certId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateAccessCertificateOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the associatedHostnames. + * Existing associatedHostnames will be replaced. + * + * @param associatedHostnames the associatedHostnames + * @return the UpdateAccessCertificateOptions builder + */ + public Builder associatedHostnames(List associatedHostnames) { + this.associatedHostnames = associatedHostnames; + return this; + } + } + + protected UpdateAccessCertificateOptions() { } + + protected UpdateAccessCertificateOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.certId, + "certId cannot be empty"); + zoneId = builder.zoneId; + certId = builder.certId; + name = builder.name; + associatedHostnames = builder.associatedHostnames; + } + + /** + * New builder. + * + * @return a UpdateAccessCertificateOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the certId. + * + * Access certificate ID. + * + * @return the certId + */ + public String certId() { + return certId; + } + + /** + * Gets the name. + * + * Access certificate name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the associatedHostnames. + * + * The hostnames that are prompted for this certificate. + * + * @return the associatedHostnames + */ + public List associatedHostnames() { + return associatedHostnames; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessPolicyOptions.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessPolicyOptions.java new file mode 100644 index 000000000..1a23a05e1 --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessPolicyOptions.java @@ -0,0 +1,270 @@ +/* + * (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.mtls.v1.model; + +import java.util.ArrayList; +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateAccessPolicy options. + */ +public class UpdateAccessPolicyOptions extends GenericModel { + + /** + * Defines the action Access takes if the policy matches the user. + */ + public interface Decision { + /** non_identity. */ + String NON_IDENTITY = "non_identity"; + } + + protected String zoneId; + protected String appId; + protected String policyId; + protected String name; + protected String decision; + protected List include; + + /** + * Builder. + */ + public static class Builder { + private String zoneId; + private String appId; + private String policyId; + private String name; + private String decision; + private List include; + + /** + * Instantiates a new Builder from an existing UpdateAccessPolicyOptions instance. + * + * @param updateAccessPolicyOptions the instance to initialize the Builder with + */ + private Builder(UpdateAccessPolicyOptions updateAccessPolicyOptions) { + this.zoneId = updateAccessPolicyOptions.zoneId; + this.appId = updateAccessPolicyOptions.appId; + this.policyId = updateAccessPolicyOptions.policyId; + this.name = updateAccessPolicyOptions.name; + this.decision = updateAccessPolicyOptions.decision; + this.include = updateAccessPolicyOptions.include; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param zoneId the zoneId + * @param appId the appId + * @param policyId the policyId + */ + public Builder(String zoneId, String appId, String policyId) { + this.zoneId = zoneId; + this.appId = appId; + this.policyId = policyId; + } + + /** + * Builds a UpdateAccessPolicyOptions. + * + * @return the new UpdateAccessPolicyOptions instance + */ + public UpdateAccessPolicyOptions build() { + return new UpdateAccessPolicyOptions(this); + } + + /** + * Adds a new element to include. + * + * @param include the new element to be added + * @return the UpdateAccessPolicyOptions builder + */ + public Builder addInclude(PolicyRule include) { + com.ibm.cloud.sdk.core.util.Validator.notNull(include, + "include cannot be null"); + if (this.include == null) { + this.include = new ArrayList(); + } + this.include.add(include); + return this; + } + + /** + * Set the zoneId. + * + * @param zoneId the zoneId + * @return the UpdateAccessPolicyOptions builder + */ + public Builder zoneId(String zoneId) { + this.zoneId = zoneId; + return this; + } + + /** + * Set the appId. + * + * @param appId the appId + * @return the UpdateAccessPolicyOptions builder + */ + public Builder appId(String appId) { + this.appId = appId; + return this; + } + + /** + * Set the policyId. + * + * @param policyId the policyId + * @return the UpdateAccessPolicyOptions builder + */ + public Builder policyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateAccessPolicyOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the decision. + * + * @param decision the decision + * @return the UpdateAccessPolicyOptions builder + */ + public Builder decision(String decision) { + this.decision = decision; + return this; + } + + /** + * Set the include. + * Existing include will be replaced. + * + * @param include the include + * @return the UpdateAccessPolicyOptions builder + */ + public Builder include(List include) { + this.include = include; + return this; + } + } + + protected UpdateAccessPolicyOptions() { } + + protected UpdateAccessPolicyOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.zoneId, + "zoneId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.appId, + "appId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.policyId, + "policyId cannot be empty"); + zoneId = builder.zoneId; + appId = builder.appId; + policyId = builder.policyId; + name = builder.name; + decision = builder.decision; + include = builder.include; + } + + /** + * New builder. + * + * @return a UpdateAccessPolicyOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the zoneId. + * + * Zone ID. + * + * @return the zoneId + */ + public String zoneId() { + return zoneId; + } + + /** + * Gets the appId. + * + * Access application ID. + * + * @return the appId + */ + public String appId() { + return appId; + } + + /** + * Gets the policyId. + * + * Access policy ID. + * + * @return the policyId + */ + public String policyId() { + return policyId; + } + + /** + * Gets the name. + * + * Policy name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the decision. + * + * Defines the action Access takes if the policy matches the user. + * + * @return the decision + */ + public String decision() { + return decision; + } + + /** + * Gets the include. + * + * The include policy works like an OR logical operator. The user must satisfy one of the rules in includes. + * + * @return the include + */ + public List include() { + return include; + } +} + diff --git a/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/package-info.java b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/v1/package-info.java new file mode 100644 index 000000000..f0e812f6a --- /dev/null +++ b/modules/mtls/src/main/java/com/ibm/cloud/networking/mtls/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. + */ + +/** + * MTLS v1. + */ +package com.ibm.cloud.networking.mtls.v1; diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/MtlsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/MtlsTest.java new file mode 100644 index 000000000..bb120afac --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/MtlsTest.java @@ -0,0 +1,1099 @@ +/* + * (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.mtls.v1; + +import com.ibm.cloud.networking.mtls.v1.Mtls; +import com.ibm.cloud.networking.mtls.v1.model.AccessAppResp; +import com.ibm.cloud.networking.mtls.v1.model.AccessCertResp; +import com.ibm.cloud.networking.mtls.v1.model.AccessCertSettingsInputArray; +import com.ibm.cloud.networking.mtls.v1.model.AccessCertSettingsResp; +import com.ibm.cloud.networking.mtls.v1.model.AccessOrgResp; +import com.ibm.cloud.networking.mtls.v1.model.AccessOrgRespResult; +import com.ibm.cloud.networking.mtls.v1.model.AccessPolicyResp; +import com.ibm.cloud.networking.mtls.v1.model.AppResult; +import com.ibm.cloud.networking.mtls.v1.model.CertResult; +import com.ibm.cloud.networking.mtls.v1.model.CertSettingsResult; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessAppResp; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessAppRespResult; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessOrganizationOptions; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessAppResp; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessAppRespResult; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessCertResp; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessCertRespResult; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessPolicyResp; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessPolicyRespResult; +import com.ibm.cloud.networking.mtls.v1.model.GetAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.model.GetAccessCertSettingsOptions; +import com.ibm.cloud.networking.mtls.v1.model.GetAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.model.GetAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessApplicationsOptions; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessAppsResp; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessCertificatesOptions; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessCertsResp; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessPoliciesOptions; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessPoliciesResp; +import com.ibm.cloud.networking.mtls.v1.model.PolicyCnRuleCommonName; +import com.ibm.cloud.networking.mtls.v1.model.PolicyResult; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRule; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCnRule; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessCertSettingsOptions; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.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 Mtls service. + */ +public class MtlsTest { + + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + protected MockWebServer server; + protected Mtls mtlsService; + + // 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"; + new Mtls(crn, serviceName, null); + } + + + // Test the getter for the crn global parameter + @Test + public void testGetCrn() throws Throwable { + assertEquals(mtlsService.getCrn(), "testString"); + } + + // Test the listAccessCertificates operation with a valid options model parameter + @Test + public void testListAccessCertificatesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": [{\"id\": \"21a41336-9001-42c4-8440-c79e0cb86e1f\", \"name\": \"test-cert\", \"fingerprint\": \"MD5 Fingerprint=38:38:B4:FB:3C:33:CE:2C:8E:8E:D1:1B:94:70:C1:5F\", \"associated_hostnames\": [\"test.example.com\"], \"created_at\": \"2021-04-19T11:09:11Z\", \"updated_at\": \"2021-04-19T11:09:11Z\", \"expires_on\": \"2026-04-18T06:26:00Z\"}]}"; + String listAccessCertificatesPath = "/v1/testString/zones/testString/access/certificates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListAccessCertificatesOptions model + ListAccessCertificatesOptions listAccessCertificatesOptionsModel = new ListAccessCertificatesOptions.Builder() + .zoneId("testString") + .build(); + + // Invoke listAccessCertificates() with a valid options model and verify the result + Response response = mtlsService.listAccessCertificates(listAccessCertificatesOptionsModel).execute(); + assertNotNull(response); + ListAccessCertsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, listAccessCertificatesPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the listAccessCertificates operation with and without retries enabled + @Test + public void testListAccessCertificatesWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testListAccessCertificatesWOptions(); + + mtlsService.disableRetries(); + testListAccessCertificatesWOptions(); + } + + // Test the listAccessCertificates operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListAccessCertificatesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.listAccessCertificates(null).execute(); + } + + // Test the createAccessCertificate operation with a valid options model parameter + @Test + public void testCreateAccessCertificateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"21a41336-9001-42c4-8440-c79e0cb86e1f\", \"name\": \"test-cert\", \"fingerprint\": \"MD5 Fingerprint=38:38:B4:FB:3C:33:CE:2C:8E:8E:D1:1B:94:70:C1:5F\", \"associated_hostnames\": [\"test.example.com\"], \"created_at\": \"2021-04-19T11:09:11Z\", \"updated_at\": \"2021-04-19T11:09:11Z\", \"expires_on\": \"2026-04-18T06:26:00Z\"}}"; + String createAccessCertificatePath = "/v1/testString/zones/testString/access/certificates"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateAccessCertificateOptions model + CreateAccessCertificateOptions createAccessCertificateOptionsModel = new CreateAccessCertificateOptions.Builder() + .zoneId("testString") + .name("test-cert") + .certificate("-----BEGIN CERTIFICATE-----\nMIIGAjCCA+qgAwIBAgIJAI7kymlF7CWT...N4RI7KKB7nikiuUf8vhULKy5IX10\nDrUtmu/B\n-----END CERTIFICATE-----") + .associatedHostnames(java.util.Arrays.asList("test.example.com")) + .build(); + + // Invoke createAccessCertificate() with a valid options model and verify the result + Response response = mtlsService.createAccessCertificate(createAccessCertificateOptionsModel).execute(); + assertNotNull(response); + AccessCertResp responseObj = 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, createAccessCertificatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createAccessCertificate operation with and without retries enabled + @Test + public void testCreateAccessCertificateWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testCreateAccessCertificateWOptions(); + + mtlsService.disableRetries(); + testCreateAccessCertificateWOptions(); + } + + // Test the createAccessCertificate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateAccessCertificateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.createAccessCertificate(null).execute(); + } + + // Test the getAccessCertificate operation with a valid options model parameter + @Test + public void testGetAccessCertificateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"21a41336-9001-42c4-8440-c79e0cb86e1f\", \"name\": \"test-cert\", \"fingerprint\": \"MD5 Fingerprint=38:38:B4:FB:3C:33:CE:2C:8E:8E:D1:1B:94:70:C1:5F\", \"associated_hostnames\": [\"test.example.com\"], \"created_at\": \"2021-04-19T11:09:11Z\", \"updated_at\": \"2021-04-19T11:09:11Z\", \"expires_on\": \"2026-04-18T06:26:00Z\"}}"; + String getAccessCertificatePath = "/v1/testString/zones/testString/access/certificates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetAccessCertificateOptions model + GetAccessCertificateOptions getAccessCertificateOptionsModel = new GetAccessCertificateOptions.Builder() + .zoneId("testString") + .certId("testString") + .build(); + + // Invoke getAccessCertificate() with a valid options model and verify the result + Response response = mtlsService.getAccessCertificate(getAccessCertificateOptionsModel).execute(); + assertNotNull(response); + AccessCertResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getAccessCertificatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getAccessCertificate operation with and without retries enabled + @Test + public void testGetAccessCertificateWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testGetAccessCertificateWOptions(); + + mtlsService.disableRetries(); + testGetAccessCertificateWOptions(); + } + + // Test the getAccessCertificate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccessCertificateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.getAccessCertificate(null).execute(); + } + + // Test the updateAccessCertificate operation with a valid options model parameter + @Test + public void testUpdateAccessCertificateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"21a41336-9001-42c4-8440-c79e0cb86e1f\", \"name\": \"test-cert\", \"fingerprint\": \"MD5 Fingerprint=38:38:B4:FB:3C:33:CE:2C:8E:8E:D1:1B:94:70:C1:5F\", \"associated_hostnames\": [\"test.example.com\"], \"created_at\": \"2021-04-19T11:09:11Z\", \"updated_at\": \"2021-04-19T11:09:11Z\", \"expires_on\": \"2026-04-18T06:26:00Z\"}}"; + String updateAccessCertificatePath = "/v1/testString/zones/testString/access/certificates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateAccessCertificateOptions model + UpdateAccessCertificateOptions updateAccessCertificateOptionsModel = new UpdateAccessCertificateOptions.Builder() + .zoneId("testString") + .certId("testString") + .name("test-cert") + .associatedHostnames(java.util.Arrays.asList("test.example.com")) + .build(); + + // Invoke updateAccessCertificate() with a valid options model and verify the result + Response response = mtlsService.updateAccessCertificate(updateAccessCertificateOptionsModel).execute(); + assertNotNull(response); + AccessCertResp responseObj = 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, updateAccessCertificatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateAccessCertificate operation with and without retries enabled + @Test + public void testUpdateAccessCertificateWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testUpdateAccessCertificateWOptions(); + + mtlsService.disableRetries(); + testUpdateAccessCertificateWOptions(); + } + + // Test the updateAccessCertificate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccessCertificateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.updateAccessCertificate(null).execute(); + } + + // Test the deleteAccessCertificate operation with a valid options model parameter + @Test + public void testDeleteAccessCertificateWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"21a41336-9001-42c4-8440-c79e0cb86e1f\"}}"; + String deleteAccessCertificatePath = "/v1/testString/zones/testString/access/certificates/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteAccessCertificateOptions model + DeleteAccessCertificateOptions deleteAccessCertificateOptionsModel = new DeleteAccessCertificateOptions.Builder() + .zoneId("testString") + .certId("testString") + .build(); + + // Invoke deleteAccessCertificate() with a valid options model and verify the result + Response response = mtlsService.deleteAccessCertificate(deleteAccessCertificateOptionsModel).execute(); + assertNotNull(response); + DeleteAccessCertResp responseObj = 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, deleteAccessCertificatePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteAccessCertificate operation with and without retries enabled + @Test + public void testDeleteAccessCertificateWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testDeleteAccessCertificateWOptions(); + + mtlsService.disableRetries(); + testDeleteAccessCertificateWOptions(); + } + + // Test the deleteAccessCertificate operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteAccessCertificateNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.deleteAccessCertificate(null).execute(); + } + + // Test the listAccessApplications operation with a valid options model parameter + @Test + public void testListAccessApplicationsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": [{\"id\": \"de4526d6-d125-4f95-906f-1757510a9cd8\", \"name\": \"mtls-test-app\", \"domain\": \"test.example.com\", \"aud\": \"f8e1744453ea3679d919fdc6db58cff648f2b14b33a729f780fc02e75a42a008\", \"policies\": [{\"id\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"name\": \"mtls-test-policy\", \"decision\": \"non_identity\", \"include\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"exclude\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"precedence\": 1, \"require\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"uid\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"created_at\": \"2021-04-19T08:01:21Z\", \"updated_at\": \"2021-04-19T08:01:21Z\"}], \"allowed_idps\": [\"699d98642c564d2e855e9661899b7252\"], \"auto_redirect_to_identity\": false, \"session_duration\": \"24h\", \"type\": \"self_hosted\", \"uid\": \"de4526d6-d125-4f95-906f-1757510a9cd8\", \"created_at\": \"2021-04-19T07:59:49Z\", \"updated_at\": \"2021-04-19T07:59:49Z\"}]}"; + String listAccessApplicationsPath = "/v1/testString/zones/testString/access/apps"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListAccessApplicationsOptions model + ListAccessApplicationsOptions listAccessApplicationsOptionsModel = new ListAccessApplicationsOptions.Builder() + .zoneId("testString") + .build(); + + // Invoke listAccessApplications() with a valid options model and verify the result + Response response = mtlsService.listAccessApplications(listAccessApplicationsOptionsModel).execute(); + assertNotNull(response); + ListAccessAppsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, listAccessApplicationsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the listAccessApplications operation with and without retries enabled + @Test + public void testListAccessApplicationsWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testListAccessApplicationsWOptions(); + + mtlsService.disableRetries(); + testListAccessApplicationsWOptions(); + } + + // Test the listAccessApplications operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListAccessApplicationsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.listAccessApplications(null).execute(); + } + + // Test the createAccessApplication operation with a valid options model parameter + @Test + public void testCreateAccessApplicationWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"de4526d6-d125-4f95-906f-1757510a9cd8\", \"name\": \"mtls-test-app\", \"domain\": \"test.example.com\", \"aud\": \"f8e1744453ea3679d919fdc6db58cff648f2b14b33a729f780fc02e75a42a008\", \"policies\": [{\"anyKey\": \"anyValue\"}], \"allowed_idps\": [\"allowedIdps\"], \"auto_redirect_to_identity\": false, \"session_duration\": \"24h\", \"type\": \"self_hosted\", \"uid\": \"de4526d6-d125-4f95-906f-1757510a9cd8\", \"created_at\": \"2021-04-19T07:59:49Z\", \"updated_at\": \"2021-04-19T07:59:49Z\"}}"; + String createAccessApplicationPath = "/v1/testString/zones/testString/access/apps"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateAccessApplicationOptions model + CreateAccessApplicationOptions createAccessApplicationOptionsModel = new CreateAccessApplicationOptions.Builder() + .zoneId("testString") + .name("mtls-test-app") + .domain("test.example.com") + .sessionDuration("24h") + .build(); + + // Invoke createAccessApplication() with a valid options model and verify the result + Response response = mtlsService.createAccessApplication(createAccessApplicationOptionsModel).execute(); + assertNotNull(response); + CreateAccessAppResp responseObj = 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, createAccessApplicationPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createAccessApplication operation with and without retries enabled + @Test + public void testCreateAccessApplicationWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testCreateAccessApplicationWOptions(); + + mtlsService.disableRetries(); + testCreateAccessApplicationWOptions(); + } + + // Test the createAccessApplication operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateAccessApplicationNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.createAccessApplication(null).execute(); + } + + // Test the getAccessApplication operation with a valid options model parameter + @Test + public void testGetAccessApplicationWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"de4526d6-d125-4f95-906f-1757510a9cd8\", \"name\": \"mtls-test-app\", \"domain\": \"test.example.com\", \"aud\": \"f8e1744453ea3679d919fdc6db58cff648f2b14b33a729f780fc02e75a42a008\", \"policies\": [{\"id\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"name\": \"mtls-test-policy\", \"decision\": \"non_identity\", \"include\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"exclude\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"precedence\": 1, \"require\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"uid\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"created_at\": \"2021-04-19T08:01:21Z\", \"updated_at\": \"2021-04-19T08:01:21Z\"}], \"allowed_idps\": [\"699d98642c564d2e855e9661899b7252\"], \"auto_redirect_to_identity\": false, \"session_duration\": \"24h\", \"type\": \"self_hosted\", \"uid\": \"de4526d6-d125-4f95-906f-1757510a9cd8\", \"created_at\": \"2021-04-19T07:59:49Z\", \"updated_at\": \"2021-04-19T07:59:49Z\"}}"; + String getAccessApplicationPath = "/v1/testString/zones/testString/access/apps/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetAccessApplicationOptions model + GetAccessApplicationOptions getAccessApplicationOptionsModel = new GetAccessApplicationOptions.Builder() + .zoneId("testString") + .appId("testString") + .build(); + + // Invoke getAccessApplication() with a valid options model and verify the result + Response response = mtlsService.getAccessApplication(getAccessApplicationOptionsModel).execute(); + assertNotNull(response); + AccessAppResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getAccessApplicationPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getAccessApplication operation with and without retries enabled + @Test + public void testGetAccessApplicationWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testGetAccessApplicationWOptions(); + + mtlsService.disableRetries(); + testGetAccessApplicationWOptions(); + } + + // Test the getAccessApplication operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccessApplicationNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.getAccessApplication(null).execute(); + } + + // Test the updateAccessApplication operation with a valid options model parameter + @Test + public void testUpdateAccessApplicationWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"de4526d6-d125-4f95-906f-1757510a9cd8\", \"name\": \"mtls-test-app\", \"domain\": \"test.example.com\", \"aud\": \"f8e1744453ea3679d919fdc6db58cff648f2b14b33a729f780fc02e75a42a008\", \"policies\": [{\"id\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"name\": \"mtls-test-policy\", \"decision\": \"non_identity\", \"include\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"exclude\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"precedence\": 1, \"require\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"uid\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"created_at\": \"2021-04-19T08:01:21Z\", \"updated_at\": \"2021-04-19T08:01:21Z\"}], \"allowed_idps\": [\"699d98642c564d2e855e9661899b7252\"], \"auto_redirect_to_identity\": false, \"session_duration\": \"24h\", \"type\": \"self_hosted\", \"uid\": \"de4526d6-d125-4f95-906f-1757510a9cd8\", \"created_at\": \"2021-04-19T07:59:49Z\", \"updated_at\": \"2021-04-19T07:59:49Z\"}}"; + String updateAccessApplicationPath = "/v1/testString/zones/testString/access/apps/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateAccessApplicationOptions model + UpdateAccessApplicationOptions updateAccessApplicationOptionsModel = new UpdateAccessApplicationOptions.Builder() + .zoneId("testString") + .appId("testString") + .name("mtls-test-app") + .domain("test.example.com") + .sessionDuration("24h") + .build(); + + // Invoke updateAccessApplication() with a valid options model and verify the result + Response response = mtlsService.updateAccessApplication(updateAccessApplicationOptionsModel).execute(); + assertNotNull(response); + AccessAppResp responseObj = 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, updateAccessApplicationPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateAccessApplication operation with and without retries enabled + @Test + public void testUpdateAccessApplicationWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testUpdateAccessApplicationWOptions(); + + mtlsService.disableRetries(); + testUpdateAccessApplicationWOptions(); + } + + // Test the updateAccessApplication operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccessApplicationNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.updateAccessApplication(null).execute(); + } + + // Test the deleteAccessApplication operation with a valid options model parameter + @Test + public void testDeleteAccessApplicationWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"de4526d6-d125-4f95-906f-1757510a9cd8\"}}"; + String deleteAccessApplicationPath = "/v1/testString/zones/testString/access/apps/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteAccessApplicationOptions model + DeleteAccessApplicationOptions deleteAccessApplicationOptionsModel = new DeleteAccessApplicationOptions.Builder() + .zoneId("testString") + .appId("testString") + .build(); + + // Invoke deleteAccessApplication() with a valid options model and verify the result + Response response = mtlsService.deleteAccessApplication(deleteAccessApplicationOptionsModel).execute(); + assertNotNull(response); + DeleteAccessAppResp responseObj = 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, deleteAccessApplicationPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteAccessApplication operation with and without retries enabled + @Test + public void testDeleteAccessApplicationWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testDeleteAccessApplicationWOptions(); + + mtlsService.disableRetries(); + testDeleteAccessApplicationWOptions(); + } + + // Test the deleteAccessApplication operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteAccessApplicationNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.deleteAccessApplication(null).execute(); + } + + // Test the listAccessPolicies operation with a valid options model parameter + @Test + public void testListAccessPoliciesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": [{\"id\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"name\": \"mtls-test-policy\", \"decision\": \"non_identity\", \"include\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"exclude\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"precedence\": 1, \"require\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"uid\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"created_at\": \"2021-04-19T08:01:21Z\", \"updated_at\": \"2021-04-19T08:01:21Z\"}]}"; + String listAccessPoliciesPath = "/v1/testString/zones/testString/access/apps/testString/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListAccessPoliciesOptions model + ListAccessPoliciesOptions listAccessPoliciesOptionsModel = new ListAccessPoliciesOptions.Builder() + .zoneId("testString") + .appId("testString") + .build(); + + // Invoke listAccessPolicies() with a valid options model and verify the result + Response response = mtlsService.listAccessPolicies(listAccessPoliciesOptionsModel).execute(); + assertNotNull(response); + ListAccessPoliciesResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, listAccessPoliciesPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the listAccessPolicies operation with and without retries enabled + @Test + public void testListAccessPoliciesWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testListAccessPoliciesWOptions(); + + mtlsService.disableRetries(); + testListAccessPoliciesWOptions(); + } + + // Test the listAccessPolicies operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListAccessPoliciesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.listAccessPolicies(null).execute(); + } + + // Test the createAccessPolicy operation with a valid options model parameter + @Test + public void testCreateAccessPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"name\": \"mtls-test-policy\", \"decision\": \"non_identity\", \"include\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"exclude\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"precedence\": 1, \"require\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"uid\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"created_at\": \"2021-04-19T08:01:21Z\", \"updated_at\": \"2021-04-19T08:01:21Z\"}}"; + String createAccessPolicyPath = "/v1/testString/zones/testString/access/apps/testString/policies"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the PolicyRulePolicyCertRule model + PolicyRulePolicyCertRule policyRuleModel = new PolicyRulePolicyCertRule.Builder() + .certificate(java.util.Collections.singletonMap("anyKey", "anyValue")) + .build(); + + // Construct an instance of the CreateAccessPolicyOptions model + CreateAccessPolicyOptions createAccessPolicyOptionsModel = new CreateAccessPolicyOptions.Builder() + .zoneId("testString") + .appId("testString") + .name("mtls-test-policy") + .decision("non_identity") + .include(java.util.Arrays.asList(policyRuleModel)) + .build(); + + // Invoke createAccessPolicy() with a valid options model and verify the result + Response response = mtlsService.createAccessPolicy(createAccessPolicyOptionsModel).execute(); + assertNotNull(response); + AccessPolicyResp responseObj = 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, createAccessPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createAccessPolicy operation with and without retries enabled + @Test + public void testCreateAccessPolicyWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testCreateAccessPolicyWOptions(); + + mtlsService.disableRetries(); + testCreateAccessPolicyWOptions(); + } + + // Test the createAccessPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateAccessPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.createAccessPolicy(null).execute(); + } + + // Test the getAccessPolicy operation with a valid options model parameter + @Test + public void testGetAccessPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"name\": \"mtls-test-policy\", \"decision\": \"non_identity\", \"include\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"exclude\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"precedence\": 1, \"require\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"uid\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"created_at\": \"2021-04-19T08:01:21Z\", \"updated_at\": \"2021-04-19T08:01:21Z\"}}"; + String getAccessPolicyPath = "/v1/testString/zones/testString/access/apps/testString/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetAccessPolicyOptions model + GetAccessPolicyOptions getAccessPolicyOptionsModel = new GetAccessPolicyOptions.Builder() + .zoneId("testString") + .appId("testString") + .policyId("testString") + .build(); + + // Invoke getAccessPolicy() with a valid options model and verify the result + Response response = mtlsService.getAccessPolicy(getAccessPolicyOptionsModel).execute(); + assertNotNull(response); + AccessPolicyResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getAccessPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getAccessPolicy operation with and without retries enabled + @Test + public void testGetAccessPolicyWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testGetAccessPolicyWOptions(); + + mtlsService.disableRetries(); + testGetAccessPolicyWOptions(); + } + + // Test the getAccessPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccessPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.getAccessPolicy(null).execute(); + } + + // Test the updateAccessPolicy operation with a valid options model parameter + @Test + public void testUpdateAccessPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"name\": \"mtls-test-policy\", \"decision\": \"non_identity\", \"include\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"exclude\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"precedence\": 1, \"require\": [{\"certificate\": {\"anyKey\": \"anyValue\"}}], \"uid\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\", \"created_at\": \"2021-04-19T08:01:21Z\", \"updated_at\": \"2021-04-19T08:01:21Z\"}}"; + String updateAccessPolicyPath = "/v1/testString/zones/testString/access/apps/testString/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the PolicyRulePolicyCertRule model + PolicyRulePolicyCertRule policyRuleModel = new PolicyRulePolicyCertRule.Builder() + .certificate(java.util.Collections.singletonMap("anyKey", "anyValue")) + .build(); + + // Construct an instance of the UpdateAccessPolicyOptions model + UpdateAccessPolicyOptions updateAccessPolicyOptionsModel = new UpdateAccessPolicyOptions.Builder() + .zoneId("testString") + .appId("testString") + .policyId("testString") + .name("mtls-test-policy") + .decision("non_identity") + .include(java.util.Arrays.asList(policyRuleModel)) + .build(); + + // Invoke updateAccessPolicy() with a valid options model and verify the result + Response response = mtlsService.updateAccessPolicy(updateAccessPolicyOptionsModel).execute(); + assertNotNull(response); + AccessPolicyResp responseObj = 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, updateAccessPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateAccessPolicy operation with and without retries enabled + @Test + public void testUpdateAccessPolicyWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testUpdateAccessPolicyWOptions(); + + mtlsService.disableRetries(); + testUpdateAccessPolicyWOptions(); + } + + // Test the updateAccessPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccessPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.updateAccessPolicy(null).execute(); + } + + // Test the deleteAccessPolicy operation with a valid options model parameter + @Test + public void testDeleteAccessPolicyWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": \"acabcdb1-afb3-4f61-9dae-d1a353a93661\"}}"; + String deleteAccessPolicyPath = "/v1/testString/zones/testString/access/apps/testString/policies/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteAccessPolicyOptions model + DeleteAccessPolicyOptions deleteAccessPolicyOptionsModel = new DeleteAccessPolicyOptions.Builder() + .zoneId("testString") + .appId("testString") + .policyId("testString") + .build(); + + // Invoke deleteAccessPolicy() with a valid options model and verify the result + Response response = mtlsService.deleteAccessPolicy(deleteAccessPolicyOptionsModel).execute(); + assertNotNull(response); + DeleteAccessPolicyResp responseObj = 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, deleteAccessPolicyPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteAccessPolicy operation with and without retries enabled + @Test + public void testDeleteAccessPolicyWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testDeleteAccessPolicyWOptions(); + + mtlsService.disableRetries(); + testDeleteAccessPolicyWOptions(); + } + + // Test the deleteAccessPolicy operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteAccessPolicyNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.deleteAccessPolicy(null).execute(); + } + + // Test the getAccessCertSettings operation with a valid options model parameter + @Test + public void testGetAccessCertSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": [{\"hostname\": \"test.example.com\", \"china_network\": false, \"client_certificate_forwarding\": true}]}"; + String getAccessCertSettingsPath = "/v1/testString/zones/testString/access/certificates/settings"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetAccessCertSettingsOptions model + GetAccessCertSettingsOptions getAccessCertSettingsOptionsModel = new GetAccessCertSettingsOptions.Builder() + .zoneId("testString") + .build(); + + // Invoke getAccessCertSettings() with a valid options model and verify the result + Response response = mtlsService.getAccessCertSettings(getAccessCertSettingsOptionsModel).execute(); + assertNotNull(response); + AccessCertSettingsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getAccessCertSettingsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getAccessCertSettings operation with and without retries enabled + @Test + public void testGetAccessCertSettingsWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testGetAccessCertSettingsWOptions(); + + mtlsService.disableRetries(); + testGetAccessCertSettingsWOptions(); + } + + // Test the getAccessCertSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccessCertSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.getAccessCertSettings(null).execute(); + } + + // Test the updateAccessCertSettings operation with a valid options model parameter + @Test + public void testUpdateAccessCertSettingsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": [{\"hostname\": \"test.example.com\", \"china_network\": false, \"client_certificate_forwarding\": true}]}"; + String updateAccessCertSettingsPath = "/v1/testString/zones/testString/access/certificates/settings"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the AccessCertSettingsInputArray model + AccessCertSettingsInputArray accessCertSettingsInputArrayModel = new AccessCertSettingsInputArray.Builder() + .hostname("test.example.com") + .clientCertificateForwarding(true) + .build(); + + // Construct an instance of the UpdateAccessCertSettingsOptions model + UpdateAccessCertSettingsOptions updateAccessCertSettingsOptionsModel = new UpdateAccessCertSettingsOptions.Builder() + .zoneId("testString") + .settings(java.util.Arrays.asList(accessCertSettingsInputArrayModel)) + .build(); + + // Invoke updateAccessCertSettings() with a valid options model and verify the result + Response response = mtlsService.updateAccessCertSettings(updateAccessCertSettingsOptionsModel).execute(); + assertNotNull(response); + AccessCertSettingsResp responseObj = 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, updateAccessCertSettingsPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateAccessCertSettings operation with and without retries enabled + @Test + public void testUpdateAccessCertSettingsWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testUpdateAccessCertSettingsWOptions(); + + mtlsService.disableRetries(); + testUpdateAccessCertSettingsWOptions(); + } + + // Test the updateAccessCertSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccessCertSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + mtlsService.updateAccessCertSettings(null).execute(); + } + + // Test the createAccessOrganization operation with a valid options model parameter + @Test + public void testCreateAccessOrganizationWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"auth_domain\": \"01652b251c3ae2787110a995d8db0135.cloudflareaccess.com\", \"name\": \"MTLS enabled\", \"login_design\": {\"anyKey\": \"anyValue\"}, \"created_at\": \"2019-08-13T16:31:42Z\", \"updated_at\": \"2019-08-13T16:31:42Z\"}}"; + String createAccessOrganizationPath = "/v1/testString/access/organizations"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateAccessOrganizationOptions model + CreateAccessOrganizationOptions createAccessOrganizationOptionsModel = new CreateAccessOrganizationOptions.Builder() + .name("MTLS enabled") + .authDomain("01652b251c3ae2787110a995d8db0135.cloudflareaccess.com") + .build(); + + // Invoke createAccessOrganization() with a valid options model and verify the result + Response response = mtlsService.createAccessOrganization(createAccessOrganizationOptionsModel).execute(); + assertNotNull(response); + AccessOrgResp responseObj = 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, createAccessOrganizationPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createAccessOrganization operation with and without retries enabled + @Test + public void testCreateAccessOrganizationWRetries() throws Throwable { + mtlsService.enableRetries(4, 30); + testCreateAccessOrganizationWOptions(); + + mtlsService.disableRetries(); + testCreateAccessOrganizationWOptions(); + } + + // 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(); + mtlsService = 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"; + + mtlsService = Mtls.newInstance(crn, serviceName); + String url = server.url("/").toString(); + mtlsService.setServiceUrl(url); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessAppRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessAppRespTest.java new file mode 100644 index 000000000..2008c42cc --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessAppRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AccessAppResp; +import com.ibm.cloud.networking.mtls.v1.model.AppResult; +import com.ibm.cloud.networking.mtls.v1.model.PolicyResult; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the AccessAppResp model. + */ +public class AccessAppRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccessAppResp() throws Throwable { + AccessAppResp accessAppRespModel = new AccessAppResp(); + assertNull(accessAppRespModel.isSuccess()); + assertNull(accessAppRespModel.getErrors()); + assertNull(accessAppRespModel.getMessages()); + assertNull(accessAppRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertRespTest.java new file mode 100644 index 000000000..bc9b6ee81 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AccessCertResp; +import com.ibm.cloud.networking.mtls.v1.model.CertResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the AccessCertResp model. + */ +public class AccessCertRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccessCertResp() throws Throwable { + AccessCertResp accessCertRespModel = new AccessCertResp(); + assertNull(accessCertRespModel.isSuccess()); + assertNull(accessCertRespModel.getErrors()); + assertNull(accessCertRespModel.getMessages()); + assertNull(accessCertRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsInputArrayTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsInputArrayTest.java new file mode 100644 index 000000000..abc3cdad8 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsInputArrayTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AccessCertSettingsInputArray; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the AccessCertSettingsInputArray model. + */ +public class AccessCertSettingsInputArrayTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccessCertSettingsInputArray() throws Throwable { + AccessCertSettingsInputArray accessCertSettingsInputArrayModel = new AccessCertSettingsInputArray.Builder() + .hostname("test.example.com") + .clientCertificateForwarding(true) + .build(); + assertEquals(accessCertSettingsInputArrayModel.hostname(), "test.example.com"); + assertEquals(accessCertSettingsInputArrayModel.clientCertificateForwarding(), Boolean.valueOf(true)); + + String json = TestUtilities.serialize(accessCertSettingsInputArrayModel); + + AccessCertSettingsInputArray accessCertSettingsInputArrayModelNew = TestUtilities.deserialize(json, AccessCertSettingsInputArray.class); + assertTrue(accessCertSettingsInputArrayModelNew instanceof AccessCertSettingsInputArray); + assertEquals(accessCertSettingsInputArrayModelNew.hostname(), "test.example.com"); + assertEquals(accessCertSettingsInputArrayModelNew.clientCertificateForwarding(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAccessCertSettingsInputArrayError() throws Throwable { + new AccessCertSettingsInputArray.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsRespTest.java new file mode 100644 index 000000000..a780e42e4 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessCertSettingsRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AccessCertSettingsResp; +import com.ibm.cloud.networking.mtls.v1.model.CertSettingsResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the AccessCertSettingsResp model. + */ +public class AccessCertSettingsRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccessCertSettingsResp() throws Throwable { + AccessCertSettingsResp accessCertSettingsRespModel = new AccessCertSettingsResp(); + assertNull(accessCertSettingsRespModel.isSuccess()); + assertNull(accessCertSettingsRespModel.getErrors()); + assertNull(accessCertSettingsRespModel.getMessages()); + assertNull(accessCertSettingsRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespResultTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespResultTest.java new file mode 100644 index 000000000..ab54cd1d7 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespResultTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AccessOrgRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the AccessOrgRespResult model. + */ +public class AccessOrgRespResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccessOrgRespResult() throws Throwable { + AccessOrgRespResult accessOrgRespResultModel = new AccessOrgRespResult(); + assertNull(accessOrgRespResultModel.getAuthDomain()); + assertNull(accessOrgRespResultModel.getName()); + assertNull(accessOrgRespResultModel.getLoginDesign()); + assertNull(accessOrgRespResultModel.getCreatedAt()); + assertNull(accessOrgRespResultModel.getUpdatedAt()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespTest.java new file mode 100644 index 000000000..0beb9b592 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessOrgRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AccessOrgResp; +import com.ibm.cloud.networking.mtls.v1.model.AccessOrgRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the AccessOrgResp model. + */ +public class AccessOrgRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccessOrgResp() throws Throwable { + AccessOrgResp accessOrgRespModel = new AccessOrgResp(); + assertNull(accessOrgRespModel.isSuccess()); + assertNull(accessOrgRespModel.getErrors()); + assertNull(accessOrgRespModel.getMessages()); + assertNull(accessOrgRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessPolicyRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessPolicyRespTest.java new file mode 100644 index 000000000..8c5d41ed4 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AccessPolicyRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AccessPolicyResp; +import com.ibm.cloud.networking.mtls.v1.model.PolicyResult; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the AccessPolicyResp model. + */ +public class AccessPolicyRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAccessPolicyResp() throws Throwable { + AccessPolicyResp accessPolicyRespModel = new AccessPolicyResp(); + assertNull(accessPolicyRespModel.isSuccess()); + assertNull(accessPolicyRespModel.getErrors()); + assertNull(accessPolicyRespModel.getMessages()); + assertNull(accessPolicyRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AppResultTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AppResultTest.java new file mode 100644 index 000000000..858b40c38 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/AppResultTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AppResult; +import com.ibm.cloud.networking.mtls.v1.model.PolicyResult; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the AppResult model. + */ +public class AppResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAppResult() throws Throwable { + AppResult appResultModel = new AppResult(); + assertNull(appResultModel.getId()); + assertNull(appResultModel.getName()); + assertNull(appResultModel.getDomain()); + assertNull(appResultModel.getAud()); + assertNull(appResultModel.getPolicies()); + assertNull(appResultModel.getAllowedIdps()); + assertNull(appResultModel.isAutoRedirectToIdentity()); + assertNull(appResultModel.getSessionDuration()); + assertNull(appResultModel.getType()); + assertNull(appResultModel.getUid()); + assertNull(appResultModel.getCreatedAt()); + assertNull(appResultModel.getUpdatedAt()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CertResultTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CertResultTest.java new file mode 100644 index 000000000..fd6bad528 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CertResultTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.CertResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CertResult model. + */ +public class CertResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCertResult() throws Throwable { + CertResult certResultModel = new CertResult(); + assertNull(certResultModel.getId()); + assertNull(certResultModel.getName()); + assertNull(certResultModel.getFingerprint()); + assertNull(certResultModel.getAssociatedHostnames()); + assertNull(certResultModel.getCreatedAt()); + assertNull(certResultModel.getUpdatedAt()); + assertNull(certResultModel.getExpiresOn()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CertSettingsResultTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CertSettingsResultTest.java new file mode 100644 index 000000000..c47ceb6fe --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CertSettingsResultTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.CertSettingsResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CertSettingsResult model. + */ +public class CertSettingsResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCertSettingsResult() throws Throwable { + CertSettingsResult certSettingsResultModel = new CertSettingsResult(); + assertNull(certSettingsResultModel.getHostname()); + assertNull(certSettingsResultModel.isChinaNetwork()); + assertNull(certSettingsResultModel.isClientCertificateForwarding()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespResultTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespResultTest.java new file mode 100644 index 000000000..0e9f3a86e --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespResultTest.java @@ -0,0 +1,48 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessAppRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateAccessAppRespResult model. + */ +public class CreateAccessAppRespResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateAccessAppRespResult() throws Throwable { + CreateAccessAppRespResult createAccessAppRespResultModel = new CreateAccessAppRespResult(); + assertNull(createAccessAppRespResultModel.getId()); + assertNull(createAccessAppRespResultModel.getName()); + assertNull(createAccessAppRespResultModel.getDomain()); + assertNull(createAccessAppRespResultModel.getAud()); + assertNull(createAccessAppRespResultModel.getPolicies()); + assertNull(createAccessAppRespResultModel.getAllowedIdps()); + assertNull(createAccessAppRespResultModel.isAutoRedirectToIdentity()); + assertNull(createAccessAppRespResultModel.getSessionDuration()); + assertNull(createAccessAppRespResultModel.getType()); + assertNull(createAccessAppRespResultModel.getUid()); + assertNull(createAccessAppRespResultModel.getCreatedAt()); + assertNull(createAccessAppRespResultModel.getUpdatedAt()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespTest.java new file mode 100644 index 000000000..7a610dabc --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessAppRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessAppResp; +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessAppRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateAccessAppResp model. + */ +public class CreateAccessAppRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateAccessAppResp() throws Throwable { + CreateAccessAppResp createAccessAppRespModel = new CreateAccessAppResp(); + assertNull(createAccessAppRespModel.isSuccess()); + assertNull(createAccessAppRespModel.getErrors()); + assertNull(createAccessAppRespModel.getMessages()); + assertNull(createAccessAppRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessApplicationOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessApplicationOptionsTest.java new file mode 100644 index 000000000..fc19434a1 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessApplicationOptionsTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateAccessApplicationOptions model. + */ +public class CreateAccessApplicationOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateAccessApplicationOptions() throws Throwable { + CreateAccessApplicationOptions createAccessApplicationOptionsModel = new CreateAccessApplicationOptions.Builder() + .zoneId("testString") + .name("mtls-test-app") + .domain("test.example.com") + .sessionDuration("24h") + .build(); + assertEquals(createAccessApplicationOptionsModel.zoneId(), "testString"); + assertEquals(createAccessApplicationOptionsModel.name(), "mtls-test-app"); + assertEquals(createAccessApplicationOptionsModel.domain(), "test.example.com"); + assertEquals(createAccessApplicationOptionsModel.sessionDuration(), "24h"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateAccessApplicationOptionsError() throws Throwable { + new CreateAccessApplicationOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessCertificateOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessCertificateOptionsTest.java new file mode 100644 index 000000000..f3fda054e --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessCertificateOptionsTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateAccessCertificateOptions model. + */ +public class CreateAccessCertificateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateAccessCertificateOptions() throws Throwable { + CreateAccessCertificateOptions createAccessCertificateOptionsModel = new CreateAccessCertificateOptions.Builder() + .zoneId("testString") + .name("test-cert") + .certificate("-----BEGIN CERTIFICATE-----\nMIIGAjCCA+qgAwIBAgIJAI7kymlF7CWT...N4RI7KKB7nikiuUf8vhULKy5IX10\nDrUtmu/B\n-----END CERTIFICATE-----") + .associatedHostnames(java.util.Arrays.asList("test.example.com")) + .build(); + assertEquals(createAccessCertificateOptionsModel.zoneId(), "testString"); + assertEquals(createAccessCertificateOptionsModel.name(), "test-cert"); + assertEquals(createAccessCertificateOptionsModel.certificate(), "-----BEGIN CERTIFICATE-----\nMIIGAjCCA+qgAwIBAgIJAI7kymlF7CWT...N4RI7KKB7nikiuUf8vhULKy5IX10\nDrUtmu/B\n-----END CERTIFICATE-----"); + assertEquals(createAccessCertificateOptionsModel.associatedHostnames(), java.util.Arrays.asList("test.example.com")); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateAccessCertificateOptionsError() throws Throwable { + new CreateAccessCertificateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessOrganizationOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessOrganizationOptionsTest.java new file mode 100644 index 000000000..4a94866e9 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessOrganizationOptionsTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessOrganizationOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateAccessOrganizationOptions model. + */ +public class CreateAccessOrganizationOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateAccessOrganizationOptions() throws Throwable { + CreateAccessOrganizationOptions createAccessOrganizationOptionsModel = new CreateAccessOrganizationOptions.Builder() + .name("MTLS enabled") + .authDomain("01652b251c3ae2787110a995d8db0135.cloudflareaccess.com") + .build(); + assertEquals(createAccessOrganizationOptionsModel.name(), "MTLS enabled"); + assertEquals(createAccessOrganizationOptionsModel.authDomain(), "01652b251c3ae2787110a995d8db0135.cloudflareaccess.com"); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessPolicyOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessPolicyOptionsTest.java new file mode 100644 index 000000000..8b9088c1d --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/CreateAccessPolicyOptionsTest.java @@ -0,0 +1,59 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.CreateAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateAccessPolicyOptions model. + */ +public class CreateAccessPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateAccessPolicyOptions() throws Throwable { + PolicyRulePolicyCertRule policyRuleModel = new PolicyRulePolicyCertRule.Builder() + .certificate(java.util.Collections.singletonMap("anyKey", "anyValue")) + .build(); + assertEquals(policyRuleModel.certificate(), java.util.Collections.singletonMap("anyKey", "anyValue")); + + CreateAccessPolicyOptions createAccessPolicyOptionsModel = new CreateAccessPolicyOptions.Builder() + .zoneId("testString") + .appId("testString") + .name("mtls-test-policy") + .decision("non_identity") + .include(java.util.Arrays.asList(policyRuleModel)) + .build(); + assertEquals(createAccessPolicyOptionsModel.zoneId(), "testString"); + assertEquals(createAccessPolicyOptionsModel.appId(), "testString"); + assertEquals(createAccessPolicyOptionsModel.name(), "mtls-test-policy"); + assertEquals(createAccessPolicyOptionsModel.decision(), "non_identity"); + assertEquals(createAccessPolicyOptionsModel.include(), java.util.Arrays.asList(policyRuleModel)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateAccessPolicyOptionsError() throws Throwable { + new CreateAccessPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespResultTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespResultTest.java new file mode 100644 index 000000000..5cecaac35 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespResultTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessAppRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteAccessAppRespResult model. + */ +public class DeleteAccessAppRespResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteAccessAppRespResult() throws Throwable { + DeleteAccessAppRespResult deleteAccessAppRespResultModel = new DeleteAccessAppRespResult(); + assertNull(deleteAccessAppRespResultModel.getId()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespTest.java new file mode 100644 index 000000000..235baed83 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessAppRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessAppResp; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessAppRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteAccessAppResp model. + */ +public class DeleteAccessAppRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteAccessAppResp() throws Throwable { + DeleteAccessAppResp deleteAccessAppRespModel = new DeleteAccessAppResp(); + assertNull(deleteAccessAppRespModel.isSuccess()); + assertNull(deleteAccessAppRespModel.getErrors()); + assertNull(deleteAccessAppRespModel.getMessages()); + assertNull(deleteAccessAppRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessApplicationOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessApplicationOptionsTest.java new file mode 100644 index 000000000..a1b24f914 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessApplicationOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteAccessApplicationOptions model. + */ +public class DeleteAccessApplicationOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteAccessApplicationOptions() throws Throwable { + DeleteAccessApplicationOptions deleteAccessApplicationOptionsModel = new DeleteAccessApplicationOptions.Builder() + .zoneId("testString") + .appId("testString") + .build(); + assertEquals(deleteAccessApplicationOptionsModel.zoneId(), "testString"); + assertEquals(deleteAccessApplicationOptionsModel.appId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteAccessApplicationOptionsError() throws Throwable { + new DeleteAccessApplicationOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespResultTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespResultTest.java new file mode 100644 index 000000000..f68479614 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespResultTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessCertRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteAccessCertRespResult model. + */ +public class DeleteAccessCertRespResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteAccessCertRespResult() throws Throwable { + DeleteAccessCertRespResult deleteAccessCertRespResultModel = new DeleteAccessCertRespResult(); + assertNull(deleteAccessCertRespResultModel.getId()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespTest.java new file mode 100644 index 000000000..fb96c65ac --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessCertResp; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessCertRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteAccessCertResp model. + */ +public class DeleteAccessCertRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteAccessCertResp() throws Throwable { + DeleteAccessCertResp deleteAccessCertRespModel = new DeleteAccessCertResp(); + assertNull(deleteAccessCertRespModel.isSuccess()); + assertNull(deleteAccessCertRespModel.getErrors()); + assertNull(deleteAccessCertRespModel.getMessages()); + assertNull(deleteAccessCertRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertificateOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertificateOptionsTest.java new file mode 100644 index 000000000..a116dd6f3 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessCertificateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteAccessCertificateOptions model. + */ +public class DeleteAccessCertificateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteAccessCertificateOptions() throws Throwable { + DeleteAccessCertificateOptions deleteAccessCertificateOptionsModel = new DeleteAccessCertificateOptions.Builder() + .zoneId("testString") + .certId("testString") + .build(); + assertEquals(deleteAccessCertificateOptionsModel.zoneId(), "testString"); + assertEquals(deleteAccessCertificateOptionsModel.certId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteAccessCertificateOptionsError() throws Throwable { + new DeleteAccessCertificateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyOptionsTest.java new file mode 100644 index 000000000..75a99f95e --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyOptionsTest.java @@ -0,0 +1,49 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteAccessPolicyOptions model. + */ +public class DeleteAccessPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteAccessPolicyOptions() throws Throwable { + DeleteAccessPolicyOptions deleteAccessPolicyOptionsModel = new DeleteAccessPolicyOptions.Builder() + .zoneId("testString") + .appId("testString") + .policyId("testString") + .build(); + assertEquals(deleteAccessPolicyOptionsModel.zoneId(), "testString"); + assertEquals(deleteAccessPolicyOptionsModel.appId(), "testString"); + assertEquals(deleteAccessPolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteAccessPolicyOptionsError() throws Throwable { + new DeleteAccessPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespResultTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespResultTest.java new file mode 100644 index 000000000..692c4dd8b --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespResultTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessPolicyRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteAccessPolicyRespResult model. + */ +public class DeleteAccessPolicyRespResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteAccessPolicyRespResult() throws Throwable { + DeleteAccessPolicyRespResult deleteAccessPolicyRespResultModel = new DeleteAccessPolicyRespResult(); + assertNull(deleteAccessPolicyRespResultModel.getId()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespTest.java new file mode 100644 index 000000000..20f4628d2 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/DeleteAccessPolicyRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessPolicyResp; +import com.ibm.cloud.networking.mtls.v1.model.DeleteAccessPolicyRespResult; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteAccessPolicyResp model. + */ +public class DeleteAccessPolicyRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteAccessPolicyResp() throws Throwable { + DeleteAccessPolicyResp deleteAccessPolicyRespModel = new DeleteAccessPolicyResp(); + assertNull(deleteAccessPolicyRespModel.isSuccess()); + assertNull(deleteAccessPolicyRespModel.getErrors()); + assertNull(deleteAccessPolicyRespModel.getMessages()); + assertNull(deleteAccessPolicyRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessApplicationOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessApplicationOptionsTest.java new file mode 100644 index 000000000..0b122f0dc --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessApplicationOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.GetAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetAccessApplicationOptions model. + */ +public class GetAccessApplicationOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetAccessApplicationOptions() throws Throwable { + GetAccessApplicationOptions getAccessApplicationOptionsModel = new GetAccessApplicationOptions.Builder() + .zoneId("testString") + .appId("testString") + .build(); + assertEquals(getAccessApplicationOptionsModel.zoneId(), "testString"); + assertEquals(getAccessApplicationOptionsModel.appId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccessApplicationOptionsError() throws Throwable { + new GetAccessApplicationOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertSettingsOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertSettingsOptionsTest.java new file mode 100644 index 000000000..92a9e5e1e --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertSettingsOptionsTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.GetAccessCertSettingsOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetAccessCertSettingsOptions model. + */ +public class GetAccessCertSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetAccessCertSettingsOptions() throws Throwable { + GetAccessCertSettingsOptions getAccessCertSettingsOptionsModel = new GetAccessCertSettingsOptions.Builder() + .zoneId("testString") + .build(); + assertEquals(getAccessCertSettingsOptionsModel.zoneId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccessCertSettingsOptionsError() throws Throwable { + new GetAccessCertSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertificateOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertificateOptionsTest.java new file mode 100644 index 000000000..24766b1db --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessCertificateOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.GetAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetAccessCertificateOptions model. + */ +public class GetAccessCertificateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetAccessCertificateOptions() throws Throwable { + GetAccessCertificateOptions getAccessCertificateOptionsModel = new GetAccessCertificateOptions.Builder() + .zoneId("testString") + .certId("testString") + .build(); + assertEquals(getAccessCertificateOptionsModel.zoneId(), "testString"); + assertEquals(getAccessCertificateOptionsModel.certId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccessCertificateOptionsError() throws Throwable { + new GetAccessCertificateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessPolicyOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessPolicyOptionsTest.java new file mode 100644 index 000000000..7cc54c4c8 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/GetAccessPolicyOptionsTest.java @@ -0,0 +1,49 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.GetAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetAccessPolicyOptions model. + */ +public class GetAccessPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetAccessPolicyOptions() throws Throwable { + GetAccessPolicyOptions getAccessPolicyOptionsModel = new GetAccessPolicyOptions.Builder() + .zoneId("testString") + .appId("testString") + .policyId("testString") + .build(); + assertEquals(getAccessPolicyOptionsModel.zoneId(), "testString"); + assertEquals(getAccessPolicyOptionsModel.appId(), "testString"); + assertEquals(getAccessPolicyOptionsModel.policyId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetAccessPolicyOptionsError() throws Throwable { + new GetAccessPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessApplicationsOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessApplicationsOptionsTest.java new file mode 100644 index 000000000..fef634b50 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessApplicationsOptionsTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.ListAccessApplicationsOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListAccessApplicationsOptions model. + */ +public class ListAccessApplicationsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListAccessApplicationsOptions() throws Throwable { + ListAccessApplicationsOptions listAccessApplicationsOptionsModel = new ListAccessApplicationsOptions.Builder() + .zoneId("testString") + .build(); + assertEquals(listAccessApplicationsOptionsModel.zoneId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListAccessApplicationsOptionsError() throws Throwable { + new ListAccessApplicationsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessAppsRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessAppsRespTest.java new file mode 100644 index 000000000..507f723d3 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessAppsRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AppResult; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessAppsResp; +import com.ibm.cloud.networking.mtls.v1.model.PolicyResult; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListAccessAppsResp model. + */ +public class ListAccessAppsRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListAccessAppsResp() throws Throwable { + ListAccessAppsResp listAccessAppsRespModel = new ListAccessAppsResp(); + assertNull(listAccessAppsRespModel.isSuccess()); + assertNull(listAccessAppsRespModel.getErrors()); + assertNull(listAccessAppsRespModel.getMessages()); + assertNull(listAccessAppsRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertificatesOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertificatesOptionsTest.java new file mode 100644 index 000000000..706ef0232 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertificatesOptionsTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.ListAccessCertificatesOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListAccessCertificatesOptions model. + */ +public class ListAccessCertificatesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListAccessCertificatesOptions() throws Throwable { + ListAccessCertificatesOptions listAccessCertificatesOptionsModel = new ListAccessCertificatesOptions.Builder() + .zoneId("testString") + .build(); + assertEquals(listAccessCertificatesOptionsModel.zoneId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListAccessCertificatesOptionsError() throws Throwable { + new ListAccessCertificatesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertsRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertsRespTest.java new file mode 100644 index 000000000..03434daf1 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessCertsRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.CertResult; +import com.ibm.cloud.networking.mtls.v1.model.ListAccessCertsResp; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListAccessCertsResp model. + */ +public class ListAccessCertsRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListAccessCertsResp() throws Throwable { + ListAccessCertsResp listAccessCertsRespModel = new ListAccessCertsResp(); + assertNull(listAccessCertsRespModel.isSuccess()); + assertNull(listAccessCertsRespModel.getErrors()); + assertNull(listAccessCertsRespModel.getMessages()); + assertNull(listAccessCertsRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesOptionsTest.java new file mode 100644 index 000000000..a46b07288 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.ListAccessPoliciesOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListAccessPoliciesOptions model. + */ +public class ListAccessPoliciesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListAccessPoliciesOptions() throws Throwable { + ListAccessPoliciesOptions listAccessPoliciesOptionsModel = new ListAccessPoliciesOptions.Builder() + .zoneId("testString") + .appId("testString") + .build(); + assertEquals(listAccessPoliciesOptionsModel.zoneId(), "testString"); + assertEquals(listAccessPoliciesOptionsModel.appId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListAccessPoliciesOptionsError() throws Throwable { + new ListAccessPoliciesOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesRespTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesRespTest.java new file mode 100644 index 000000000..e4a45b8e6 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/ListAccessPoliciesRespTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.ListAccessPoliciesResp; +import com.ibm.cloud.networking.mtls.v1.model.PolicyResult; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListAccessPoliciesResp model. + */ +public class ListAccessPoliciesRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListAccessPoliciesResp() throws Throwable { + ListAccessPoliciesResp listAccessPoliciesRespModel = new ListAccessPoliciesResp(); + assertNull(listAccessPoliciesRespModel.isSuccess()); + assertNull(listAccessPoliciesRespModel.getErrors()); + assertNull(listAccessPoliciesRespModel.getMessages()); + assertNull(listAccessPoliciesRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyCnRuleCommonNameTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyCnRuleCommonNameTest.java new file mode 100644 index 000000000..9320a4785 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyCnRuleCommonNameTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.PolicyCnRuleCommonName; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the PolicyCnRuleCommonName model. + */ +public class PolicyCnRuleCommonNameTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyCnRuleCommonName() throws Throwable { + PolicyCnRuleCommonName policyCnRuleCommonNameModel = new PolicyCnRuleCommonName.Builder() + .commonName("Access Testing CA") + .build(); + assertEquals(policyCnRuleCommonNameModel.commonName(), "Access Testing CA"); + + String json = TestUtilities.serialize(policyCnRuleCommonNameModel); + + PolicyCnRuleCommonName policyCnRuleCommonNameModelNew = TestUtilities.deserialize(json, PolicyCnRuleCommonName.class); + assertTrue(policyCnRuleCommonNameModelNew instanceof PolicyCnRuleCommonName); + assertEquals(policyCnRuleCommonNameModelNew.commonName(), "Access Testing CA"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyCnRuleCommonNameError() throws Throwable { + new PolicyCnRuleCommonName.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyResultTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyResultTest.java new file mode 100644 index 000000000..39d5f6238 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyResultTest.java @@ -0,0 +1,47 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.PolicyResult; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the PolicyResult model. + */ +public class PolicyResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyResult() throws Throwable { + PolicyResult policyResultModel = new PolicyResult(); + assertNull(policyResultModel.getId()); + assertNull(policyResultModel.getName()); + assertNull(policyResultModel.getDecision()); + assertNull(policyResultModel.getInclude()); + assertNull(policyResultModel.getExclude()); + assertNull(policyResultModel.getPrecedence()); + assertNull(policyResultModel.getRequire()); + assertNull(policyResultModel.getUid()); + assertNull(policyResultModel.getCreatedAt()); + assertNull(policyResultModel.getUpdatedAt()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCertRuleTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCertRuleTest.java new file mode 100644 index 000000000..84b3ae87d --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCertRuleTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the PolicyRulePolicyCertRule model. + */ +public class PolicyRulePolicyCertRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyRulePolicyCertRule() throws Throwable { + PolicyRulePolicyCertRule policyRulePolicyCertRuleModel = new PolicyRulePolicyCertRule.Builder() + .certificate(java.util.Collections.singletonMap("anyKey", "anyValue")) + .build(); + assertEquals(policyRulePolicyCertRuleModel.certificate(), java.util.Collections.singletonMap("anyKey", "anyValue")); + + String json = TestUtilities.serialize(policyRulePolicyCertRuleModel); + + PolicyRulePolicyCertRule policyRulePolicyCertRuleModelNew = TestUtilities.deserialize(json, PolicyRulePolicyCertRule.class); + assertTrue(policyRulePolicyCertRuleModelNew instanceof PolicyRulePolicyCertRule); + assertEquals(policyRulePolicyCertRuleModelNew.certificate().toString(), java.util.Collections.singletonMap("anyKey", "anyValue").toString()); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCnRuleTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCnRuleTest.java new file mode 100644 index 000000000..93943246e --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRulePolicyCnRuleTest.java @@ -0,0 +1,57 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.PolicyCnRuleCommonName; +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCnRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the PolicyRulePolicyCnRule model. + */ +public class PolicyRulePolicyCnRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testPolicyRulePolicyCnRule() throws Throwable { + PolicyCnRuleCommonName policyCnRuleCommonNameModel = new PolicyCnRuleCommonName.Builder() + .commonName("Access Testing CA") + .build(); + assertEquals(policyCnRuleCommonNameModel.commonName(), "Access Testing CA"); + + PolicyRulePolicyCnRule policyRulePolicyCnRuleModel = new PolicyRulePolicyCnRule.Builder() + .commonName(policyCnRuleCommonNameModel) + .build(); + assertEquals(policyRulePolicyCnRuleModel.commonName(), policyCnRuleCommonNameModel); + + String json = TestUtilities.serialize(policyRulePolicyCnRuleModel); + + PolicyRulePolicyCnRule policyRulePolicyCnRuleModelNew = TestUtilities.deserialize(json, PolicyRulePolicyCnRule.class); + assertTrue(policyRulePolicyCnRuleModelNew instanceof PolicyRulePolicyCnRule); + assertEquals(policyRulePolicyCnRuleModelNew.commonName().toString(), policyCnRuleCommonNameModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPolicyRulePolicyCnRuleError() throws Throwable { + new PolicyRulePolicyCnRule.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRuleTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRuleTest.java new file mode 100644 index 000000000..a7a41f1a3 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/PolicyRuleTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.PolicyRule; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the PolicyRule model. + */ +public class PolicyRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testPolicyRule() throws Throwable { + PolicyRule policyRuleModel = new PolicyRule(); + assertNotNull(policyRuleModel); + } +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessApplicationOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessApplicationOptionsTest.java new file mode 100644 index 000000000..573dfbb46 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessApplicationOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessApplicationOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateAccessApplicationOptions model. + */ +public class UpdateAccessApplicationOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateAccessApplicationOptions() throws Throwable { + UpdateAccessApplicationOptions updateAccessApplicationOptionsModel = new UpdateAccessApplicationOptions.Builder() + .zoneId("testString") + .appId("testString") + .name("mtls-test-app") + .domain("test.example.com") + .sessionDuration("24h") + .build(); + assertEquals(updateAccessApplicationOptionsModel.zoneId(), "testString"); + assertEquals(updateAccessApplicationOptionsModel.appId(), "testString"); + assertEquals(updateAccessApplicationOptionsModel.name(), "mtls-test-app"); + assertEquals(updateAccessApplicationOptionsModel.domain(), "test.example.com"); + assertEquals(updateAccessApplicationOptionsModel.sessionDuration(), "24h"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccessApplicationOptionsError() throws Throwable { + new UpdateAccessApplicationOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertSettingsOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertSettingsOptionsTest.java new file mode 100644 index 000000000..8f5de9316 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertSettingsOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.AccessCertSettingsInputArray; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessCertSettingsOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateAccessCertSettingsOptions model. + */ +public class UpdateAccessCertSettingsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateAccessCertSettingsOptions() throws Throwable { + AccessCertSettingsInputArray accessCertSettingsInputArrayModel = new AccessCertSettingsInputArray.Builder() + .hostname("test.example.com") + .clientCertificateForwarding(true) + .build(); + assertEquals(accessCertSettingsInputArrayModel.hostname(), "test.example.com"); + assertEquals(accessCertSettingsInputArrayModel.clientCertificateForwarding(), Boolean.valueOf(true)); + + UpdateAccessCertSettingsOptions updateAccessCertSettingsOptionsModel = new UpdateAccessCertSettingsOptions.Builder() + .zoneId("testString") + .settings(java.util.Arrays.asList(accessCertSettingsInputArrayModel)) + .build(); + assertEquals(updateAccessCertSettingsOptionsModel.zoneId(), "testString"); + assertEquals(updateAccessCertSettingsOptionsModel.settings(), java.util.Arrays.asList(accessCertSettingsInputArrayModel)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccessCertSettingsOptionsError() throws Throwable { + new UpdateAccessCertSettingsOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertificateOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertificateOptionsTest.java new file mode 100644 index 000000000..fc6cbd8e1 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessCertificateOptionsTest.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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessCertificateOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateAccessCertificateOptions model. + */ +public class UpdateAccessCertificateOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateAccessCertificateOptions() throws Throwable { + UpdateAccessCertificateOptions updateAccessCertificateOptionsModel = new UpdateAccessCertificateOptions.Builder() + .zoneId("testString") + .certId("testString") + .name("test-cert") + .associatedHostnames(java.util.Arrays.asList("test.example.com")) + .build(); + assertEquals(updateAccessCertificateOptionsModel.zoneId(), "testString"); + assertEquals(updateAccessCertificateOptionsModel.certId(), "testString"); + assertEquals(updateAccessCertificateOptionsModel.name(), "test-cert"); + assertEquals(updateAccessCertificateOptionsModel.associatedHostnames(), java.util.Arrays.asList("test.example.com")); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccessCertificateOptionsError() throws Throwable { + new UpdateAccessCertificateOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessPolicyOptionsTest.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessPolicyOptionsTest.java new file mode 100644 index 000000000..24f3fc543 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/model/UpdateAccessPolicyOptionsTest.java @@ -0,0 +1,61 @@ +/* + * (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.mtls.v1.model; + +import com.ibm.cloud.networking.mtls.v1.model.PolicyRulePolicyCertRule; +import com.ibm.cloud.networking.mtls.v1.model.UpdateAccessPolicyOptions; +import com.ibm.cloud.networking.mtls.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateAccessPolicyOptions model. + */ +public class UpdateAccessPolicyOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateAccessPolicyOptions() throws Throwable { + PolicyRulePolicyCertRule policyRuleModel = new PolicyRulePolicyCertRule.Builder() + .certificate(java.util.Collections.singletonMap("anyKey", "anyValue")) + .build(); + assertEquals(policyRuleModel.certificate(), java.util.Collections.singletonMap("anyKey", "anyValue")); + + UpdateAccessPolicyOptions updateAccessPolicyOptionsModel = new UpdateAccessPolicyOptions.Builder() + .zoneId("testString") + .appId("testString") + .policyId("testString") + .name("mtls-test-policy") + .decision("non_identity") + .include(java.util.Arrays.asList(policyRuleModel)) + .build(); + assertEquals(updateAccessPolicyOptionsModel.zoneId(), "testString"); + assertEquals(updateAccessPolicyOptionsModel.appId(), "testString"); + assertEquals(updateAccessPolicyOptionsModel.policyId(), "testString"); + assertEquals(updateAccessPolicyOptionsModel.name(), "mtls-test-policy"); + assertEquals(updateAccessPolicyOptionsModel.decision(), "non_identity"); + assertEquals(updateAccessPolicyOptionsModel.include(), java.util.Arrays.asList(policyRuleModel)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateAccessPolicyOptionsError() throws Throwable { + new UpdateAccessPolicyOptions.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/utils/TestUtilities.java b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/v1/utils/TestUtilities.java new file mode 100644 index 000000000..675bc1052 --- /dev/null +++ b/modules/mtls/src/test/java/com/ibm/cloud/networking/mtls/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.mtls.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