diff --git a/modules/logpush-jobs-api/pom.xml b/modules/logpush-jobs-api/pom.xml new file mode 100644 index 000000000..15f3faeec --- /dev/null +++ b/modules/logpush-jobs-api/pom.xml @@ -0,0 +1,60 @@ + + 4.0.0 + + + networking + com.ibm.cloud + 99-SNAPSHOT + ../.. + + + logpush-jobs-api + + Cloud Internet Services Logpush Jobs API + jar + + + + com.ibm.cloud + sdk-core + + + networking-common + ${project.groupId} + + + networking-common + ${project.groupId} + test-jar + tests + test + + + org.testng + testng + test + + + com.squareup.okhttp3 + mockwebserver + test + + + org.slf4j + slf4j-jdk14 + test + + + + + + IBM Cloud DevX SDK Development + devxsdk@us.ibm.com + https://www.ibm.com/ + + + + + + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/LogpushJobsApi.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/LogpushJobsApi.java new file mode 100644 index 000000000..9a672ae20 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/LogpushJobsApi.java @@ -0,0 +1,585 @@ +/* + * (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.logpush_jobs_api.v1; + +import com.google.gson.JsonObject; +import com.ibm.cloud.networking.common.SdkCommon; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogRetentionOptions; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.DeleteLogpushJobResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.DeleteLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogpushJobsV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogpushOwnershipV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogsRetentionOptions; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListFieldsForDatasetV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListFieldsResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListLogpushJobsForDatasetV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListLogpushJobsResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogRetentionResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobsResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.OwnershipChallengeResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.OwnershipChallengeValidateResult; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ValidateLogpushOwnershipChallengeV2Options; +import com.ibm.cloud.sdk.core.http.RequestBuilder; +import com.ibm.cloud.sdk.core.http.ResponseConverter; +import com.ibm.cloud.sdk.core.http.ServiceCall; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; +import com.ibm.cloud.sdk.core.service.BaseService; +import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * CIS Logpush Jobs. + * + * API Version: 1.0.0 + */ +public class LogpushJobsApi extends BaseService { + + /** + * Default service name used when configuring the `LogpushJobsApi` client. + */ + public static final String DEFAULT_SERVICE_NAME = "logpush_jobs_api"; + + /** + * Default service endpoint URL. + */ + public static final String DEFAULT_SERVICE_URL = "https://api.cis.cloud.ibm.com"; + + private String crn; + + private String dataset; + + private String zoneId; + + /** + * Class method which constructs an instance of the `LogpushJobsApi` client. + * The default service name is used to configure the client instance. + * + * @param crn Full URL-encoded CRN of the service instance. + * @param dataset The dataset. + * @param zoneId Zone identifier. + * @return an instance of the `LogpushJobsApi` client using external configuration + */ + public static LogpushJobsApi newInstance(String crn, String dataset, String zoneId) { + return newInstance(crn, dataset, zoneId, DEFAULT_SERVICE_NAME); + } + + /** + * Class method which constructs an instance of the `LogpushJobsApi` client. + * The specified service name is used to configure the client instance. + * + * @param crn Full URL-encoded CRN of the service instance. + * @param dataset The dataset. + * @param zoneId Zone identifier. + * @param serviceName the service name to be used when configuring the client instance + * @return an instance of the `LogpushJobsApi` client using external configuration + */ + public static LogpushJobsApi newInstance(String crn, String dataset, String zoneId, String serviceName) { + Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); + LogpushJobsApi service = new LogpushJobsApi(crn, dataset, zoneId, serviceName, authenticator); + service.configureService(serviceName); + return service; + } + + /** + * Constructs an instance of the `LogpushJobsApi` client. + * The specified service name and authenticator are used to configure the client instance. + * + * @param crn Full URL-encoded CRN of the service instance. + * @param dataset The dataset. + * @param zoneId Zone identifier. + * @param serviceName the service name to be used when configuring the client instance + * @param authenticator the {@link Authenticator} instance to be configured for this client + */ + public LogpushJobsApi(String crn, String dataset, String zoneId, String serviceName, Authenticator authenticator) { + super(serviceName, authenticator); + setServiceUrl(DEFAULT_SERVICE_URL); + setCrn(crn); + setDataset(dataset); + setZoneId(zoneId); + } + + /** + * Gets the crn. + * + * Full URL-encoded CRN of the service instance. + * + * @return the crn + */ + public String getCrn() { + return this.crn; + } + + /** + * Sets the crn. + * + * @param crn the new crn + */ + public void setCrn(final String crn) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(crn, "crn cannot be empty."); + this.crn = crn; + } + + /** + * Gets the dataset. + * + * The dataset. + * + * @return the dataset + */ + public String getDataset() { + return this.dataset; + } + + /** + * Sets the dataset. + * + * @param dataset the new dataset + */ + public void setDataset(final String dataset) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(dataset, "dataset cannot be empty."); + this.dataset = dataset; + } + + /** + * Gets the zoneId. + * + * Zone identifier. + * + * @return the zoneId + */ + public String getZoneId() { + return this.zoneId; + } + + /** + * Sets the zoneId. + * + * @param zoneId the new zoneId + */ + public void setZoneId(final String zoneId) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(zoneId, "zoneId cannot be empty."); + this.zoneId = zoneId; + } + + /** + * List logpush jobs. + * + * List configured logpush jobs for your domain. + * + * @param getLogpushJobsV2Options the {@link GetLogpushJobsV2Options} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListLogpushJobsResp} + */ + public ServiceCall getLogpushJobsV2(GetLogpushJobsV2Options getLogpushJobsV2Options) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/{crn}/zones/{zone_id}/logpush/jobs", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "getLogpushJobsV2"); + 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 logpush jobs. + * + * List configured logpush jobs for your domain. + * + * @return a {@link ServiceCall} with a result of type {@link ListLogpushJobsResp} + */ + public ServiceCall getLogpushJobsV2() { + return getLogpushJobsV2(null); + } + + /** + * Create a logpush jobs. + * + * Create a new logpush job for the domain. + * + * @param createLogpushJobV2Options the {@link CreateLogpushJobV2Options} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link LogpushJobsResp} + */ + public ServiceCall createLogpushJobV2(CreateLogpushJobV2Options createLogpushJobV2Options) { + if (createLogpushJobV2Options == null) { + createLogpushJobV2Options = new CreateLogpushJobV2Options.Builder().build(); + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/{crn}/zones/{zone_id}/logpush/jobs", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "createLogpushJobV2"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createLogpushJobV2Options.createLogpushJobV2Request() != null) { + builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(createLogpushJobV2Options.createLogpushJobV2Request()), "application/json"); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a logpush jobs. + * + * Create a new logpush job for the domain. + * + * @return a {@link ServiceCall} with a result of type {@link LogpushJobsResp} + */ + public ServiceCall createLogpushJobV2() { + return createLogpushJobV2(null); + } + + /** + * Get a logpush job. + * + * Get a logpush job for a given zone. + * + * @param getLogpushJobV2Options the {@link GetLogpushJobV2Options} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link LogpushJobsResp} + */ + public ServiceCall getLogpushJobV2(GetLogpushJobV2Options getLogpushJobV2Options) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getLogpushJobV2Options, + "getLogpushJobV2Options cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + pathParamsMap.put("job_id", getLogpushJobV2Options.jobId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/{crn}/zones/{zone_id}/logpush/jobs/{job_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "getLogpushJobV2"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a logpush job. + * + * Update an existing logpush job for a given zone. + * + * @param updateLogpushJobV2Options the {@link UpdateLogpushJobV2Options} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link LogpushJobsResp} + */ + public ServiceCall updateLogpushJobV2(UpdateLogpushJobV2Options updateLogpushJobV2Options) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateLogpushJobV2Options, + "updateLogpushJobV2Options cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + pathParamsMap.put("job_id", updateLogpushJobV2Options.jobId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/{crn}/zones/{zone_id}/logpush/jobs/{job_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "updateLogpushJobV2"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (updateLogpushJobV2Options.updateLogpushJobV2Request() != null) { + builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(updateLogpushJobV2Options.updateLogpushJobV2Request()), "application/json"); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a logpush job. + * + * Delete a logpush job for a zone. + * + * @param deleteLogpushJobV2Options the {@link DeleteLogpushJobV2Options} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link DeleteLogpushJobResp} + */ + public ServiceCall deleteLogpushJobV2(DeleteLogpushJobV2Options deleteLogpushJobV2Options) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteLogpushJobV2Options, + "deleteLogpushJobV2Options cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + pathParamsMap.put("job_id", deleteLogpushJobV2Options.jobId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/{crn}/zones/{zone_id}/logpush/jobs/{job_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "deleteLogpushJobV2"); + 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 a new ownership challenge sent to your destination. + * + * Get a new ownership challenge. + * + * @param getLogpushOwnershipV2Options the {@link GetLogpushOwnershipV2Options} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link OwnershipChallengeResp} + */ + public ServiceCall getLogpushOwnershipV2(GetLogpushOwnershipV2Options getLogpushOwnershipV2Options) { + boolean skipBody = false; + if (getLogpushOwnershipV2Options == null) { + getLogpushOwnershipV2Options = new GetLogpushOwnershipV2Options.Builder().build(); + skipBody = true; + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/{crn}/zones/{zone_id}/logpush/ownership", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "getLogpushOwnershipV2"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (!skipBody) { + final JsonObject contentJson = new JsonObject(); + if (getLogpushOwnershipV2Options.cos() != null) { + contentJson.add("cos", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(getLogpushOwnershipV2Options.cos())); + } + builder.bodyJson(contentJson); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get a new ownership challenge sent to your destination. + * + * Get a new ownership challenge. + * + * @return a {@link ServiceCall} with a result of type {@link OwnershipChallengeResp} + */ + public ServiceCall getLogpushOwnershipV2() { + return getLogpushOwnershipV2(null); + } + + /** + * Validate ownership challenge of the destination. + * + * Validate ownership challenge of the destination. + * + * @param validateLogpushOwnershipChallengeV2Options the {@link ValidateLogpushOwnershipChallengeV2Options} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link OwnershipChallengeValidateResult} + */ + public ServiceCall validateLogpushOwnershipChallengeV2(ValidateLogpushOwnershipChallengeV2Options validateLogpushOwnershipChallengeV2Options) { + boolean skipBody = false; + if (validateLogpushOwnershipChallengeV2Options == null) { + validateLogpushOwnershipChallengeV2Options = new ValidateLogpushOwnershipChallengeV2Options.Builder().build(); + skipBody = true; + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/{crn}/zones/{zone_id}/logpush/ownership/validate", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "validateLogpushOwnershipChallengeV2"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (!skipBody) { + final JsonObject contentJson = new JsonObject(); + if (validateLogpushOwnershipChallengeV2Options.cos() != null) { + contentJson.add("cos", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(validateLogpushOwnershipChallengeV2Options.cos())); + } + if (validateLogpushOwnershipChallengeV2Options.ownershipChallenge() != null) { + contentJson.addProperty("ownership_challenge", validateLogpushOwnershipChallengeV2Options.ownershipChallenge()); + } + builder.bodyJson(contentJson); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Validate ownership challenge of the destination. + * + * Validate ownership challenge of the destination. + * + * @return a {@link ServiceCall} with a result of type {@link OwnershipChallengeValidateResult} + */ + public ServiceCall validateLogpushOwnershipChallengeV2() { + return validateLogpushOwnershipChallengeV2(null); + } + + /** + * The list of all fields available for a dataset. + * + * The list of all fields available for a dataset. + * + * @param listFieldsForDatasetV2Options the {@link ListFieldsForDatasetV2Options} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ListFieldsResp} + */ + public ServiceCall listFieldsForDatasetV2(ListFieldsForDatasetV2Options listFieldsForDatasetV2Options) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + pathParamsMap.put("dataset", this.dataset); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/{crn}/zones/{zone_id}/logpush/datasets/{dataset}/fields", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "listFieldsForDatasetV2"); + 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); + } + + /** + * The list of all fields available for a dataset. + * + * The list of all fields available for a dataset. + * + * @return a {@link ServiceCall} with a result of type {@link ListFieldsResp} + */ + public ServiceCall listFieldsForDatasetV2() { + return listFieldsForDatasetV2(null); + } + + /** + * List logpush jobs for dataset. + * + * List configured logpush jobs for a dataset. + * + * @param listLogpushJobsForDatasetV2Options the {@link ListLogpushJobsForDatasetV2Options} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link LogpushJobsResp} + */ + public ServiceCall listLogpushJobsForDatasetV2(ListLogpushJobsForDatasetV2Options listLogpushJobsForDatasetV2Options) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + pathParamsMap.put("dataset", this.dataset); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/{crn}/zones/{zone_id}/logpush/datasets/{dataset}/jobs", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "listLogpushJobsForDatasetV2"); + 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 logpush jobs for dataset. + * + * List configured logpush jobs for a dataset. + * + * @return a {@link ServiceCall} with a result of type {@link LogpushJobsResp} + */ + public ServiceCall listLogpushJobsForDatasetV2() { + return listLogpushJobsForDatasetV2(null); + } + + /** + * Get log retention. + * + * Get log retention setting for Logpull/Logpush on your domain. + * + * @param getLogsRetentionOptions the {@link GetLogsRetentionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link LogRetentionResp} + */ + public ServiceCall getLogsRetention(GetLogsRetentionOptions getLogsRetentionOptions) { + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/logs/retention", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "getLogsRetention"); + 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 log retention. + * + * Get log retention setting for Logpull/Logpush on your domain. + * + * @return a {@link ServiceCall} with a result of type {@link LogRetentionResp} + */ + public ServiceCall getLogsRetention() { + return getLogsRetention(null); + } + + /** + * Update log retention. + * + * Update log retention flag for Logpull/Logpush. + * + * @param createLogRetentionOptions the {@link CreateLogRetentionOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link LogRetentionResp} + */ + public ServiceCall createLogRetention(CreateLogRetentionOptions createLogRetentionOptions) { + boolean skipBody = false; + if (createLogRetentionOptions == null) { + createLogRetentionOptions = new CreateLogRetentionOptions.Builder().build(); + skipBody = true; + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("crn", this.crn); + pathParamsMap.put("zone_id", this.zoneId); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{crn}/zones/{zone_id}/logs/retention", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("logpush_jobs_api", "v1", "createLogRetention"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (!skipBody) { + final JsonObject contentJson = new JsonObject(); + if (createLogRetentionOptions.flag() != null) { + contentJson.addProperty("flag", createLogRetentionOptions.flag()); + } + builder.bodyJson(contentJson); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update log retention. + * + * Update log retention flag for Logpull/Logpush. + * + * @return a {@link ServiceCall} with a result of type {@link LogRetentionResp} + */ + public ServiceCall createLogRetention() { + return createLogRetention(null); + } + +} diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogRetentionOptions.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogRetentionOptions.java new file mode 100644 index 000000000..bfe61534f --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogRetentionOptions.java @@ -0,0 +1,91 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createLogRetention options. + */ +public class CreateLogRetentionOptions extends GenericModel { + + protected Boolean flag; + + /** + * Builder. + */ + public static class Builder { + private Boolean flag; + + /** + * Instantiates a new Builder from an existing CreateLogRetentionOptions instance. + * + * @param createLogRetentionOptions the instance to initialize the Builder with + */ + private Builder(CreateLogRetentionOptions createLogRetentionOptions) { + this.flag = createLogRetentionOptions.flag; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a CreateLogRetentionOptions. + * + * @return the new CreateLogRetentionOptions instance + */ + public CreateLogRetentionOptions build() { + return new CreateLogRetentionOptions(this); + } + + /** + * Set the flag. + * + * @param flag the flag + * @return the CreateLogRetentionOptions builder + */ + public Builder flag(Boolean flag) { + this.flag = flag; + return this; + } + } + + protected CreateLogRetentionOptions() { } + + protected CreateLogRetentionOptions(Builder builder) { + flag = builder.flag; + } + + /** + * New builder. + * + * @return a CreateLogRetentionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the flag. + * + * @return the flag + */ + public Boolean flag() { + return flag; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2Options.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2Options.java new file mode 100644 index 000000000..eff8afac9 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2Options.java @@ -0,0 +1,93 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createLogpushJobV2 options. + */ +public class CreateLogpushJobV2Options extends GenericModel { + + protected CreateLogpushJobV2Request createLogpushJobV2Request; + + /** + * Builder. + */ + public static class Builder { + private CreateLogpushJobV2Request createLogpushJobV2Request; + + /** + * Instantiates a new Builder from an existing CreateLogpushJobV2Options instance. + * + * @param createLogpushJobV2Options the instance to initialize the Builder with + */ + private Builder(CreateLogpushJobV2Options createLogpushJobV2Options) { + this.createLogpushJobV2Request = createLogpushJobV2Options.createLogpushJobV2Request; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a CreateLogpushJobV2Options. + * + * @return the new CreateLogpushJobV2Options instance + */ + public CreateLogpushJobV2Options build() { + return new CreateLogpushJobV2Options(this); + } + + /** + * Set the createLogpushJobV2Request. + * + * @param createLogpushJobV2Request the createLogpushJobV2Request + * @return the CreateLogpushJobV2Options builder + */ + public Builder createLogpushJobV2Request(CreateLogpushJobV2Request createLogpushJobV2Request) { + this.createLogpushJobV2Request = createLogpushJobV2Request; + return this; + } + } + + protected CreateLogpushJobV2Options() { } + + protected CreateLogpushJobV2Options(Builder builder) { + createLogpushJobV2Request = builder.createLogpushJobV2Request; + } + + /** + * New builder. + * + * @return a CreateLogpushJobV2Options builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the createLogpushJobV2Request. + * + * Create logpush job body. + * + * @return the createLogpushJobV2Request + */ + public CreateLogpushJobV2Request createLogpushJobV2Request() { + return createLogpushJobV2Request; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2Request.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2Request.java new file mode 100644 index 000000000..a6eebe1d2 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2Request.java @@ -0,0 +1,181 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import java.util.Map; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * CreateLogpushJobV2Request. + * + * Classes which extend this class: + * - CreateLogpushJobV2RequestLogpushJobCosReq + * - CreateLogpushJobV2RequestLogpushJobLogdnaReq + * - CreateLogpushJobV2RequestLogpushJobIbmclReq + * - CreateLogpushJobV2RequestLogpushJobGenericReq + */ +public class CreateLogpushJobV2Request extends GenericModel { + + /** + * Dataset to be pulled. + */ + public interface Dataset { + /** http_requests. */ + String HTTP_REQUESTS = "http_requests"; + /** range_events. */ + String RANGE_EVENTS = "range_events"; + /** firewall_events. */ + String FIREWALL_EVENTS = "firewall_events"; + } + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + protected String name; + protected Boolean enabled; + @SerializedName("logpull_options") + protected String logpullOptions; + protected Map cos; + @SerializedName("ownership_challenge") + protected String ownershipChallenge; + protected String dataset; + protected String frequency; + protected Map logdna; + protected LogpushJobIbmclReqIbmcl ibmcl; + @SerializedName("destination_conf") + protected String destinationConf; + + protected CreateLogpushJobV2Request() { } + + /** + * Gets the name. + * + * Logpush Job Name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the enabled. + * + * Whether the logpush job enabled or not. + * + * @return the enabled + */ + public Boolean enabled() { + return enabled; + } + + /** + * Gets the logpullOptions. + * + * Configuration string. + * + * @return the logpullOptions + */ + public String logpullOptions() { + return logpullOptions; + } + + /** + * Gets the cos. + * + * Information to identify the COS bucket where the data will be pushed. + * + * @return the cos + */ + public Map cos() { + return cos; + } + + /** + * Gets the ownershipChallenge. + * + * Ownership challenge token to prove destination ownership. + * + * @return the ownershipChallenge + */ + public String ownershipChallenge() { + return ownershipChallenge; + } + + /** + * Gets the dataset. + * + * Dataset to be pulled. + * + * @return the dataset + */ + public String dataset() { + return dataset; + } + + /** + * Gets the frequency. + * + * The frequency at which CIS sends batches of logs to your destination. + * + * @return the frequency + */ + public String frequency() { + return frequency; + } + + /** + * Gets the logdna. + * + * Information to identify the LogDNA instance the data will be pushed. + * + * @return the logdna + */ + public Map logdna() { + return logdna; + } + + /** + * Gets the ibmcl. + * + * Required information to push logs to your Cloud Logs instance. + * + * @return the ibmcl + */ + public LogpushJobIbmclReqIbmcl ibmcl() { + return ibmcl; + } + + /** + * Gets the destinationConf. + * + * Uniquely identifies a resource where data will be pushed. Additional configuration parameters supported by the + * destination may be included. + * + * @return the destinationConf + */ + public String destinationConf() { + return destinationConf; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobCosReq.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobCosReq.java new file mode 100644 index 000000000..7c9fb32ac --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobCosReq.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.logpush_jobs_api.v1.model; + +import java.util.Map; + +/** + * Create COS logpush job input. + */ +public class CreateLogpushJobV2RequestLogpushJobCosReq extends CreateLogpushJobV2Request { + + /** + * Dataset to be pulled. + */ + public interface Dataset { + /** http_requests. */ + String HTTP_REQUESTS = "http_requests"; + /** range_events. */ + String RANGE_EVENTS = "range_events"; + /** firewall_events. */ + String FIREWALL_EVENTS = "firewall_events"; + } + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + + /** + * Builder. + */ + public static class Builder { + private String name; + private Boolean enabled; + private String logpullOptions; + private Map cos; + private String ownershipChallenge; + private String dataset; + private String frequency; + + /** + * Instantiates a new Builder from an existing CreateLogpushJobV2RequestLogpushJobCosReq instance. + * + * @param createLogpushJobV2RequestLogpushJobCosReq the instance to initialize the Builder with + */ + public Builder(CreateLogpushJobV2Request createLogpushJobV2RequestLogpushJobCosReq) { + this.name = createLogpushJobV2RequestLogpushJobCosReq.name; + this.enabled = createLogpushJobV2RequestLogpushJobCosReq.enabled; + this.logpullOptions = createLogpushJobV2RequestLogpushJobCosReq.logpullOptions; + this.cos = createLogpushJobV2RequestLogpushJobCosReq.cos; + this.ownershipChallenge = createLogpushJobV2RequestLogpushJobCosReq.ownershipChallenge; + this.dataset = createLogpushJobV2RequestLogpushJobCosReq.dataset; + this.frequency = createLogpushJobV2RequestLogpushJobCosReq.frequency; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param cos the cos + * @param ownershipChallenge the ownershipChallenge + */ + public Builder(Map cos, String ownershipChallenge) { + this.cos = cos; + this.ownershipChallenge = ownershipChallenge; + } + + /** + * Builds a CreateLogpushJobV2RequestLogpushJobCosReq. + * + * @return the new CreateLogpushJobV2RequestLogpushJobCosReq instance + */ + public CreateLogpushJobV2RequestLogpushJobCosReq build() { + return new CreateLogpushJobV2RequestLogpushJobCosReq(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateLogpushJobV2RequestLogpushJobCosReq builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the CreateLogpushJobV2RequestLogpushJobCosReq builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the logpullOptions. + * + * @param logpullOptions the logpullOptions + * @return the CreateLogpushJobV2RequestLogpushJobCosReq builder + */ + public Builder logpullOptions(String logpullOptions) { + this.logpullOptions = logpullOptions; + return this; + } + + /** + * Set the cos. + * + * @param cos the cos + * @return the CreateLogpushJobV2RequestLogpushJobCosReq builder + */ + public Builder cos(Map cos) { + this.cos = cos; + return this; + } + + /** + * Set the ownershipChallenge. + * + * @param ownershipChallenge the ownershipChallenge + * @return the CreateLogpushJobV2RequestLogpushJobCosReq builder + */ + public Builder ownershipChallenge(String ownershipChallenge) { + this.ownershipChallenge = ownershipChallenge; + return this; + } + + /** + * Set the dataset. + * + * @param dataset the dataset + * @return the CreateLogpushJobV2RequestLogpushJobCosReq builder + */ + public Builder dataset(String dataset) { + this.dataset = dataset; + return this; + } + + /** + * Set the frequency. + * + * @param frequency the frequency + * @return the CreateLogpushJobV2RequestLogpushJobCosReq builder + */ + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + } + + protected CreateLogpushJobV2RequestLogpushJobCosReq() { } + + protected CreateLogpushJobV2RequestLogpushJobCosReq(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.cos, + "cos cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ownershipChallenge, + "ownershipChallenge cannot be null"); + name = builder.name; + enabled = builder.enabled; + logpullOptions = builder.logpullOptions; + cos = builder.cos; + ownershipChallenge = builder.ownershipChallenge; + dataset = builder.dataset; + frequency = builder.frequency; + } + + /** + * New builder. + * + * @return a CreateLogpushJobV2RequestLogpushJobCosReq builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobGenericReq.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobGenericReq.java new file mode 100644 index 000000000..a7c8bb482 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobGenericReq.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.logpush_jobs_api.v1.model; + +/** + * Create logpush job for a generic destination. + */ +public class CreateLogpushJobV2RequestLogpushJobGenericReq extends CreateLogpushJobV2Request { + + /** + * Dataset to be pulled. + */ + public interface Dataset { + /** http_requests. */ + String HTTP_REQUESTS = "http_requests"; + /** range_events. */ + String RANGE_EVENTS = "range_events"; + /** firewall_events. */ + String FIREWALL_EVENTS = "firewall_events"; + } + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + + /** + * Builder. + */ + public static class Builder { + private String name; + private Boolean enabled; + private String logpullOptions; + private String destinationConf; + private String dataset; + private String frequency; + + /** + * Instantiates a new Builder from an existing CreateLogpushJobV2RequestLogpushJobGenericReq instance. + * + * @param createLogpushJobV2RequestLogpushJobGenericReq the instance to initialize the Builder with + */ + public Builder(CreateLogpushJobV2Request createLogpushJobV2RequestLogpushJobGenericReq) { + this.name = createLogpushJobV2RequestLogpushJobGenericReq.name; + this.enabled = createLogpushJobV2RequestLogpushJobGenericReq.enabled; + this.logpullOptions = createLogpushJobV2RequestLogpushJobGenericReq.logpullOptions; + this.destinationConf = createLogpushJobV2RequestLogpushJobGenericReq.destinationConf; + this.dataset = createLogpushJobV2RequestLogpushJobGenericReq.dataset; + this.frequency = createLogpushJobV2RequestLogpushJobGenericReq.frequency; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param destinationConf the destinationConf + */ + public Builder(String destinationConf) { + this.destinationConf = destinationConf; + } + + /** + * Builds a CreateLogpushJobV2RequestLogpushJobGenericReq. + * + * @return the new CreateLogpushJobV2RequestLogpushJobGenericReq instance + */ + public CreateLogpushJobV2RequestLogpushJobGenericReq build() { + return new CreateLogpushJobV2RequestLogpushJobGenericReq(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateLogpushJobV2RequestLogpushJobGenericReq builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the CreateLogpushJobV2RequestLogpushJobGenericReq builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the logpullOptions. + * + * @param logpullOptions the logpullOptions + * @return the CreateLogpushJobV2RequestLogpushJobGenericReq builder + */ + public Builder logpullOptions(String logpullOptions) { + this.logpullOptions = logpullOptions; + return this; + } + + /** + * Set the destinationConf. + * + * @param destinationConf the destinationConf + * @return the CreateLogpushJobV2RequestLogpushJobGenericReq builder + */ + public Builder destinationConf(String destinationConf) { + this.destinationConf = destinationConf; + return this; + } + + /** + * Set the dataset. + * + * @param dataset the dataset + * @return the CreateLogpushJobV2RequestLogpushJobGenericReq builder + */ + public Builder dataset(String dataset) { + this.dataset = dataset; + return this; + } + + /** + * Set the frequency. + * + * @param frequency the frequency + * @return the CreateLogpushJobV2RequestLogpushJobGenericReq builder + */ + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + } + + protected CreateLogpushJobV2RequestLogpushJobGenericReq() { } + + protected CreateLogpushJobV2RequestLogpushJobGenericReq(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.destinationConf, + "destinationConf cannot be null"); + name = builder.name; + enabled = builder.enabled; + logpullOptions = builder.logpullOptions; + destinationConf = builder.destinationConf; + dataset = builder.dataset; + frequency = builder.frequency; + } + + /** + * New builder. + * + * @return a CreateLogpushJobV2RequestLogpushJobGenericReq builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobIbmclReq.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobIbmclReq.java new file mode 100644 index 000000000..a680d4578 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobIbmclReq.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.logpush_jobs_api.v1.model; + +/** + * Create IBM Cloud Logs logpush job input. + */ +public class CreateLogpushJobV2RequestLogpushJobIbmclReq extends CreateLogpushJobV2Request { + + /** + * Dataset to be pulled. + */ + public interface Dataset { + /** http_requests. */ + String HTTP_REQUESTS = "http_requests"; + /** range_events. */ + String RANGE_EVENTS = "range_events"; + /** firewall_events. */ + String FIREWALL_EVENTS = "firewall_events"; + } + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + + /** + * Builder. + */ + public static class Builder { + private String name; + private Boolean enabled; + private String logpullOptions; + private LogpushJobIbmclReqIbmcl ibmcl; + private String dataset; + private String frequency; + + /** + * Instantiates a new Builder from an existing CreateLogpushJobV2RequestLogpushJobIbmclReq instance. + * + * @param createLogpushJobV2RequestLogpushJobIbmclReq the instance to initialize the Builder with + */ + public Builder(CreateLogpushJobV2Request createLogpushJobV2RequestLogpushJobIbmclReq) { + this.name = createLogpushJobV2RequestLogpushJobIbmclReq.name; + this.enabled = createLogpushJobV2RequestLogpushJobIbmclReq.enabled; + this.logpullOptions = createLogpushJobV2RequestLogpushJobIbmclReq.logpullOptions; + this.ibmcl = createLogpushJobV2RequestLogpushJobIbmclReq.ibmcl; + this.dataset = createLogpushJobV2RequestLogpushJobIbmclReq.dataset; + this.frequency = createLogpushJobV2RequestLogpushJobIbmclReq.frequency; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param ibmcl the ibmcl + */ + public Builder(LogpushJobIbmclReqIbmcl ibmcl) { + this.ibmcl = ibmcl; + } + + /** + * Builds a CreateLogpushJobV2RequestLogpushJobIbmclReq. + * + * @return the new CreateLogpushJobV2RequestLogpushJobIbmclReq instance + */ + public CreateLogpushJobV2RequestLogpushJobIbmclReq build() { + return new CreateLogpushJobV2RequestLogpushJobIbmclReq(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateLogpushJobV2RequestLogpushJobIbmclReq builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the CreateLogpushJobV2RequestLogpushJobIbmclReq builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the logpullOptions. + * + * @param logpullOptions the logpullOptions + * @return the CreateLogpushJobV2RequestLogpushJobIbmclReq builder + */ + public Builder logpullOptions(String logpullOptions) { + this.logpullOptions = logpullOptions; + return this; + } + + /** + * Set the ibmcl. + * + * @param ibmcl the ibmcl + * @return the CreateLogpushJobV2RequestLogpushJobIbmclReq builder + */ + public Builder ibmcl(LogpushJobIbmclReqIbmcl ibmcl) { + this.ibmcl = ibmcl; + return this; + } + + /** + * Set the dataset. + * + * @param dataset the dataset + * @return the CreateLogpushJobV2RequestLogpushJobIbmclReq builder + */ + public Builder dataset(String dataset) { + this.dataset = dataset; + return this; + } + + /** + * Set the frequency. + * + * @param frequency the frequency + * @return the CreateLogpushJobV2RequestLogpushJobIbmclReq builder + */ + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + } + + protected CreateLogpushJobV2RequestLogpushJobIbmclReq() { } + + protected CreateLogpushJobV2RequestLogpushJobIbmclReq(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ibmcl, + "ibmcl cannot be null"); + name = builder.name; + enabled = builder.enabled; + logpullOptions = builder.logpullOptions; + ibmcl = builder.ibmcl; + dataset = builder.dataset; + frequency = builder.frequency; + } + + /** + * New builder. + * + * @return a CreateLogpushJobV2RequestLogpushJobIbmclReq builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobLogdnaReq.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobLogdnaReq.java new file mode 100644 index 000000000..e42b7d47b --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobLogdnaReq.java @@ -0,0 +1,184 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import java.util.Map; + +/** + * Create LogDNA logpush job input. + */ +public class CreateLogpushJobV2RequestLogpushJobLogdnaReq extends CreateLogpushJobV2Request { + + /** + * Dataset to be pulled. + */ + public interface Dataset { + /** http_requests. */ + String HTTP_REQUESTS = "http_requests"; + /** range_events. */ + String RANGE_EVENTS = "range_events"; + /** firewall_events. */ + String FIREWALL_EVENTS = "firewall_events"; + } + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + + /** + * Builder. + */ + public static class Builder { + private String name; + private Boolean enabled; + private String logpullOptions; + private Map logdna; + private String dataset; + private String frequency; + + /** + * Instantiates a new Builder from an existing CreateLogpushJobV2RequestLogpushJobLogdnaReq instance. + * + * @param createLogpushJobV2RequestLogpushJobLogdnaReq the instance to initialize the Builder with + */ + public Builder(CreateLogpushJobV2Request createLogpushJobV2RequestLogpushJobLogdnaReq) { + this.name = createLogpushJobV2RequestLogpushJobLogdnaReq.name; + this.enabled = createLogpushJobV2RequestLogpushJobLogdnaReq.enabled; + this.logpullOptions = createLogpushJobV2RequestLogpushJobLogdnaReq.logpullOptions; + this.logdna = createLogpushJobV2RequestLogpushJobLogdnaReq.logdna; + this.dataset = createLogpushJobV2RequestLogpushJobLogdnaReq.dataset; + this.frequency = createLogpushJobV2RequestLogpushJobLogdnaReq.frequency; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param logdna the logdna + */ + public Builder(Map logdna) { + this.logdna = logdna; + } + + /** + * Builds a CreateLogpushJobV2RequestLogpushJobLogdnaReq. + * + * @return the new CreateLogpushJobV2RequestLogpushJobLogdnaReq instance + */ + public CreateLogpushJobV2RequestLogpushJobLogdnaReq build() { + return new CreateLogpushJobV2RequestLogpushJobLogdnaReq(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateLogpushJobV2RequestLogpushJobLogdnaReq builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the CreateLogpushJobV2RequestLogpushJobLogdnaReq builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the logpullOptions. + * + * @param logpullOptions the logpullOptions + * @return the CreateLogpushJobV2RequestLogpushJobLogdnaReq builder + */ + public Builder logpullOptions(String logpullOptions) { + this.logpullOptions = logpullOptions; + return this; + } + + /** + * Set the logdna. + * + * @param logdna the logdna + * @return the CreateLogpushJobV2RequestLogpushJobLogdnaReq builder + */ + public Builder logdna(Map logdna) { + this.logdna = logdna; + return this; + } + + /** + * Set the dataset. + * + * @param dataset the dataset + * @return the CreateLogpushJobV2RequestLogpushJobLogdnaReq builder + */ + public Builder dataset(String dataset) { + this.dataset = dataset; + return this; + } + + /** + * Set the frequency. + * + * @param frequency the frequency + * @return the CreateLogpushJobV2RequestLogpushJobLogdnaReq builder + */ + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + } + + protected CreateLogpushJobV2RequestLogpushJobLogdnaReq() { } + + protected CreateLogpushJobV2RequestLogpushJobLogdnaReq(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.logdna, + "logdna cannot be null"); + name = builder.name; + enabled = builder.enabled; + logpullOptions = builder.logpullOptions; + logdna = builder.logdna; + dataset = builder.dataset; + frequency = builder.frequency; + } + + /** + * New builder. + * + * @return a CreateLogpushJobV2RequestLogpushJobLogdnaReq builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobResp.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobResp.java new file mode 100644 index 000000000..88387b3d1 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobResp.java @@ -0,0 +1,77 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import java.util.List; +import java.util.Map; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * delete logpush job response. + */ +public class DeleteLogpushJobResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected Map result; + + protected DeleteLogpushJobResp() { } + + /** + * Gets the success. + * + * success response. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * result. + * + * @return the result + */ + public Map getResult() { + return result; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobV2Options.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobV2Options.java new file mode 100644 index 000000000..32b3aaef3 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobV2Options.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The deleteLogpushJobV2 options. + */ +public class DeleteLogpushJobV2Options extends GenericModel { + + protected String jobId; + + /** + * Builder. + */ + public static class Builder { + private String jobId; + + /** + * Instantiates a new Builder from an existing DeleteLogpushJobV2Options instance. + * + * @param deleteLogpushJobV2Options the instance to initialize the Builder with + */ + private Builder(DeleteLogpushJobV2Options deleteLogpushJobV2Options) { + this.jobId = deleteLogpushJobV2Options.jobId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param jobId the jobId + */ + public Builder(String jobId) { + this.jobId = jobId; + } + + /** + * Builds a DeleteLogpushJobV2Options. + * + * @return the new DeleteLogpushJobV2Options instance + */ + public DeleteLogpushJobV2Options build() { + return new DeleteLogpushJobV2Options(this); + } + + /** + * Set the jobId. + * + * @param jobId the jobId + * @return the DeleteLogpushJobV2Options builder + */ + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + } + + protected DeleteLogpushJobV2Options() { } + + protected DeleteLogpushJobV2Options(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.jobId, + "jobId cannot be empty"); + jobId = builder.jobId; + } + + /** + * New builder. + * + * @return a DeleteLogpushJobV2Options builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the jobId. + * + * logpush job identifier. + * + * @return the jobId + */ + public String jobId() { + return jobId; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobV2Options.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobV2Options.java new file mode 100644 index 000000000..5ae476bfd --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobV2Options.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getLogpushJobV2 options. + */ +public class GetLogpushJobV2Options extends GenericModel { + + protected String jobId; + + /** + * Builder. + */ + public static class Builder { + private String jobId; + + /** + * Instantiates a new Builder from an existing GetLogpushJobV2Options instance. + * + * @param getLogpushJobV2Options the instance to initialize the Builder with + */ + private Builder(GetLogpushJobV2Options getLogpushJobV2Options) { + this.jobId = getLogpushJobV2Options.jobId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param jobId the jobId + */ + public Builder(String jobId) { + this.jobId = jobId; + } + + /** + * Builds a GetLogpushJobV2Options. + * + * @return the new GetLogpushJobV2Options instance + */ + public GetLogpushJobV2Options build() { + return new GetLogpushJobV2Options(this); + } + + /** + * Set the jobId. + * + * @param jobId the jobId + * @return the GetLogpushJobV2Options builder + */ + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + } + + protected GetLogpushJobV2Options() { } + + protected GetLogpushJobV2Options(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.jobId, + "jobId cannot be empty"); + jobId = builder.jobId; + } + + /** + * New builder. + * + * @return a GetLogpushJobV2Options builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the jobId. + * + * logpush job identifier. + * + * @return the jobId + */ + public String jobId() { + return jobId; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobsV2Options.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobsV2Options.java new file mode 100644 index 000000000..b885cab6e --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobsV2Options.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getLogpushJobsV2 options. + */ +public class GetLogpushJobsV2Options extends GenericModel { + + /** + * Construct a new instance of GetLogpushJobsV2Options. + */ + public GetLogpushJobsV2Options() { + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushOwnershipV2Options.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushOwnershipV2Options.java new file mode 100644 index 000000000..659604d5d --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushOwnershipV2Options.java @@ -0,0 +1,95 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import java.util.Map; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getLogpushOwnershipV2 options. + */ +public class GetLogpushOwnershipV2Options extends GenericModel { + + protected Map cos; + + /** + * Builder. + */ + public static class Builder { + private Map cos; + + /** + * Instantiates a new Builder from an existing GetLogpushOwnershipV2Options instance. + * + * @param getLogpushOwnershipV2Options the instance to initialize the Builder with + */ + private Builder(GetLogpushOwnershipV2Options getLogpushOwnershipV2Options) { + this.cos = getLogpushOwnershipV2Options.cos; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a GetLogpushOwnershipV2Options. + * + * @return the new GetLogpushOwnershipV2Options instance + */ + public GetLogpushOwnershipV2Options build() { + return new GetLogpushOwnershipV2Options(this); + } + + /** + * Set the cos. + * + * @param cos the cos + * @return the GetLogpushOwnershipV2Options builder + */ + public Builder cos(Map cos) { + this.cos = cos; + return this; + } + } + + protected GetLogpushOwnershipV2Options() { } + + protected GetLogpushOwnershipV2Options(Builder builder) { + cos = builder.cos; + } + + /** + * New builder. + * + * @return a GetLogpushOwnershipV2Options builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the cos. + * + * Information to identify the COS bucket where the data will be pushed. + * + * @return the cos + */ + public Map cos() { + return cos; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogsRetentionOptions.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogsRetentionOptions.java new file mode 100644 index 000000000..a9f2f9de4 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogsRetentionOptions.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The getLogsRetention options. + */ +public class GetLogsRetentionOptions extends GenericModel { + + /** + * Construct a new instance of GetLogsRetentionOptions. + */ + public GetLogsRetentionOptions() { + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsForDatasetV2Options.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsForDatasetV2Options.java new file mode 100644 index 000000000..d287e4e1f --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsForDatasetV2Options.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listFieldsForDatasetV2 options. + */ +public class ListFieldsForDatasetV2Options extends GenericModel { + + /** + * Construct a new instance of ListFieldsForDatasetV2Options. + */ + public ListFieldsForDatasetV2Options() { + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsResp.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsResp.java new file mode 100644 index 000000000..20d28d49b --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsResp.java @@ -0,0 +1,77 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import java.util.List; +import java.util.Map; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * list fields response. + */ +public class ListFieldsResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected Map result; + + protected ListFieldsResp() { } + + /** + * Gets the success. + * + * success response. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * result. + * + * @return the result + */ + public Map getResult() { + return result; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsForDatasetV2Options.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsForDatasetV2Options.java new file mode 100644 index 000000000..1473eabc7 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsForDatasetV2Options.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The listLogpushJobsForDatasetV2 options. + */ +public class ListLogpushJobsForDatasetV2Options extends GenericModel { + + /** + * Construct a new instance of ListLogpushJobsForDatasetV2Options. + */ + public ListLogpushJobsForDatasetV2Options() { + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsResp.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsResp.java new file mode 100644 index 000000000..889debc4c --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsResp.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.logpush_jobs_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * List Logpush Jobs Response. + */ +public class ListLogpushJobsResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected List result; + + protected ListLogpushJobsResp() { } + + /** + * Gets the success. + * + * success response. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * result. + * + * @return the result + */ + public List getResult() { + return result; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionResp.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionResp.java new file mode 100644 index 000000000..afc9659c9 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionResp.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.logpush_jobs_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * log retention result. + */ +public class LogRetentionResp extends GenericModel { + + protected LogRetentionRespResult result; + protected Boolean success; + protected List> errors; + protected List> messages; + + protected LogRetentionResp() { } + + /** + * Gets the result. + * + * @return the result + */ + public LogRetentionRespResult getResult() { + return result; + } + + /** + * Gets the success. + * + * success response. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionRespResult.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionRespResult.java new file mode 100644 index 000000000..3141c0571 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionRespResult.java @@ -0,0 +1,36 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * LogRetentionRespResult. + */ +public class LogRetentionRespResult extends GenericModel { + + protected Boolean flag; + + protected LogRetentionRespResult() { } + + /** + * Gets the flag. + * + * @return the flag + */ + public Boolean isFlag() { + return flag; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobIbmclReqIbmcl.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobIbmclReqIbmcl.java new file mode 100644 index 000000000..01546f579 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobIbmclReqIbmcl.java @@ -0,0 +1,167 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Required information to push logs to your Cloud Logs instance. + */ +public class LogpushJobIbmclReqIbmcl extends GenericModel { + + @SerializedName("instance_id") + protected String instanceId; + protected String region; + @SerializedName("api_key") + protected String apiKey; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String region; + private String apiKey; + + /** + * Instantiates a new Builder from an existing LogpushJobIbmclReqIbmcl instance. + * + * @param logpushJobIbmclReqIbmcl the instance to initialize the Builder with + */ + private Builder(LogpushJobIbmclReqIbmcl logpushJobIbmclReqIbmcl) { + this.instanceId = logpushJobIbmclReqIbmcl.instanceId; + this.region = logpushJobIbmclReqIbmcl.region; + this.apiKey = logpushJobIbmclReqIbmcl.apiKey; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param region the region + * @param apiKey the apiKey + */ + public Builder(String instanceId, String region, String apiKey) { + this.instanceId = instanceId; + this.region = region; + this.apiKey = apiKey; + } + + /** + * Builds a LogpushJobIbmclReqIbmcl. + * + * @return the new LogpushJobIbmclReqIbmcl instance + */ + public LogpushJobIbmclReqIbmcl build() { + return new LogpushJobIbmclReqIbmcl(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the LogpushJobIbmclReqIbmcl builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the region. + * + * @param region the region + * @return the LogpushJobIbmclReqIbmcl builder + */ + public Builder region(String region) { + this.region = region; + return this; + } + + /** + * Set the apiKey. + * + * @param apiKey the apiKey + * @return the LogpushJobIbmclReqIbmcl builder + */ + public Builder apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + } + + protected LogpushJobIbmclReqIbmcl() { } + + protected LogpushJobIbmclReqIbmcl(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.instanceId, + "instanceId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.region, + "region cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.apiKey, + "apiKey cannot be null"); + instanceId = builder.instanceId; + region = builder.region; + apiKey = builder.apiKey; + } + + /** + * New builder. + * + * @return a LogpushJobIbmclReqIbmcl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * GUID of the IBM Cloud Logs instance where you want to send logs. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the region. + * + * Region where the IBM Cloud Logs instance is located. + * + * @return the region + */ + public String region() { + return region; + } + + /** + * Gets the apiKey. + * + * IBM Cloud API key used to generate a token for pushing to your Cloud Logs instance. + * + * @return the apiKey + */ + public String apiKey() { + return apiKey; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobPack.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobPack.java new file mode 100644 index 000000000..103d5a270 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobPack.java @@ -0,0 +1,152 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * logpush job pack. + */ +public class LogpushJobPack extends GenericModel { + + protected Long id; + protected String name; + protected Boolean enabled; + protected String dataset; + protected String frequency; + @SerializedName("logpull_options") + protected String logpullOptions; + @SerializedName("destination_conf") + protected String destinationConf; + @SerializedName("last_complete") + protected String lastComplete; + @SerializedName("last_error") + protected String lastError; + @SerializedName("error_message") + protected String errorMessage; + + protected LogpushJobPack() { } + + /** + * Gets the id. + * + * Logpush Job ID. + * + * @return the id + */ + public Long getId() { + return id; + } + + /** + * Gets the name. + * + * Logpush Job Name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the enabled. + * + * Whether the logpush job enabled or not. + * + * @return the enabled + */ + public Boolean isEnabled() { + return enabled; + } + + /** + * Gets the dataset. + * + * Dataset to be pulled. + * + * @return the dataset + */ + public String getDataset() { + return dataset; + } + + /** + * Gets the frequency. + * + * The frequency at which CIS sends batches of logs to your destination. + * + * @return the frequency + */ + public String getFrequency() { + return frequency; + } + + /** + * Gets the logpullOptions. + * + * Configuration string. + * + * @return the logpullOptions + */ + public String getLogpullOptions() { + return logpullOptions; + } + + /** + * Gets the destinationConf. + * + * Uniquely identifies a resource (such as an s3 bucket) where data will be pushed. + * + * @return the destinationConf + */ + public String getDestinationConf() { + return destinationConf; + } + + /** + * Gets the lastComplete. + * + * Records the last time for which logs have been successfully pushed. + * + * @return the lastComplete + */ + public String getLastComplete() { + return lastComplete; + } + + /** + * Gets the lastError. + * + * Records the last time the job failed. + * + * @return the lastError + */ + public String getLastError() { + return lastError; + } + + /** + * Gets the errorMessage. + * + * The last failure. + * + * @return the errorMessage + */ + public String getErrorMessage() { + return errorMessage; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsResp.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsResp.java new file mode 100644 index 000000000..d26e271b2 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsResp.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.logpush_jobs_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * logpush job response. + */ +public class LogpushJobsResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected LogpushJobPack result; + + protected LogpushJobsResp() { } + + /** + * Gets the success. + * + * success response. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * logpush job pack. + * + * @return the result + */ + public LogpushJobPack getResult() { + return result; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsUpdateIbmclReqIbmcl.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsUpdateIbmclReqIbmcl.java new file mode 100644 index 000000000..f623479e3 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsUpdateIbmclReqIbmcl.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.logpush_jobs_api.v1.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Required information to push logs to your Cloud Logs instance. + */ +public class LogpushJobsUpdateIbmclReqIbmcl extends GenericModel { + + @SerializedName("instance_id") + protected String instanceId; + protected String region; + @SerializedName("api_key") + protected String apiKey; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String region; + private String apiKey; + + /** + * Instantiates a new Builder from an existing LogpushJobsUpdateIbmclReqIbmcl instance. + * + * @param logpushJobsUpdateIbmclReqIbmcl the instance to initialize the Builder with + */ + private Builder(LogpushJobsUpdateIbmclReqIbmcl logpushJobsUpdateIbmclReqIbmcl) { + this.instanceId = logpushJobsUpdateIbmclReqIbmcl.instanceId; + this.region = logpushJobsUpdateIbmclReqIbmcl.region; + this.apiKey = logpushJobsUpdateIbmclReqIbmcl.apiKey; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a LogpushJobsUpdateIbmclReqIbmcl. + * + * @return the new LogpushJobsUpdateIbmclReqIbmcl instance + */ + public LogpushJobsUpdateIbmclReqIbmcl build() { + return new LogpushJobsUpdateIbmclReqIbmcl(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the LogpushJobsUpdateIbmclReqIbmcl builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the region. + * + * @param region the region + * @return the LogpushJobsUpdateIbmclReqIbmcl builder + */ + public Builder region(String region) { + this.region = region; + return this; + } + + /** + * Set the apiKey. + * + * @param apiKey the apiKey + * @return the LogpushJobsUpdateIbmclReqIbmcl builder + */ + public Builder apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + } + + protected LogpushJobsUpdateIbmclReqIbmcl() { } + + protected LogpushJobsUpdateIbmclReqIbmcl(Builder builder) { + instanceId = builder.instanceId; + region = builder.region; + apiKey = builder.apiKey; + } + + /** + * New builder. + * + * @return a LogpushJobsUpdateIbmclReqIbmcl builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * GUID of the IBM Cloud Logs instance where you want to send logs. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the region. + * + * Region where the IBM Cloud Logs instance is located. + * + * @return the region + */ + public String region() { + return region; + } + + /** + * Gets the apiKey. + * + * IBM Cloud API key used to generate a token for pushing to your Cloud Logs instance. + * + * @return the apiKey + */ + public String apiKey() { + return apiKey; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeResp.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeResp.java new file mode 100644 index 000000000..cee504b88 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeResp.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.logpush_jobs_api.v1.model; + +import java.util.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Get Logpush Ownership Challenge Response. + */ +public class OwnershipChallengeResp extends GenericModel { + + protected Boolean success; + protected List> errors; + protected List> messages; + protected OwnershipChallengeResult result; + + protected OwnershipChallengeResp() { } + + /** + * Gets the success. + * + * success response. + * + * @return the success + */ + public Boolean isSuccess() { + return success; + } + + /** + * Gets the errors. + * + * errors. + * + * @return the errors + */ + public List> getErrors() { + return errors; + } + + /** + * Gets the messages. + * + * messages. + * + * @return the messages + */ + public List> getMessages() { + return messages; + } + + /** + * Gets the result. + * + * ownership challenge result. + * + * @return the result + */ + public OwnershipChallengeResult getResult() { + return result; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeResult.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeResult.java new file mode 100644 index 000000000..e867ba19c --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeResult.java @@ -0,0 +1,62 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ownership challenge result. + */ +public class OwnershipChallengeResult extends GenericModel { + + protected String filename; + protected Boolean valid; + protected String messages; + + protected OwnershipChallengeResult() { } + + /** + * Gets the filename. + * + * file name. + * + * @return the filename + */ + public String getFilename() { + return filename; + } + + /** + * Gets the valid. + * + * valid. + * + * @return the valid + */ + public Boolean isValid() { + return valid; + } + + /** + * Gets the messages. + * + * message. + * + * @return the messages + */ + public String getMessages() { + return messages; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeValidateResult.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeValidateResult.java new file mode 100644 index 000000000..4a77119e5 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeValidateResult.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ownership challenge validate result. + */ +public class OwnershipChallengeValidateResult extends GenericModel { + + protected Boolean valid; + + protected OwnershipChallengeValidateResult() { } + + /** + * Gets the valid. + * + * valid. + * + * @return the valid + */ + public Boolean isValid() { + return valid; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2Options.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2Options.java new file mode 100644 index 000000000..af4c99fdd --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2Options.java @@ -0,0 +1,130 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The updateLogpushJobV2 options. + */ +public class UpdateLogpushJobV2Options extends GenericModel { + + protected String jobId; + protected UpdateLogpushJobV2Request updateLogpushJobV2Request; + + /** + * Builder. + */ + public static class Builder { + private String jobId; + private UpdateLogpushJobV2Request updateLogpushJobV2Request; + + /** + * Instantiates a new Builder from an existing UpdateLogpushJobV2Options instance. + * + * @param updateLogpushJobV2Options the instance to initialize the Builder with + */ + private Builder(UpdateLogpushJobV2Options updateLogpushJobV2Options) { + this.jobId = updateLogpushJobV2Options.jobId; + this.updateLogpushJobV2Request = updateLogpushJobV2Options.updateLogpushJobV2Request; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param jobId the jobId + */ + public Builder(String jobId) { + this.jobId = jobId; + } + + /** + * Builds a UpdateLogpushJobV2Options. + * + * @return the new UpdateLogpushJobV2Options instance + */ + public UpdateLogpushJobV2Options build() { + return new UpdateLogpushJobV2Options(this); + } + + /** + * Set the jobId. + * + * @param jobId the jobId + * @return the UpdateLogpushJobV2Options builder + */ + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + + /** + * Set the updateLogpushJobV2Request. + * + * @param updateLogpushJobV2Request the updateLogpushJobV2Request + * @return the UpdateLogpushJobV2Options builder + */ + public Builder updateLogpushJobV2Request(UpdateLogpushJobV2Request updateLogpushJobV2Request) { + this.updateLogpushJobV2Request = updateLogpushJobV2Request; + return this; + } + } + + protected UpdateLogpushJobV2Options() { } + + protected UpdateLogpushJobV2Options(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.jobId, + "jobId cannot be empty"); + jobId = builder.jobId; + updateLogpushJobV2Request = builder.updateLogpushJobV2Request; + } + + /** + * New builder. + * + * @return a UpdateLogpushJobV2Options builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the jobId. + * + * logpush job identifier. + * + * @return the jobId + */ + public String jobId() { + return jobId; + } + + /** + * Gets the updateLogpushJobV2Request. + * + * Update logpush job. + * + * @return the updateLogpushJobV2Request + */ + public UpdateLogpushJobV2Request updateLogpushJobV2Request() { + return updateLogpushJobV2Request; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2Request.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2Request.java new file mode 100644 index 000000000..749a46f5c --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2Request.java @@ -0,0 +1,181 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import java.util.Map; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * UpdateLogpushJobV2Request. + * + * Classes which extend this class: + * - UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq + * - UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq + * - UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq + * - UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq + */ +public class UpdateLogpushJobV2Request extends GenericModel { + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + /** + * Dataset to be pulled. + */ + public interface Dataset { + /** http_requests. */ + String HTTP_REQUESTS = "http_requests"; + /** range_events. */ + String RANGE_EVENTS = "range_events"; + /** firewall_events. */ + String FIREWALL_EVENTS = "firewall_events"; + } + + protected Boolean enabled; + @SerializedName("logpull_options") + protected String logpullOptions; + protected Map cos; + @SerializedName("ownership_challenge") + protected String ownershipChallenge; + protected String frequency; + protected Map logdna; + protected LogpushJobsUpdateIbmclReqIbmcl ibmcl; + protected String name; + @SerializedName("destination_conf") + protected String destinationConf; + protected String dataset; + + protected UpdateLogpushJobV2Request() { } + + /** + * Gets the enabled. + * + * Whether the logpush job enabled or not. + * + * @return the enabled + */ + public Boolean enabled() { + return enabled; + } + + /** + * Gets the logpullOptions. + * + * Configuration string. + * + * @return the logpullOptions + */ + public String logpullOptions() { + return logpullOptions; + } + + /** + * Gets the cos. + * + * Information to identify the COS bucket where the data will be pushed. + * + * @return the cos + */ + public Map cos() { + return cos; + } + + /** + * Gets the ownershipChallenge. + * + * Ownership challenge token to prove destination ownership. + * + * @return the ownershipChallenge + */ + public String ownershipChallenge() { + return ownershipChallenge; + } + + /** + * Gets the frequency. + * + * The frequency at which CIS sends batches of logs to your destination. + * + * @return the frequency + */ + public String frequency() { + return frequency; + } + + /** + * Gets the logdna. + * + * Information to identify the LogDNA instance the data will be pushed. + * + * @return the logdna + */ + public Map logdna() { + return logdna; + } + + /** + * Gets the ibmcl. + * + * Required information to push logs to your Cloud Logs instance. + * + * @return the ibmcl + */ + public LogpushJobsUpdateIbmclReqIbmcl ibmcl() { + return ibmcl; + } + + /** + * Gets the name. + * + * Logpush Job Name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the destinationConf. + * + * Uniquely identifies a resource where data will be pushed. Additional configuration parameters supported by the + * destination may be included. + * + * @return the destinationConf + */ + public String destinationConf() { + return destinationConf; + } + + /** + * Gets the dataset. + * + * Dataset to be pulled. + * + * @return the dataset + */ + public String dataset() { + return dataset; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq.java new file mode 100644 index 000000000..f23dc6062 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq.java @@ -0,0 +1,147 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import java.util.Map; + +/** + * Update COS logpush job input. + */ +public class UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq extends UpdateLogpushJobV2Request { + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + + /** + * Builder. + */ + public static class Builder { + private Boolean enabled; + private String logpullOptions; + private Map cos; + private String ownershipChallenge; + private String frequency; + + /** + * Instantiates a new Builder from an existing UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq instance. + * + * @param updateLogpushJobV2RequestLogpushJobsUpdateCosReq the instance to initialize the Builder with + */ + public Builder(UpdateLogpushJobV2Request updateLogpushJobV2RequestLogpushJobsUpdateCosReq) { + this.enabled = updateLogpushJobV2RequestLogpushJobsUpdateCosReq.enabled; + this.logpullOptions = updateLogpushJobV2RequestLogpushJobsUpdateCosReq.logpullOptions; + this.cos = updateLogpushJobV2RequestLogpushJobsUpdateCosReq.cos; + this.ownershipChallenge = updateLogpushJobV2RequestLogpushJobsUpdateCosReq.ownershipChallenge; + this.frequency = updateLogpushJobV2RequestLogpushJobsUpdateCosReq.frequency; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq. + * + * @return the new UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq instance + */ + public UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq build() { + return new UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq(this); + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the logpullOptions. + * + * @param logpullOptions the logpullOptions + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq builder + */ + public Builder logpullOptions(String logpullOptions) { + this.logpullOptions = logpullOptions; + return this; + } + + /** + * Set the cos. + * + * @param cos the cos + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq builder + */ + public Builder cos(Map cos) { + this.cos = cos; + return this; + } + + /** + * Set the ownershipChallenge. + * + * @param ownershipChallenge the ownershipChallenge + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq builder + */ + public Builder ownershipChallenge(String ownershipChallenge) { + this.ownershipChallenge = ownershipChallenge; + return this; + } + + /** + * Set the frequency. + * + * @param frequency the frequency + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq builder + */ + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + } + + protected UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq() { } + + protected UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq(Builder builder) { + enabled = builder.enabled; + logpullOptions = builder.logpullOptions; + cos = builder.cos; + ownershipChallenge = builder.ownershipChallenge; + frequency = builder.frequency; + } + + /** + * New builder. + * + * @return a UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq.java new file mode 100644 index 000000000..68490f31a --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq.java @@ -0,0 +1,171 @@ +/* + * (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.logpush_jobs_api.v1.model; + +/** + * Create logpush job for a generic destination. + */ +public class UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq extends UpdateLogpushJobV2Request { + + /** + * Dataset to be pulled. + */ + public interface Dataset { + /** http_requests. */ + String HTTP_REQUESTS = "http_requests"; + /** range_events. */ + String RANGE_EVENTS = "range_events"; + /** firewall_events. */ + String FIREWALL_EVENTS = "firewall_events"; + } + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + + /** + * Builder. + */ + public static class Builder { + private String name; + private Boolean enabled; + private String logpullOptions; + private String destinationConf; + private String dataset; + private String frequency; + + /** + * Instantiates a new Builder from an existing UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq instance. + * + * @param updateLogpushJobV2RequestLogpushJobsUpdateGenericReq the instance to initialize the Builder with + */ + public Builder(UpdateLogpushJobV2Request updateLogpushJobV2RequestLogpushJobsUpdateGenericReq) { + this.name = updateLogpushJobV2RequestLogpushJobsUpdateGenericReq.name; + this.enabled = updateLogpushJobV2RequestLogpushJobsUpdateGenericReq.enabled; + this.logpullOptions = updateLogpushJobV2RequestLogpushJobsUpdateGenericReq.logpullOptions; + this.destinationConf = updateLogpushJobV2RequestLogpushJobsUpdateGenericReq.destinationConf; + this.dataset = updateLogpushJobV2RequestLogpushJobsUpdateGenericReq.dataset; + this.frequency = updateLogpushJobV2RequestLogpushJobsUpdateGenericReq.frequency; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq. + * + * @return the new UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq instance + */ + public UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq build() { + return new UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the logpullOptions. + * + * @param logpullOptions the logpullOptions + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq builder + */ + public Builder logpullOptions(String logpullOptions) { + this.logpullOptions = logpullOptions; + return this; + } + + /** + * Set the destinationConf. + * + * @param destinationConf the destinationConf + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq builder + */ + public Builder destinationConf(String destinationConf) { + this.destinationConf = destinationConf; + return this; + } + + /** + * Set the dataset. + * + * @param dataset the dataset + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq builder + */ + public Builder dataset(String dataset) { + this.dataset = dataset; + return this; + } + + /** + * Set the frequency. + * + * @param frequency the frequency + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq builder + */ + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + } + + protected UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq() { } + + protected UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq(Builder builder) { + name = builder.name; + enabled = builder.enabled; + logpullOptions = builder.logpullOptions; + destinationConf = builder.destinationConf; + dataset = builder.dataset; + frequency = builder.frequency; + } + + /** + * New builder. + * + * @return a UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq.java new file mode 100644 index 000000000..2b2a88270 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq.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.logpush_jobs_api.v1.model; + +/** + * Update IBM Cloud Logs logpush job input. + */ +public class UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq extends UpdateLogpushJobV2Request { + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + + /** + * Builder. + */ + public static class Builder { + private Boolean enabled; + private String logpullOptions; + private LogpushJobsUpdateIbmclReqIbmcl ibmcl; + private String frequency; + + /** + * Instantiates a new Builder from an existing UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq instance. + * + * @param updateLogpushJobV2RequestLogpushJobsUpdateIbmclReq the instance to initialize the Builder with + */ + public Builder(UpdateLogpushJobV2Request updateLogpushJobV2RequestLogpushJobsUpdateIbmclReq) { + this.enabled = updateLogpushJobV2RequestLogpushJobsUpdateIbmclReq.enabled; + this.logpullOptions = updateLogpushJobV2RequestLogpushJobsUpdateIbmclReq.logpullOptions; + this.ibmcl = updateLogpushJobV2RequestLogpushJobsUpdateIbmclReq.ibmcl; + this.frequency = updateLogpushJobV2RequestLogpushJobsUpdateIbmclReq.frequency; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq. + * + * @return the new UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq instance + */ + public UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq build() { + return new UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq(this); + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the logpullOptions. + * + * @param logpullOptions the logpullOptions + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq builder + */ + public Builder logpullOptions(String logpullOptions) { + this.logpullOptions = logpullOptions; + return this; + } + + /** + * Set the ibmcl. + * + * @param ibmcl the ibmcl + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq builder + */ + public Builder ibmcl(LogpushJobsUpdateIbmclReqIbmcl ibmcl) { + this.ibmcl = ibmcl; + return this; + } + + /** + * Set the frequency. + * + * @param frequency the frequency + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq builder + */ + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + } + + protected UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq() { } + + protected UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq(Builder builder) { + enabled = builder.enabled; + logpullOptions = builder.logpullOptions; + ibmcl = builder.ibmcl; + frequency = builder.frequency; + } + + /** + * New builder. + * + * @return a UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.java new file mode 100644 index 000000000..0102801f7 --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.java @@ -0,0 +1,133 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import java.util.Map; + +/** + * Update LogDNA logpush job input. + */ +public class UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq extends UpdateLogpushJobV2Request { + + /** + * The frequency at which CIS sends batches of logs to your destination. + */ + public interface Frequency { + /** high. */ + String HIGH = "high"; + /** low. */ + String LOW = "low"; + } + + + /** + * Builder. + */ + public static class Builder { + private Boolean enabled; + private String logpullOptions; + private Map logdna; + private String frequency; + + /** + * Instantiates a new Builder from an existing UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq instance. + * + * @param updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq the instance to initialize the Builder with + */ + public Builder(UpdateLogpushJobV2Request updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq) { + this.enabled = updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.enabled; + this.logpullOptions = updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.logpullOptions; + this.logdna = updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.logdna; + this.frequency = updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.frequency; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq. + * + * @return the new UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq instance + */ + public UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq build() { + return new UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq(this); + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the logpullOptions. + * + * @param logpullOptions the logpullOptions + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq builder + */ + public Builder logpullOptions(String logpullOptions) { + this.logpullOptions = logpullOptions; + return this; + } + + /** + * Set the logdna. + * + * @param logdna the logdna + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq builder + */ + public Builder logdna(Map logdna) { + this.logdna = logdna; + return this; + } + + /** + * Set the frequency. + * + * @param frequency the frequency + * @return the UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq builder + */ + public Builder frequency(String frequency) { + this.frequency = frequency; + return this; + } + } + + protected UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq() { } + + protected UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq(Builder builder) { + enabled = builder.enabled; + logpullOptions = builder.logpullOptions; + logdna = builder.logdna; + frequency = builder.frequency; + } + + /** + * New builder. + * + * @return a UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ValidateLogpushOwnershipChallengeV2Options.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ValidateLogpushOwnershipChallengeV2Options.java new file mode 100644 index 000000000..2226307ea --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ValidateLogpushOwnershipChallengeV2Options.java @@ -0,0 +1,121 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import java.util.Map; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The validateLogpushOwnershipChallengeV2 options. + */ +public class ValidateLogpushOwnershipChallengeV2Options extends GenericModel { + + protected Map cos; + protected String ownershipChallenge; + + /** + * Builder. + */ + public static class Builder { + private Map cos; + private String ownershipChallenge; + + /** + * Instantiates a new Builder from an existing ValidateLogpushOwnershipChallengeV2Options instance. + * + * @param validateLogpushOwnershipChallengeV2Options the instance to initialize the Builder with + */ + private Builder(ValidateLogpushOwnershipChallengeV2Options validateLogpushOwnershipChallengeV2Options) { + this.cos = validateLogpushOwnershipChallengeV2Options.cos; + this.ownershipChallenge = validateLogpushOwnershipChallengeV2Options.ownershipChallenge; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ValidateLogpushOwnershipChallengeV2Options. + * + * @return the new ValidateLogpushOwnershipChallengeV2Options instance + */ + public ValidateLogpushOwnershipChallengeV2Options build() { + return new ValidateLogpushOwnershipChallengeV2Options(this); + } + + /** + * Set the cos. + * + * @param cos the cos + * @return the ValidateLogpushOwnershipChallengeV2Options builder + */ + public Builder cos(Map cos) { + this.cos = cos; + return this; + } + + /** + * Set the ownershipChallenge. + * + * @param ownershipChallenge the ownershipChallenge + * @return the ValidateLogpushOwnershipChallengeV2Options builder + */ + public Builder ownershipChallenge(String ownershipChallenge) { + this.ownershipChallenge = ownershipChallenge; + return this; + } + } + + protected ValidateLogpushOwnershipChallengeV2Options() { } + + protected ValidateLogpushOwnershipChallengeV2Options(Builder builder) { + cos = builder.cos; + ownershipChallenge = builder.ownershipChallenge; + } + + /** + * New builder. + * + * @return a ValidateLogpushOwnershipChallengeV2Options builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the cos. + * + * Information to identify the COS bucket where the data will be pushed. + * + * @return the cos + */ + public Map cos() { + return cos; + } + + /** + * Gets the ownershipChallenge. + * + * Ownership challenge token to prove destination ownership. + * + * @return the ownershipChallenge + */ + public String ownershipChallenge() { + return ownershipChallenge; + } +} + diff --git a/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/package-info.java b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/package-info.java new file mode 100644 index 000000000..db627f92e --- /dev/null +++ b/modules/logpush-jobs-api/src/main/java/com/ibm/cloud/networking/logpush_jobs_api/v1/package-info.java @@ -0,0 +1,17 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +/** + * Logpush Jobs API v1. + */ +package com.ibm.cloud.networking.logpush_jobs_api.v1; diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/LogpushJobsApiIT.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/LogpushJobsApiIT.java new file mode 100644 index 000000000..1b3dbcfd5 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/LogpushJobsApiIT.java @@ -0,0 +1,685 @@ +/* + * (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.logpush_jobs_api.v1; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.*; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.networking.test.SdkIntegrationTestBase; +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.sdk.core.util.CredentialUtils; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.testng.Assert.*; + +/** + * Integration test class for the LogpushJobsApi service. + */ +public class LogpushJobsApiIT extends SdkIntegrationTestBase { + public LogpushJobsApi service = null; + public static Map config = null; + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + String crn = null; + String zoneId = null; + String dataset = "http_requests"; + String ingressKey = null; + String logdnaRegion = null; + String logdnaDomain = null; + String cosBucket = null; + String cosRegion = null; + String cosInstance = null; + String ownershipToken = null; + + /** + * This method provides our config filename to the base class. + */ + @Override + public String getConfigFilename() { + return "../../cis.env"; + } + + @BeforeClass + public void constructService() { + // Ask super if we should skip the tests. + if (skipTests()) { + return; + } + + final String serviceName = "logpush_jobs_api"; + // Load up the config properties for this service. + config = CredentialUtils.getServiceProperties(serviceName); + + // Load Config + crn = config.get("CRN"); + zoneId = config.get("ZONE_ID"); + ingressKey = config.get("INGRESS_KEY"); + logdnaRegion = config.get("LOGDNA_REGION"); + logdnaDomain = config.get("DOMAIN_NAME"); + cosBucket = config.get("COS_BUCKET"); + cosRegion = config.get("COS_REGION"); + cosInstance = config.get("COS_INSTANCE"); + ownershipToken = config.get("OWNERSHIP_TOKEN"); + + // set mock values for global params + try { + service = LogpushJobsApi.newInstance(crn, dataset, zoneId, serviceName); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + System.out.println("Setup complete."); + + // Clean up all existing logpush jobs before tests (like Go SDK BeforeEach) + cleanupAllJobs(); + } + + private void cleanupAllJobs() { + try { + GetLogpushJobsV2Options listOptions = new GetLogpushJobsV2Options(); + Response listResponse = service.getLogpushJobsV2(listOptions).execute(); + + if (listResponse != null && listResponse.getResult() != null && listResponse.getResult().getResult() != null) { + for (LogpushJobPack job : listResponse.getResult().getResult()) { + try { + DeleteLogpushJobV2Options deleteOptions = new DeleteLogpushJobV2Options.Builder() + .jobId(String.valueOf(job.getId())) + .build(); + service.deleteLogpushJobV2(deleteOptions).execute(); + } catch (Exception e) { + System.err.println("Failed to delete job " + job.getId() + ": " + e.getMessage()); + } + } + } + } catch (Exception e) { + System.err.println("Cleanup failed: " + e.getMessage()); + } + } + + @AfterClass + public void cleanup() { + // Clean up all logpush jobs after tests + if (skipTests()) { + return; + } + + try { + GetLogpushJobsV2Options listOptions = new GetLogpushJobsV2Options(); + Response listResponse = service.getLogpushJobsV2(listOptions).execute(); + + if (listResponse != null && listResponse.getResult() != null && listResponse.getResult().getResult() != null) { + for (LogpushJobPack job : listResponse.getResult().getResult()) { + try { + DeleteLogpushJobV2Options deleteOptions = new DeleteLogpushJobV2Options.Builder() + .jobId(String.valueOf(job.getId())) + .build(); + service.deleteLogpushJobV2(deleteOptions).execute(); + } catch (Exception e) { + System.err.println("Failed to delete job " + job.getId() + ": " + e.getMessage()); + } + } + } + } catch (Exception e) { + System.err.println("Cleanup failed: " + e.getMessage()); + } + } + + @Test + public void testListLogpushJobs() throws Exception { + try { + GetLogpushJobsV2Options getLogpushJobsV2Options = new GetLogpushJobsV2Options(); + + // Invoke operation + Response response = service.getLogpushJobsV2(getLogpushJobsV2Options).execute(); + + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ListLogpushJobsResp listLogpushJobsRespResult = response.getResult(); + assertNotNull(listLogpushJobsRespResult); + assertTrue(listLogpushJobsRespResult.isSuccess()); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testCreateUpdateDeleteLogpushJobCOS() throws Exception { + try { + // Create logpush job for COS + Map cosConfig = new HashMap<>(); + cosConfig.put("bucket", cosBucket); + cosConfig.put("region", cosRegion); + cosConfig.put("instance_id", cosInstance); + + CreateLogpushJobV2RequestLogpushJobCosReq createRequest = + new CreateLogpushJobV2RequestLogpushJobCosReq.Builder() + .name("Test COS Job") + .enabled(false) + .logpullOptions("timestamps=rfc3339") + .cos(cosConfig) + .dataset(dataset) + .frequency("high") + .build(); + + CreateLogpushJobV2Options createOptions = new CreateLogpushJobV2Options.Builder() + .createLogpushJobV2Request(createRequest) + .build(); + + Response createResponse = service.createLogpushJobV2(createOptions).execute(); + + assertNotNull(createResponse); + assertEquals(createResponse.getStatusCode(), 201); + + LogpushJobsResp createResult = createResponse.getResult(); + assertNotNull(createResult); + assertTrue(createResult.isSuccess()); + assertNotNull(createResult.getResult()); + + Long jobId = createResult.getResult().getId(); + assertNotNull(jobId); + + // Get the created job + GetLogpushJobV2Options getOptions = new GetLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .build(); + + Response getResponse = service.getLogpushJobV2(getOptions).execute(); + assertNotNull(getResponse); + assertEquals(getResponse.getStatusCode(), 200); + + LogpushJobsResp getResult = getResponse.getResult(); + assertNotNull(getResult); + assertTrue(getResult.isSuccess()); + + // Update the job + Map updatedCosConfig = new HashMap<>(); + updatedCosConfig.put("bucket", cosBucket); + updatedCosConfig.put("region", cosRegion); + updatedCosConfig.put("instance_id", cosInstance); + + UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq updateRequest = + new UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq.Builder() + .enabled(true) + .logpullOptions("timestamps=rfc3339") + .cos(updatedCosConfig) + .frequency("high") + .build(); + + UpdateLogpushJobV2Options updateOptions = new UpdateLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .updateLogpushJobV2Request(updateRequest) + .build(); + + Response updateResponse = service.updateLogpushJobV2(updateOptions).execute(); + assertNotNull(updateResponse); + assertEquals(updateResponse.getStatusCode(), 200); + + LogpushJobsResp updateResult = updateResponse.getResult(); + assertNotNull(updateResult); + assertTrue(updateResult.isSuccess()); + + // Delete the job + DeleteLogpushJobV2Options deleteOptions = new DeleteLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .build(); + + Response deleteResponse = service.deleteLogpushJobV2(deleteOptions).execute(); + assertNotNull(deleteResponse); + assertEquals(deleteResponse.getStatusCode(), 200); + + DeleteLogpushJobResp deleteResult = deleteResponse.getResult(); + assertNotNull(deleteResult); + assertTrue(deleteResult.isSuccess()); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testCreateUpdateDeleteLogpushJobLogDNA() throws Exception { + try { + // Create logpush job for LogDNA + Map logdnaConfig = new HashMap<>(); + logdnaConfig.put("ingress_key", ingressKey); + logdnaConfig.put("region", logdnaRegion); + logdnaConfig.put("hostname", logdnaDomain); + + CreateLogpushJobV2RequestLogpushJobLogdnaReq createRequest = + new CreateLogpushJobV2RequestLogpushJobLogdnaReq.Builder() + .name("Test LogDNA Job") + .enabled(false) + .logpullOptions("timestamps=rfc3339") + .logdna(logdnaConfig) + .dataset(dataset) + .frequency("high") + .build(); + + CreateLogpushJobV2Options createOptions = new CreateLogpushJobV2Options.Builder() + .createLogpushJobV2Request(createRequest) + .build(); + + Response createResponse = service.createLogpushJobV2(createOptions).execute(); + + assertNotNull(createResponse); + assertEquals(createResponse.getStatusCode(), 201); + + LogpushJobsResp createResult = createResponse.getResult(); + assertNotNull(createResult); + assertTrue(createResult.isSuccess()); + assertNotNull(createResult.getResult()); + + Long jobId = createResult.getResult().getId(); + assertNotNull(jobId); + + // Update the job + Map updatedLogdnaConfig = new HashMap<>(); + updatedLogdnaConfig.put("ingress_key", ingressKey); + updatedLogdnaConfig.put("region", logdnaRegion); + updatedLogdnaConfig.put("hostname", logdnaDomain); + + UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq updateRequest = + new UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.Builder() + .enabled(true) + .logpullOptions("timestamps=rfc3339") + .logdna(updatedLogdnaConfig) + .frequency("high") + .build(); + + UpdateLogpushJobV2Options updateOptions = new UpdateLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .updateLogpushJobV2Request(updateRequest) + .build(); + + Response updateResponse = service.updateLogpushJobV2(updateOptions).execute(); + assertNotNull(updateResponse); + assertEquals(updateResponse.getStatusCode(), 200); + + LogpushJobsResp updateResult = updateResponse.getResult(); + assertNotNull(updateResult); + assertTrue(updateResult.isSuccess()); + + // Delete the job + DeleteLogpushJobV2Options deleteOptions = new DeleteLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .build(); + + Response deleteResponse = service.deleteLogpushJobV2(deleteOptions).execute(); + assertNotNull(deleteResponse); + assertEquals(deleteResponse.getStatusCode(), 200); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testListFieldsForDataset() throws Exception { + try { + ListFieldsForDatasetV2Options listFieldsOptions = new ListFieldsForDatasetV2Options(); + + Response response = service.listFieldsForDatasetV2(listFieldsOptions).execute(); + + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ListFieldsResp listFieldsRespResult = response.getResult(); + assertNotNull(listFieldsRespResult); + assertTrue(listFieldsRespResult.isSuccess()); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testGetLogsRetention() throws Exception { + try { + GetLogsRetentionOptions getLogsRetentionOptions = new GetLogsRetentionOptions(); + + Response response = service.getLogsRetention(getLogsRetentionOptions).execute(); + + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + LogRetentionResp logRetentionRespResult = response.getResult(); + assertNotNull(logRetentionRespResult); + assertTrue(logRetentionRespResult.isSuccess()); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testCreateUpdateDeleteLogpushJobGeneric() throws Exception { + try { + // Create logpush job with generic destination (S3) + CreateLogpushJobV2RequestLogpushJobGenericReq createRequest = + new CreateLogpushJobV2RequestLogpushJobGenericReq.Builder() + .name("Test Generic Job") + .enabled(false) + .logpullOptions("timestamps=rfc3339") + .destinationConf("s3://mybucket/logs?region=us-west-2") + .dataset(dataset) + .frequency("high") + .build(); + + CreateLogpushJobV2Options createOptions = new CreateLogpushJobV2Options.Builder() + .createLogpushJobV2Request(createRequest) + .build(); + + Response createResponse = service.createLogpushJobV2(createOptions).execute(); + + assertNotNull(createResponse); + assertEquals(createResponse.getStatusCode(), 201); + + LogpushJobsResp createResult = createResponse.getResult(); + assertNotNull(createResult); + assertTrue(createResult.isSuccess()); + assertNotNull(createResult.getResult()); + + Long jobId = createResult.getResult().getId(); + assertNotNull(jobId); + + // Get the created job + GetLogpushJobV2Options getOptions = new GetLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .build(); + + Response getResponse = service.getLogpushJobV2(getOptions).execute(); + assertNotNull(getResponse); + assertEquals(getResponse.getStatusCode(), 200); + + // Update the job + UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq updateRequest = + new UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq.Builder() + .enabled(false) + .logpullOptions("timestamps=rfc3339") + .destinationConf("s3://mybucket/logs?region=us-west-1") + .frequency("high") + .build(); + + UpdateLogpushJobV2Options updateOptions = new UpdateLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .updateLogpushJobV2Request(updateRequest) + .build(); + + Response updateResponse = service.updateLogpushJobV2(updateOptions).execute(); + assertNotNull(updateResponse); + assertEquals(updateResponse.getStatusCode(), 200); + + LogpushJobsResp updateResult = updateResponse.getResult(); + assertNotNull(updateResult); + assertTrue(updateResult.isSuccess()); + + // Delete the job + DeleteLogpushJobV2Options deleteOptions = new DeleteLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .build(); + + Response deleteResponse = service.deleteLogpushJobV2(deleteOptions).execute(); + assertNotNull(deleteResponse); + assertEquals(deleteResponse.getStatusCode(), 200); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testCreateUpdateDeleteLogpushJobCustomHTTP() throws Exception { + try { + // Create logpush job with custom HTTP destination + CreateLogpushJobV2RequestLogpushJobGenericReq createRequest = + new CreateLogpushJobV2RequestLogpushJobGenericReq.Builder() + .name("Test HTTP Job") + .enabled(false) + .logpullOptions("fields=ClientIP,ClientRequestHost,ClientRequestMethod") + .destinationConf("https://httpbin.org/post") + .dataset(dataset) + .frequency("high") + .build(); + + CreateLogpushJobV2Options createOptions = new CreateLogpushJobV2Options.Builder() + .createLogpushJobV2Request(createRequest) + .build(); + + Response createResponse = service.createLogpushJobV2(createOptions).execute(); + + assertNotNull(createResponse); + assertEquals(createResponse.getStatusCode(), 201); + + LogpushJobsResp createResult = createResponse.getResult(); + assertNotNull(createResult); + assertTrue(createResult.isSuccess()); + assertNotNull(createResult.getResult()); + + Long jobId = createResult.getResult().getId(); + assertNotNull(jobId); + + // List all jobs + GetLogpushJobsV2Options listOptions = new GetLogpushJobsV2Options(); + Response listResponse = service.getLogpushJobsV2(listOptions).execute(); + assertNotNull(listResponse); + assertNotNull(listResponse.getResult()); + + // Get the created job + GetLogpushJobV2Options getOptions = new GetLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .build(); + + Response getResponse = service.getLogpushJobV2(getOptions).execute(); + assertNotNull(getResponse); + assertEquals(getResponse.getStatusCode(), 200); + + // Update the job + UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq updateRequest = + new UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq.Builder() + .enabled(false) + .logpullOptions("fields=ClientIP,ClientRequestHost") + .destinationConf("https://httpbin.org/post") + .frequency("high") + .build(); + + UpdateLogpushJobV2Options updateOptions = new UpdateLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .updateLogpushJobV2Request(updateRequest) + .build(); + + Response updateResponse = service.updateLogpushJobV2(updateOptions).execute(); + assertNotNull(updateResponse); + assertEquals(updateResponse.getStatusCode(), 200); + + // Delete the job + DeleteLogpushJobV2Options deleteOptions = new DeleteLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .build(); + + Response deleteResponse = service.deleteLogpushJobV2(deleteOptions).execute(); + assertNotNull(deleteResponse); + assertEquals(deleteResponse.getStatusCode(), 200); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testCreateUpdateDeleteLogpushJobIBMCL() throws Exception { + try { + // Create logpush job for IBM Cloud Logs + String ibmclInstanceId = config.get("CIS_IBMCL_INSTANCE_ID"); + String apiKey = config.get("CIS_SERVICES_APIKEY"); + + if (ibmclInstanceId == null || apiKey == null) { + System.out.println("Skipping IBMCL test - missing CIS_IBMCL_INSTANCE_ID or CIS_SERVICES_APIKEY"); + return; + } + + LogpushJobIbmclReqIbmcl ibmclConfig = new LogpushJobIbmclReqIbmcl.Builder() + .instanceId(ibmclInstanceId) + .region("us-south") + .apiKey(apiKey) + .build(); + + CreateLogpushJobV2RequestLogpushJobIbmclReq createRequest = + new CreateLogpushJobV2RequestLogpushJobIbmclReq.Builder() + .name("Test IBMCL Job") + .enabled(false) + .logpullOptions("timestamps=rfc3339") + .ibmcl(ibmclConfig) + .dataset(dataset) + .frequency("high") + .build(); + + CreateLogpushJobV2Options createOptions = new CreateLogpushJobV2Options.Builder() + .createLogpushJobV2Request(createRequest) + .build(); + + Response createResponse = service.createLogpushJobV2(createOptions).execute(); + + assertNotNull(createResponse); + assertEquals(createResponse.getStatusCode(), 201); + + LogpushJobsResp createResult = createResponse.getResult(); + assertNotNull(createResult); + assertTrue(createResult.isSuccess()); + assertNotNull(createResult.getResult()); + + Long jobId = createResult.getResult().getId(); + assertNotNull(jobId); + + // Get the created job + GetLogpushJobV2Options getOptions = new GetLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .build(); + + Response getResponse = service.getLogpushJobV2(getOptions).execute(); + assertNotNull(getResponse); + assertEquals(getResponse.getStatusCode(), 200); + + // Update the job (using COS update model as in Go SDK) + UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq updateRequest = + new UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq.Builder() + .enabled(false) + .logpullOptions("timestamps=rfc3339") + .frequency("low") + .build(); + + UpdateLogpushJobV2Options updateOptions = new UpdateLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .updateLogpushJobV2Request(updateRequest) + .build(); + + Response updateResponse = service.updateLogpushJobV2(updateOptions).execute(); + assertNotNull(updateResponse); + assertEquals(updateResponse.getStatusCode(), 200); + + // Delete the job + DeleteLogpushJobV2Options deleteOptions = new DeleteLogpushJobV2Options.Builder() + .jobId(String.valueOf(jobId)) + .build(); + + Response deleteResponse = service.deleteLogpushJobV2(deleteOptions).execute(); + assertNotNull(deleteResponse); + assertEquals(deleteResponse.getStatusCode(), 200); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testOwnershipValidation() throws Exception { + try { + // Send ownership challenge to destination + Map cosConfig = new HashMap<>(); + cosConfig.put("bucket_name", cosBucket); + cosConfig.put("region", cosRegion); + cosConfig.put("id", cosInstance); + + GetLogpushOwnershipV2Options ownershipOptions = new GetLogpushOwnershipV2Options.Builder() + .cos(cosConfig) + .build(); + + Response ownershipResponse = service.getLogpushOwnershipV2(ownershipOptions).execute(); + + assertNotNull(ownershipResponse); + assertEquals(ownershipResponse.getStatusCode(), 200); + + OwnershipChallengeResp ownershipResult = ownershipResponse.getResult(); + assertNotNull(ownershipResult); + assertTrue(ownershipResult.isSuccess()); + + // Validate ownership challenge + ValidateLogpushOwnershipChallengeV2Options validationOptions = + new ValidateLogpushOwnershipChallengeV2Options.Builder() + .cos(cosConfig) + .ownershipChallenge(ownershipToken) + .build(); + + Response validationResponse = + service.validateLogpushOwnershipChallengeV2(validationOptions).execute(); + + assertNotNull(validationResponse); + assertEquals(validationResponse.getStatusCode(), 200); + + OwnershipChallengeValidateResult validationResult = validationResponse.getResult(); + assertNotNull(validationResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test + public void testListLogpushJobsForDataset() throws Exception { + try { + ListLogpushJobsForDatasetV2Options listJobsOptions = new ListLogpushJobsForDatasetV2Options(); + + Response response = service.listLogpushJobsForDatasetV2(listJobsOptions).execute(); + + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + LogpushJobsResp listJobsRespResult = response.getResult(); + assertNotNull(listJobsRespResult); + // Note: success field may not be present in this response, so we just check it's not null + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s\nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } +} + +// Made with Bob diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/LogpushJobsApiTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/LogpushJobsApiTest.java new file mode 100644 index 000000000..89571b2ca --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/LogpushJobsApiTest.java @@ -0,0 +1,665 @@ +/* + * (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.logpush_jobs_api.v1; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.LogpushJobsApi; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogRetentionOptions; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2Request; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2RequestLogpushJobCosReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2RequestLogpushJobGenericReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2RequestLogpushJobIbmclReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2RequestLogpushJobLogdnaReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.DeleteLogpushJobResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.DeleteLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogpushJobsV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogpushOwnershipV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogsRetentionOptions; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListFieldsForDatasetV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListFieldsResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListLogpushJobsForDatasetV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListLogpushJobsResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogRetentionResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogRetentionRespResult; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobIbmclReqIbmcl; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobPack; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobsResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobsUpdateIbmclReqIbmcl; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.OwnershipChallengeResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.OwnershipChallengeResult; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.OwnershipChallengeValidateResult; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2Request; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ValidateLogpushOwnershipChallengeV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.security.Authenticator; +import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the LogpushJobsApi service. + */ +public class LogpushJobsApiTest { + + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + protected MockWebServer server; + protected LogpushJobsApi logpushJobsApiService; + + // Construct the service with a null authenticator (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testConstructorWithNullAuthenticator() throws Throwable { + final String serviceName = "testService"; + // Set mock values for global params + String crn = "testString"; + String dataset = "testString"; + String zoneId = "testString"; + new LogpushJobsApi(crn, dataset, zoneId, serviceName, null); + } + + + // Test the getter for the crn global parameter + @Test + public void testGetCrn() throws Throwable { + assertEquals(logpushJobsApiService.getCrn(), "testString"); + } + + + // Test the getter for the dataset global parameter + @Test + public void testGetDataset() throws Throwable { + assertEquals(logpushJobsApiService.getDataset(), "testString"); + } + + + // Test the getter for the zoneId global parameter + @Test + public void testGetZoneId() throws Throwable { + assertEquals(logpushJobsApiService.getZoneId(), "testString"); + } + + // Test the getLogpushJobsV2 operation with a valid options model parameter + @Test + public void testGetLogpushJobsV2WOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": [{\"id\": 5850, \"name\": \"My log push job\", \"enabled\": false, \"dataset\": \"firewall_events\", \"frequency\": \"high\", \"logpull_options\": \"timestamps=rfc3339×tamps=rfc3339\", \"destination_conf\": \"cos://cos-bucket001?region=us-south&instance-id=231f5467-3072-4cb9-9e39-a906fa3032ea\", \"last_complete\": \"2022-01-15T16:33:31.834209Z\", \"last_error\": \"2022-01-15T16:33:31.834209Z\", \"error_message\": \"errorMessage\"}]}"; + String getLogpushJobsV2Path = "/v2/testString/zones/testString/logpush/jobs"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetLogpushJobsV2Options model + GetLogpushJobsV2Options getLogpushJobsV2OptionsModel = new GetLogpushJobsV2Options(); + + // Invoke getLogpushJobsV2() with a valid options model and verify the result + Response response = logpushJobsApiService.getLogpushJobsV2(getLogpushJobsV2OptionsModel).execute(); + assertNotNull(response); + ListLogpushJobsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getLogpushJobsV2Path); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getLogpushJobsV2 operation with and without retries enabled + @Test + public void testGetLogpushJobsV2WRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testGetLogpushJobsV2WOptions(); + + logpushJobsApiService.disableRetries(); + testGetLogpushJobsV2WOptions(); + } + + // Test the createLogpushJobV2 operation with a valid options model parameter + @Test + public void testCreateLogpushJobV2WOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": 5850, \"name\": \"My log push job\", \"enabled\": false, \"dataset\": \"firewall_events\", \"frequency\": \"high\", \"logpull_options\": \"timestamps=rfc3339×tamps=rfc3339\", \"destination_conf\": \"cos://cos-bucket001?region=us-south&instance-id=231f5467-3072-4cb9-9e39-a906fa3032ea\", \"last_complete\": \"2022-01-15T16:33:31.834209Z\", \"last_error\": \"2022-01-15T16:33:31.834209Z\", \"error_message\": \"errorMessage\"}}"; + String createLogpushJobV2Path = "/v2/testString/zones/testString/logpush/jobs"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateLogpushJobV2RequestLogpushJobCosReq model + CreateLogpushJobV2RequestLogpushJobCosReq createLogpushJobV2RequestModel = new CreateLogpushJobV2RequestLogpushJobCosReq.Builder() + .name("My log push job") + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .ownershipChallenge("00000000000000000000000000000000") + .dataset("http_requests") + .frequency("high") + .build(); + + // Construct an instance of the CreateLogpushJobV2Options model + CreateLogpushJobV2Options createLogpushJobV2OptionsModel = new CreateLogpushJobV2Options.Builder() + .createLogpushJobV2Request(createLogpushJobV2RequestModel) + .build(); + + // Invoke createLogpushJobV2() with a valid options model and verify the result + Response response = logpushJobsApiService.createLogpushJobV2(createLogpushJobV2OptionsModel).execute(); + assertNotNull(response); + LogpushJobsResp responseObj = 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, createLogpushJobV2Path); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createLogpushJobV2 operation with and without retries enabled + @Test + public void testCreateLogpushJobV2WRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testCreateLogpushJobV2WOptions(); + + logpushJobsApiService.disableRetries(); + testCreateLogpushJobV2WOptions(); + } + + // Test the getLogpushJobV2 operation with a valid options model parameter + @Test + public void testGetLogpushJobV2WOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": 5850, \"name\": \"My log push job\", \"enabled\": false, \"dataset\": \"firewall_events\", \"frequency\": \"high\", \"logpull_options\": \"timestamps=rfc3339×tamps=rfc3339\", \"destination_conf\": \"cos://cos-bucket001?region=us-south&instance-id=231f5467-3072-4cb9-9e39-a906fa3032ea\", \"last_complete\": \"2022-01-15T16:33:31.834209Z\", \"last_error\": \"2022-01-15T16:33:31.834209Z\", \"error_message\": \"errorMessage\"}}"; + String getLogpushJobV2Path = "/v2/testString/zones/testString/logpush/jobs/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetLogpushJobV2Options model + GetLogpushJobV2Options getLogpushJobV2OptionsModel = new GetLogpushJobV2Options.Builder() + .jobId("testString") + .build(); + + // Invoke getLogpushJobV2() with a valid options model and verify the result + Response response = logpushJobsApiService.getLogpushJobV2(getLogpushJobV2OptionsModel).execute(); + assertNotNull(response); + LogpushJobsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getLogpushJobV2Path); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getLogpushJobV2 operation with and without retries enabled + @Test + public void testGetLogpushJobV2WRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testGetLogpushJobV2WOptions(); + + logpushJobsApiService.disableRetries(); + testGetLogpushJobV2WOptions(); + } + + // Test the getLogpushJobV2 operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetLogpushJobV2NoOptions() throws Throwable { + server.enqueue(new MockResponse()); + logpushJobsApiService.getLogpushJobV2(null).execute(); + } + + // Test the updateLogpushJobV2 operation with a valid options model parameter + @Test + public void testUpdateLogpushJobV2WOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": 5850, \"name\": \"My log push job\", \"enabled\": false, \"dataset\": \"firewall_events\", \"frequency\": \"high\", \"logpull_options\": \"timestamps=rfc3339×tamps=rfc3339\", \"destination_conf\": \"cos://cos-bucket001?region=us-south&instance-id=231f5467-3072-4cb9-9e39-a906fa3032ea\", \"last_complete\": \"2022-01-15T16:33:31.834209Z\", \"last_error\": \"2022-01-15T16:33:31.834209Z\", \"error_message\": \"errorMessage\"}}"; + String updateLogpushJobV2Path = "/v2/testString/zones/testString/logpush/jobs/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq model + UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq updateLogpushJobV2RequestModel = new UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq.Builder() + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .ownershipChallenge("00000000000000000000000000000000") + .frequency("high") + .build(); + + // Construct an instance of the UpdateLogpushJobV2Options model + UpdateLogpushJobV2Options updateLogpushJobV2OptionsModel = new UpdateLogpushJobV2Options.Builder() + .jobId("testString") + .updateLogpushJobV2Request(updateLogpushJobV2RequestModel) + .build(); + + // Invoke updateLogpushJobV2() with a valid options model and verify the result + Response response = logpushJobsApiService.updateLogpushJobV2(updateLogpushJobV2OptionsModel).execute(); + assertNotNull(response); + LogpushJobsResp responseObj = 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, updateLogpushJobV2Path); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateLogpushJobV2 operation with and without retries enabled + @Test + public void testUpdateLogpushJobV2WRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testUpdateLogpushJobV2WOptions(); + + logpushJobsApiService.disableRetries(); + testUpdateLogpushJobV2WOptions(); + } + + // Test the updateLogpushJobV2 operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateLogpushJobV2NoOptions() throws Throwable { + server.enqueue(new MockResponse()); + logpushJobsApiService.updateLogpushJobV2(null).execute(); + } + + // Test the deleteLogpushJobV2 operation with a valid options model parameter + @Test + public void testDeleteLogpushJobV2WOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"anyKey\": \"anyValue\"}}"; + String deleteLogpushJobV2Path = "/v2/testString/zones/testString/logpush/jobs/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteLogpushJobV2Options model + DeleteLogpushJobV2Options deleteLogpushJobV2OptionsModel = new DeleteLogpushJobV2Options.Builder() + .jobId("testString") + .build(); + + // Invoke deleteLogpushJobV2() with a valid options model and verify the result + Response response = logpushJobsApiService.deleteLogpushJobV2(deleteLogpushJobV2OptionsModel).execute(); + assertNotNull(response); + DeleteLogpushJobResp responseObj = 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, deleteLogpushJobV2Path); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the deleteLogpushJobV2 operation with and without retries enabled + @Test + public void testDeleteLogpushJobV2WRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testDeleteLogpushJobV2WOptions(); + + logpushJobsApiService.disableRetries(); + testDeleteLogpushJobV2WOptions(); + } + + // Test the deleteLogpushJobV2 operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteLogpushJobV2NoOptions() throws Throwable { + server.enqueue(new MockResponse()); + logpushJobsApiService.deleteLogpushJobV2(null).execute(); + } + + // Test the getLogpushOwnershipV2 operation with a valid options model parameter + @Test + public void testGetLogpushOwnershipV2WOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"filename\": \"logs/challenge-filename.txt\", \"valid\": true, \"messages\": \"messages\"}}"; + String getLogpushOwnershipV2Path = "/v2/testString/zones/testString/logpush/ownership"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetLogpushOwnershipV2Options model + GetLogpushOwnershipV2Options getLogpushOwnershipV2OptionsModel = new GetLogpushOwnershipV2Options.Builder() + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .build(); + + // Invoke getLogpushOwnershipV2() with a valid options model and verify the result + Response response = logpushJobsApiService.getLogpushOwnershipV2(getLogpushOwnershipV2OptionsModel).execute(); + assertNotNull(response); + OwnershipChallengeResp responseObj = 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, getLogpushOwnershipV2Path); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getLogpushOwnershipV2 operation with and without retries enabled + @Test + public void testGetLogpushOwnershipV2WRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testGetLogpushOwnershipV2WOptions(); + + logpushJobsApiService.disableRetries(); + testGetLogpushOwnershipV2WOptions(); + } + + // Test the validateLogpushOwnershipChallengeV2 operation with a valid options model parameter + @Test + public void testValidateLogpushOwnershipChallengeV2WOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"valid\": true}"; + String validateLogpushOwnershipChallengeV2Path = "/v2/testString/zones/testString/logpush/ownership/validate"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ValidateLogpushOwnershipChallengeV2Options model + ValidateLogpushOwnershipChallengeV2Options validateLogpushOwnershipChallengeV2OptionsModel = new ValidateLogpushOwnershipChallengeV2Options.Builder() + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .ownershipChallenge("00000000000000000000") + .build(); + + // Invoke validateLogpushOwnershipChallengeV2() with a valid options model and verify the result + Response response = logpushJobsApiService.validateLogpushOwnershipChallengeV2(validateLogpushOwnershipChallengeV2OptionsModel).execute(); + assertNotNull(response); + OwnershipChallengeValidateResult responseObj = 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, validateLogpushOwnershipChallengeV2Path); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the validateLogpushOwnershipChallengeV2 operation with and without retries enabled + @Test + public void testValidateLogpushOwnershipChallengeV2WRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testValidateLogpushOwnershipChallengeV2WOptions(); + + logpushJobsApiService.disableRetries(); + testValidateLogpushOwnershipChallengeV2WOptions(); + } + + // Test the listFieldsForDatasetV2 operation with a valid options model parameter + @Test + public void testListFieldsForDatasetV2WOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"anyKey\": \"anyValue\"}}"; + String listFieldsForDatasetV2Path = "/v2/testString/zones/testString/logpush/datasets/testString/fields"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListFieldsForDatasetV2Options model + ListFieldsForDatasetV2Options listFieldsForDatasetV2OptionsModel = new ListFieldsForDatasetV2Options(); + + // Invoke listFieldsForDatasetV2() with a valid options model and verify the result + Response response = logpushJobsApiService.listFieldsForDatasetV2(listFieldsForDatasetV2OptionsModel).execute(); + assertNotNull(response); + ListFieldsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, listFieldsForDatasetV2Path); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the listFieldsForDatasetV2 operation with and without retries enabled + @Test + public void testListFieldsForDatasetV2WRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testListFieldsForDatasetV2WOptions(); + + logpushJobsApiService.disableRetries(); + testListFieldsForDatasetV2WOptions(); + } + + // Test the listLogpushJobsForDatasetV2 operation with a valid options model parameter + @Test + public void testListLogpushJobsForDatasetV2WOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]], \"result\": {\"id\": 5850, \"name\": \"My log push job\", \"enabled\": false, \"dataset\": \"firewall_events\", \"frequency\": \"high\", \"logpull_options\": \"timestamps=rfc3339×tamps=rfc3339\", \"destination_conf\": \"cos://cos-bucket001?region=us-south&instance-id=231f5467-3072-4cb9-9e39-a906fa3032ea\", \"last_complete\": \"2022-01-15T16:33:31.834209Z\", \"last_error\": \"2022-01-15T16:33:31.834209Z\", \"error_message\": \"errorMessage\"}}"; + String listLogpushJobsForDatasetV2Path = "/v2/testString/zones/testString/logpush/datasets/testString/jobs"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListLogpushJobsForDatasetV2Options model + ListLogpushJobsForDatasetV2Options listLogpushJobsForDatasetV2OptionsModel = new ListLogpushJobsForDatasetV2Options(); + + // Invoke listLogpushJobsForDatasetV2() with a valid options model and verify the result + Response response = logpushJobsApiService.listLogpushJobsForDatasetV2(listLogpushJobsForDatasetV2OptionsModel).execute(); + assertNotNull(response); + LogpushJobsResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, listLogpushJobsForDatasetV2Path); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the listLogpushJobsForDatasetV2 operation with and without retries enabled + @Test + public void testListLogpushJobsForDatasetV2WRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testListLogpushJobsForDatasetV2WOptions(); + + logpushJobsApiService.disableRetries(); + testListLogpushJobsForDatasetV2WOptions(); + } + + // Test the getLogsRetention operation with a valid options model parameter + @Test + public void testGetLogsRetentionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"result\": {\"flag\": true}, \"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]]}"; + String getLogsRetentionPath = "/v1/testString/zones/testString/logs/retention"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetLogsRetentionOptions model + GetLogsRetentionOptions getLogsRetentionOptionsModel = new GetLogsRetentionOptions(); + + // Invoke getLogsRetention() with a valid options model and verify the result + Response response = logpushJobsApiService.getLogsRetention(getLogsRetentionOptionsModel).execute(); + assertNotNull(response); + LogRetentionResp responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getLogsRetentionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getLogsRetention operation with and without retries enabled + @Test + public void testGetLogsRetentionWRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testGetLogsRetentionWOptions(); + + logpushJobsApiService.disableRetries(); + testGetLogsRetentionWOptions(); + } + + // Test the createLogRetention operation with a valid options model parameter + @Test + public void testCreateLogRetentionWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"result\": {\"flag\": true}, \"success\": true, \"errors\": [[\"errors\"]], \"messages\": [[\"messages\"]]}"; + String createLogRetentionPath = "/v1/testString/zones/testString/logs/retention"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateLogRetentionOptions model + CreateLogRetentionOptions createLogRetentionOptionsModel = new CreateLogRetentionOptions.Builder() + .flag(false) + .build(); + + // Invoke createLogRetention() with a valid options model and verify the result + Response response = logpushJobsApiService.createLogRetention(createLogRetentionOptionsModel).execute(); + assertNotNull(response); + LogRetentionResp responseObj = 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, createLogRetentionPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createLogRetention operation with and without retries enabled + @Test + public void testCreateLogRetentionWRetries() throws Throwable { + logpushJobsApiService.enableRetries(4, 30); + testCreateLogRetentionWOptions(); + + logpushJobsApiService.disableRetries(); + testCreateLogRetentionWOptions(); + } + + // 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(); + logpushJobsApiService = null; + } + + // Constructs an instance of the service to be used by the tests + public void constructClientService() { + System.setProperty("TESTSERVICE_AUTH_TYPE", "noAuth"); + final String serviceName = "testService"; + // set mock values for global params + String crn = "testString"; + String dataset = "testString"; + String zoneId = "testString"; + + logpushJobsApiService = LogpushJobsApi.newInstance(crn, dataset, zoneId, serviceName); + String url = server.url("/").toString(); + logpushJobsApiService.setServiceUrl(url); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogRetentionOptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogRetentionOptionsTest.java new file mode 100644 index 000000000..051b003a7 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogRetentionOptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogRetentionOptions; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateLogRetentionOptions model. + */ +public class CreateLogRetentionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateLogRetentionOptions() throws Throwable { + CreateLogRetentionOptions createLogRetentionOptionsModel = new CreateLogRetentionOptions.Builder() + .flag(false) + .build(); + assertEquals(createLogRetentionOptionsModel.flag(), Boolean.valueOf(false)); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2OptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2OptionsTest.java new file mode 100644 index 000000000..faacccac5 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2OptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2RequestLogpushJobCosReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateLogpushJobV2Options model. + */ +public class CreateLogpushJobV2OptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateLogpushJobV2Options() throws Throwable { + CreateLogpushJobV2RequestLogpushJobCosReq createLogpushJobV2RequestModel = new CreateLogpushJobV2RequestLogpushJobCosReq.Builder() + .name("My log push job") + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .ownershipChallenge("00000000000000000000000000000000") + .dataset("http_requests") + .frequency("high") + .build(); + assertEquals(createLogpushJobV2RequestModel.name(), "My log push job"); + assertEquals(createLogpushJobV2RequestModel.enabled(), Boolean.valueOf(false)); + assertEquals(createLogpushJobV2RequestModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(createLogpushJobV2RequestModel.cos(), java.util.Collections.singletonMap("anyKey", "anyValue")); + assertEquals(createLogpushJobV2RequestModel.ownershipChallenge(), "00000000000000000000000000000000"); + assertEquals(createLogpushJobV2RequestModel.dataset(), "http_requests"); + assertEquals(createLogpushJobV2RequestModel.frequency(), "high"); + + CreateLogpushJobV2Options createLogpushJobV2OptionsModel = new CreateLogpushJobV2Options.Builder() + .createLogpushJobV2Request(createLogpushJobV2RequestModel) + .build(); + assertEquals(createLogpushJobV2OptionsModel.createLogpushJobV2Request(), createLogpushJobV2RequestModel); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobCosReqTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobCosReqTest.java new file mode 100644 index 000000000..5e3992798 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobCosReqTest.java @@ -0,0 +1,69 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2RequestLogpushJobCosReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateLogpushJobV2RequestLogpushJobCosReq model. + */ +public class CreateLogpushJobV2RequestLogpushJobCosReqTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateLogpushJobV2RequestLogpushJobCosReq() throws Throwable { + CreateLogpushJobV2RequestLogpushJobCosReq createLogpushJobV2RequestLogpushJobCosReqModel = new CreateLogpushJobV2RequestLogpushJobCosReq.Builder() + .name("My log push job") + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .ownershipChallenge("00000000000000000000000000000000") + .dataset("http_requests") + .frequency("high") + .build(); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModel.name(), "My log push job"); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModel.enabled(), Boolean.valueOf(false)); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModel.cos(), java.util.Collections.singletonMap("anyKey", "anyValue")); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModel.ownershipChallenge(), "00000000000000000000000000000000"); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModel.dataset(), "http_requests"); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModel.frequency(), "high"); + + String json = TestUtilities.serialize(createLogpushJobV2RequestLogpushJobCosReqModel); + + CreateLogpushJobV2RequestLogpushJobCosReq createLogpushJobV2RequestLogpushJobCosReqModelNew = TestUtilities.deserialize(json, CreateLogpushJobV2RequestLogpushJobCosReq.class); + assertTrue(createLogpushJobV2RequestLogpushJobCosReqModelNew instanceof CreateLogpushJobV2RequestLogpushJobCosReq); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModelNew.name(), "My log push job"); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModelNew.enabled(), Boolean.valueOf(false)); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModelNew.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModelNew.cos().toString(), java.util.Collections.singletonMap("anyKey", "anyValue").toString()); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModelNew.ownershipChallenge(), "00000000000000000000000000000000"); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModelNew.dataset(), "http_requests"); + assertEquals(createLogpushJobV2RequestLogpushJobCosReqModelNew.frequency(), "high"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateLogpushJobV2RequestLogpushJobCosReqError() throws Throwable { + new CreateLogpushJobV2RequestLogpushJobCosReq.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobGenericReqTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobGenericReqTest.java new file mode 100644 index 000000000..63739aade --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobGenericReqTest.java @@ -0,0 +1,66 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2RequestLogpushJobGenericReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateLogpushJobV2RequestLogpushJobGenericReq model. + */ +public class CreateLogpushJobV2RequestLogpushJobGenericReqTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateLogpushJobV2RequestLogpushJobGenericReq() throws Throwable { + CreateLogpushJobV2RequestLogpushJobGenericReq createLogpushJobV2RequestLogpushJobGenericReqModel = new CreateLogpushJobV2RequestLogpushJobGenericReq.Builder() + .name("My log push job") + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .destinationConf("s3://mybucket/logs?region=us-west-2") + .dataset("http_requests") + .frequency("high") + .build(); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModel.name(), "My log push job"); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModel.enabled(), Boolean.valueOf(false)); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModel.destinationConf(), "s3://mybucket/logs?region=us-west-2"); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModel.dataset(), "http_requests"); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModel.frequency(), "high"); + + String json = TestUtilities.serialize(createLogpushJobV2RequestLogpushJobGenericReqModel); + + CreateLogpushJobV2RequestLogpushJobGenericReq createLogpushJobV2RequestLogpushJobGenericReqModelNew = TestUtilities.deserialize(json, CreateLogpushJobV2RequestLogpushJobGenericReq.class); + assertTrue(createLogpushJobV2RequestLogpushJobGenericReqModelNew instanceof CreateLogpushJobV2RequestLogpushJobGenericReq); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModelNew.name(), "My log push job"); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModelNew.enabled(), Boolean.valueOf(false)); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModelNew.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModelNew.destinationConf(), "s3://mybucket/logs?region=us-west-2"); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModelNew.dataset(), "http_requests"); + assertEquals(createLogpushJobV2RequestLogpushJobGenericReqModelNew.frequency(), "high"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateLogpushJobV2RequestLogpushJobGenericReqError() throws Throwable { + new CreateLogpushJobV2RequestLogpushJobGenericReq.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobIbmclReqTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobIbmclReqTest.java new file mode 100644 index 000000000..d6526df7c --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobIbmclReqTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2RequestLogpushJobIbmclReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobIbmclReqIbmcl; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateLogpushJobV2RequestLogpushJobIbmclReq model. + */ +public class CreateLogpushJobV2RequestLogpushJobIbmclReqTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateLogpushJobV2RequestLogpushJobIbmclReq() throws Throwable { + LogpushJobIbmclReqIbmcl logpushJobIbmclReqIbmclModel = new LogpushJobIbmclReqIbmcl.Builder() + .instanceId("90d208cc-e1dd-4fb2-a938-358e5996f056") + .region("eu-es") + .apiKey("XXXXXXXXXXXXXX") + .build(); + assertEquals(logpushJobIbmclReqIbmclModel.instanceId(), "90d208cc-e1dd-4fb2-a938-358e5996f056"); + assertEquals(logpushJobIbmclReqIbmclModel.region(), "eu-es"); + assertEquals(logpushJobIbmclReqIbmclModel.apiKey(), "XXXXXXXXXXXXXX"); + + CreateLogpushJobV2RequestLogpushJobIbmclReq createLogpushJobV2RequestLogpushJobIbmclReqModel = new CreateLogpushJobV2RequestLogpushJobIbmclReq.Builder() + .name("My log push job") + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .ibmcl(logpushJobIbmclReqIbmclModel) + .dataset("http_requests") + .frequency("high") + .build(); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModel.name(), "My log push job"); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModel.enabled(), Boolean.valueOf(false)); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModel.ibmcl(), logpushJobIbmclReqIbmclModel); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModel.dataset(), "http_requests"); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModel.frequency(), "high"); + + String json = TestUtilities.serialize(createLogpushJobV2RequestLogpushJobIbmclReqModel); + + CreateLogpushJobV2RequestLogpushJobIbmclReq createLogpushJobV2RequestLogpushJobIbmclReqModelNew = TestUtilities.deserialize(json, CreateLogpushJobV2RequestLogpushJobIbmclReq.class); + assertTrue(createLogpushJobV2RequestLogpushJobIbmclReqModelNew instanceof CreateLogpushJobV2RequestLogpushJobIbmclReq); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModelNew.name(), "My log push job"); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModelNew.enabled(), Boolean.valueOf(false)); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModelNew.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModelNew.ibmcl().toString(), logpushJobIbmclReqIbmclModel.toString()); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModelNew.dataset(), "http_requests"); + assertEquals(createLogpushJobV2RequestLogpushJobIbmclReqModelNew.frequency(), "high"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateLogpushJobV2RequestLogpushJobIbmclReqError() throws Throwable { + new CreateLogpushJobV2RequestLogpushJobIbmclReq.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobLogdnaReqTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobLogdnaReqTest.java new file mode 100644 index 000000000..1127836c1 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestLogpushJobLogdnaReqTest.java @@ -0,0 +1,66 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2RequestLogpushJobLogdnaReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateLogpushJobV2RequestLogpushJobLogdnaReq model. + */ +public class CreateLogpushJobV2RequestLogpushJobLogdnaReqTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateLogpushJobV2RequestLogpushJobLogdnaReq() throws Throwable { + CreateLogpushJobV2RequestLogpushJobLogdnaReq createLogpushJobV2RequestLogpushJobLogdnaReqModel = new CreateLogpushJobV2RequestLogpushJobLogdnaReq.Builder() + .name("My log push job") + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .logdna(java.util.Collections.singletonMap("anyKey", "anyValue")) + .dataset("http_requests") + .frequency("high") + .build(); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModel.name(), "My log push job"); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModel.enabled(), Boolean.valueOf(false)); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModel.logdna(), java.util.Collections.singletonMap("anyKey", "anyValue")); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModel.dataset(), "http_requests"); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModel.frequency(), "high"); + + String json = TestUtilities.serialize(createLogpushJobV2RequestLogpushJobLogdnaReqModel); + + CreateLogpushJobV2RequestLogpushJobLogdnaReq createLogpushJobV2RequestLogpushJobLogdnaReqModelNew = TestUtilities.deserialize(json, CreateLogpushJobV2RequestLogpushJobLogdnaReq.class); + assertTrue(createLogpushJobV2RequestLogpushJobLogdnaReqModelNew instanceof CreateLogpushJobV2RequestLogpushJobLogdnaReq); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModelNew.name(), "My log push job"); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModelNew.enabled(), Boolean.valueOf(false)); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModelNew.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModelNew.logdna().toString(), java.util.Collections.singletonMap("anyKey", "anyValue").toString()); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModelNew.dataset(), "http_requests"); + assertEquals(createLogpushJobV2RequestLogpushJobLogdnaReqModelNew.frequency(), "high"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateLogpushJobV2RequestLogpushJobLogdnaReqError() throws Throwable { + new CreateLogpushJobV2RequestLogpushJobLogdnaReq.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestTest.java new file mode 100644 index 000000000..f3d164357 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/CreateLogpushJobV2RequestTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.CreateLogpushJobV2Request; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the CreateLogpushJobV2Request model. + */ +public class CreateLogpushJobV2RequestTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testCreateLogpushJobV2Request() throws Throwable { + CreateLogpushJobV2Request createLogpushJobV2RequestModel = new CreateLogpushJobV2Request(); + assertNotNull(createLogpushJobV2RequestModel); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobRespTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobRespTest.java new file mode 100644 index 000000000..a531c932f --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobRespTest.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.DeleteLogpushJobResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteLogpushJobResp model. + */ +public class DeleteLogpushJobRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteLogpushJobResp() throws Throwable { + DeleteLogpushJobResp deleteLogpushJobRespModel = new DeleteLogpushJobResp(); + assertNull(deleteLogpushJobRespModel.isSuccess()); + assertNull(deleteLogpushJobRespModel.getErrors()); + assertNull(deleteLogpushJobRespModel.getMessages()); + assertNull(deleteLogpushJobRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobV2OptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobV2OptionsTest.java new file mode 100644 index 000000000..48c175c99 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/DeleteLogpushJobV2OptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.DeleteLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the DeleteLogpushJobV2Options model. + */ +public class DeleteLogpushJobV2OptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteLogpushJobV2Options() throws Throwable { + DeleteLogpushJobV2Options deleteLogpushJobV2OptionsModel = new DeleteLogpushJobV2Options.Builder() + .jobId("testString") + .build(); + assertEquals(deleteLogpushJobV2OptionsModel.jobId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteLogpushJobV2OptionsError() throws Throwable { + new DeleteLogpushJobV2Options.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobV2OptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobV2OptionsTest.java new file mode 100644 index 000000000..825ba92b8 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobV2OptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetLogpushJobV2Options model. + */ +public class GetLogpushJobV2OptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetLogpushJobV2Options() throws Throwable { + GetLogpushJobV2Options getLogpushJobV2OptionsModel = new GetLogpushJobV2Options.Builder() + .jobId("testString") + .build(); + assertEquals(getLogpushJobV2OptionsModel.jobId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetLogpushJobV2OptionsError() throws Throwable { + new GetLogpushJobV2Options.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobsV2OptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobsV2OptionsTest.java new file mode 100644 index 000000000..1164d542a --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushJobsV2OptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogpushJobsV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetLogpushJobsV2Options model. + */ +public class GetLogpushJobsV2OptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetLogpushJobsV2Options() throws Throwable { + GetLogpushJobsV2Options getLogpushJobsV2OptionsModel = new GetLogpushJobsV2Options(); + assertNotNull(getLogpushJobsV2OptionsModel); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushOwnershipV2OptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushOwnershipV2OptionsTest.java new file mode 100644 index 000000000..fdffd1aa1 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogpushOwnershipV2OptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogpushOwnershipV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetLogpushOwnershipV2Options model. + */ +public class GetLogpushOwnershipV2OptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetLogpushOwnershipV2Options() throws Throwable { + GetLogpushOwnershipV2Options getLogpushOwnershipV2OptionsModel = new GetLogpushOwnershipV2Options.Builder() + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .build(); + assertEquals(getLogpushOwnershipV2OptionsModel.cos(), java.util.Collections.singletonMap("anyKey", "anyValue")); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogsRetentionOptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogsRetentionOptionsTest.java new file mode 100644 index 000000000..38d599e7b --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/GetLogsRetentionOptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.GetLogsRetentionOptions; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the GetLogsRetentionOptions model. + */ +public class GetLogsRetentionOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetLogsRetentionOptions() throws Throwable { + GetLogsRetentionOptions getLogsRetentionOptionsModel = new GetLogsRetentionOptions(); + assertNotNull(getLogsRetentionOptionsModel); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsForDatasetV2OptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsForDatasetV2OptionsTest.java new file mode 100644 index 000000000..4d709c2d0 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsForDatasetV2OptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListFieldsForDatasetV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListFieldsForDatasetV2Options model. + */ +public class ListFieldsForDatasetV2OptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListFieldsForDatasetV2Options() throws Throwable { + ListFieldsForDatasetV2Options listFieldsForDatasetV2OptionsModel = new ListFieldsForDatasetV2Options(); + assertNotNull(listFieldsForDatasetV2OptionsModel); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsRespTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsRespTest.java new file mode 100644 index 000000000..3d164109d --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListFieldsRespTest.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListFieldsResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListFieldsResp model. + */ +public class ListFieldsRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListFieldsResp() throws Throwable { + ListFieldsResp listFieldsRespModel = new ListFieldsResp(); + assertNull(listFieldsRespModel.isSuccess()); + assertNull(listFieldsRespModel.getErrors()); + assertNull(listFieldsRespModel.getMessages()); + assertNull(listFieldsRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsForDatasetV2OptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsForDatasetV2OptionsTest.java new file mode 100644 index 000000000..897e8b6f6 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsForDatasetV2OptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListLogpushJobsForDatasetV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListLogpushJobsForDatasetV2Options model. + */ +public class ListLogpushJobsForDatasetV2OptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListLogpushJobsForDatasetV2Options() throws Throwable { + ListLogpushJobsForDatasetV2Options listLogpushJobsForDatasetV2OptionsModel = new ListLogpushJobsForDatasetV2Options(); + assertNotNull(listLogpushJobsForDatasetV2OptionsModel); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsRespTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsRespTest.java new file mode 100644 index 000000000..fb552c892 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ListLogpushJobsRespTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ListLogpushJobsResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobPack; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ListLogpushJobsResp model. + */ +public class ListLogpushJobsRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListLogpushJobsResp() throws Throwable { + ListLogpushJobsResp listLogpushJobsRespModel = new ListLogpushJobsResp(); + assertNull(listLogpushJobsRespModel.isSuccess()); + assertNull(listLogpushJobsRespModel.getErrors()); + assertNull(listLogpushJobsRespModel.getMessages()); + assertNull(listLogpushJobsRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionRespResultTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionRespResultTest.java new file mode 100644 index 000000000..ee700f9b0 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionRespResultTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogRetentionRespResult; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the LogRetentionRespResult model. + */ +public class LogRetentionRespResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLogRetentionRespResult() throws Throwable { + LogRetentionRespResult logRetentionRespResultModel = new LogRetentionRespResult(); + assertNull(logRetentionRespResultModel.isFlag()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionRespTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionRespTest.java new file mode 100644 index 000000000..431807fa0 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogRetentionRespTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogRetentionResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogRetentionRespResult; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the LogRetentionResp model. + */ +public class LogRetentionRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLogRetentionResp() throws Throwable { + LogRetentionResp logRetentionRespModel = new LogRetentionResp(); + assertNull(logRetentionRespModel.getResult()); + assertNull(logRetentionRespModel.isSuccess()); + assertNull(logRetentionRespModel.getErrors()); + assertNull(logRetentionRespModel.getMessages()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobIbmclReqIbmclTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobIbmclReqIbmclTest.java new file mode 100644 index 000000000..2a5e6df94 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobIbmclReqIbmclTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobIbmclReqIbmcl; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the LogpushJobIbmclReqIbmcl model. + */ +public class LogpushJobIbmclReqIbmclTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLogpushJobIbmclReqIbmcl() throws Throwable { + LogpushJobIbmclReqIbmcl logpushJobIbmclReqIbmclModel = new LogpushJobIbmclReqIbmcl.Builder() + .instanceId("90d208cc-e1dd-4fb2-a938-358e5996f056") + .region("eu-es") + .apiKey("XXXXXXXXXXXXXX") + .build(); + assertEquals(logpushJobIbmclReqIbmclModel.instanceId(), "90d208cc-e1dd-4fb2-a938-358e5996f056"); + assertEquals(logpushJobIbmclReqIbmclModel.region(), "eu-es"); + assertEquals(logpushJobIbmclReqIbmclModel.apiKey(), "XXXXXXXXXXXXXX"); + + String json = TestUtilities.serialize(logpushJobIbmclReqIbmclModel); + + LogpushJobIbmclReqIbmcl logpushJobIbmclReqIbmclModelNew = TestUtilities.deserialize(json, LogpushJobIbmclReqIbmcl.class); + assertTrue(logpushJobIbmclReqIbmclModelNew instanceof LogpushJobIbmclReqIbmcl); + assertEquals(logpushJobIbmclReqIbmclModelNew.instanceId(), "90d208cc-e1dd-4fb2-a938-358e5996f056"); + assertEquals(logpushJobIbmclReqIbmclModelNew.region(), "eu-es"); + assertEquals(logpushJobIbmclReqIbmclModelNew.apiKey(), "XXXXXXXXXXXXXX"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testLogpushJobIbmclReqIbmclError() throws Throwable { + new LogpushJobIbmclReqIbmcl.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobPackTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobPackTest.java new file mode 100644 index 000000000..dd5d07bcd --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobPackTest.java @@ -0,0 +1,46 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobPack; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the LogpushJobPack model. + */ +public class LogpushJobPackTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLogpushJobPack() throws Throwable { + LogpushJobPack logpushJobPackModel = new LogpushJobPack(); + assertNull(logpushJobPackModel.getId()); + assertNull(logpushJobPackModel.getName()); + assertNull(logpushJobPackModel.isEnabled()); + assertNull(logpushJobPackModel.getDataset()); + assertNull(logpushJobPackModel.getFrequency()); + assertNull(logpushJobPackModel.getLogpullOptions()); + assertNull(logpushJobPackModel.getDestinationConf()); + assertNull(logpushJobPackModel.getLastComplete()); + assertNull(logpushJobPackModel.getLastError()); + assertNull(logpushJobPackModel.getErrorMessage()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsRespTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsRespTest.java new file mode 100644 index 000000000..6eb5f6e98 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsRespTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobPack; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobsResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the LogpushJobsResp model. + */ +public class LogpushJobsRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLogpushJobsResp() throws Throwable { + LogpushJobsResp logpushJobsRespModel = new LogpushJobsResp(); + assertNull(logpushJobsRespModel.isSuccess()); + assertNull(logpushJobsRespModel.getErrors()); + assertNull(logpushJobsRespModel.getMessages()); + assertNull(logpushJobsRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsUpdateIbmclReqIbmclTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsUpdateIbmclReqIbmclTest.java new file mode 100644 index 000000000..4d58d9f0e --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/LogpushJobsUpdateIbmclReqIbmclTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobsUpdateIbmclReqIbmcl; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the LogpushJobsUpdateIbmclReqIbmcl model. + */ +public class LogpushJobsUpdateIbmclReqIbmclTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLogpushJobsUpdateIbmclReqIbmcl() throws Throwable { + LogpushJobsUpdateIbmclReqIbmcl logpushJobsUpdateIbmclReqIbmclModel = new LogpushJobsUpdateIbmclReqIbmcl.Builder() + .instanceId("90d208cc-e1dd-4fb2-a938-358e5996f056") + .region("eu-es") + .apiKey("XXXXXXXXXXXXXX") + .build(); + assertEquals(logpushJobsUpdateIbmclReqIbmclModel.instanceId(), "90d208cc-e1dd-4fb2-a938-358e5996f056"); + assertEquals(logpushJobsUpdateIbmclReqIbmclModel.region(), "eu-es"); + assertEquals(logpushJobsUpdateIbmclReqIbmclModel.apiKey(), "XXXXXXXXXXXXXX"); + + String json = TestUtilities.serialize(logpushJobsUpdateIbmclReqIbmclModel); + + LogpushJobsUpdateIbmclReqIbmcl logpushJobsUpdateIbmclReqIbmclModelNew = TestUtilities.deserialize(json, LogpushJobsUpdateIbmclReqIbmcl.class); + assertTrue(logpushJobsUpdateIbmclReqIbmclModelNew instanceof LogpushJobsUpdateIbmclReqIbmcl); + assertEquals(logpushJobsUpdateIbmclReqIbmclModelNew.instanceId(), "90d208cc-e1dd-4fb2-a938-358e5996f056"); + assertEquals(logpushJobsUpdateIbmclReqIbmclModelNew.region(), "eu-es"); + assertEquals(logpushJobsUpdateIbmclReqIbmclModelNew.apiKey(), "XXXXXXXXXXXXXX"); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeRespTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeRespTest.java new file mode 100644 index 000000000..2ee28b413 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeRespTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.OwnershipChallengeResp; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.OwnershipChallengeResult; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the OwnershipChallengeResp model. + */ +public class OwnershipChallengeRespTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testOwnershipChallengeResp() throws Throwable { + OwnershipChallengeResp ownershipChallengeRespModel = new OwnershipChallengeResp(); + assertNull(ownershipChallengeRespModel.isSuccess()); + assertNull(ownershipChallengeRespModel.getErrors()); + assertNull(ownershipChallengeRespModel.getMessages()); + assertNull(ownershipChallengeRespModel.getResult()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeResultTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeResultTest.java new file mode 100644 index 000000000..9ac30454a --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeResultTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.OwnershipChallengeResult; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the OwnershipChallengeResult model. + */ +public class OwnershipChallengeResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testOwnershipChallengeResult() throws Throwable { + OwnershipChallengeResult ownershipChallengeResultModel = new OwnershipChallengeResult(); + assertNull(ownershipChallengeResultModel.getFilename()); + assertNull(ownershipChallengeResultModel.isValid()); + assertNull(ownershipChallengeResultModel.getMessages()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeValidateResultTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeValidateResultTest.java new file mode 100644 index 000000000..5f33713df --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/OwnershipChallengeValidateResultTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.OwnershipChallengeValidateResult; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the OwnershipChallengeValidateResult model. + */ +public class OwnershipChallengeValidateResultTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testOwnershipChallengeValidateResult() throws Throwable { + OwnershipChallengeValidateResult ownershipChallengeValidateResultModel = new OwnershipChallengeValidateResult(); + assertNull(ownershipChallengeValidateResultModel.isValid()); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2OptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2OptionsTest.java new file mode 100644 index 000000000..db915ea3b --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2OptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateLogpushJobV2Options model. + */ +public class UpdateLogpushJobV2OptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateLogpushJobV2Options() throws Throwable { + UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq updateLogpushJobV2RequestModel = new UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq.Builder() + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .ownershipChallenge("00000000000000000000000000000000") + .frequency("high") + .build(); + assertEquals(updateLogpushJobV2RequestModel.enabled(), Boolean.valueOf(false)); + assertEquals(updateLogpushJobV2RequestModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(updateLogpushJobV2RequestModel.cos(), java.util.Collections.singletonMap("anyKey", "anyValue")); + assertEquals(updateLogpushJobV2RequestModel.ownershipChallenge(), "00000000000000000000000000000000"); + assertEquals(updateLogpushJobV2RequestModel.frequency(), "high"); + + UpdateLogpushJobV2Options updateLogpushJobV2OptionsModel = new UpdateLogpushJobV2Options.Builder() + .jobId("testString") + .updateLogpushJobV2Request(updateLogpushJobV2RequestModel) + .build(); + assertEquals(updateLogpushJobV2OptionsModel.jobId(), "testString"); + assertEquals(updateLogpushJobV2OptionsModel.updateLogpushJobV2Request(), updateLogpushJobV2RequestModel); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateLogpushJobV2OptionsError() throws Throwable { + new UpdateLogpushJobV2Options.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateCosReqTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateCosReqTest.java new file mode 100644 index 000000000..968637ea6 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateCosReqTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq model. + */ +public class UpdateLogpushJobV2RequestLogpushJobsUpdateCosReqTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateLogpushJobV2RequestLogpushJobsUpdateCosReq() throws Throwable { + UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq updateLogpushJobV2RequestLogpushJobsUpdateCosReqModel = new UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq.Builder() + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .ownershipChallenge("00000000000000000000000000000000") + .frequency("high") + .build(); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModel.enabled(), Boolean.valueOf(false)); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModel.cos(), java.util.Collections.singletonMap("anyKey", "anyValue")); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModel.ownershipChallenge(), "00000000000000000000000000000000"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModel.frequency(), "high"); + + String json = TestUtilities.serialize(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModel); + + UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq updateLogpushJobV2RequestLogpushJobsUpdateCosReqModelNew = TestUtilities.deserialize(json, UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq.class); + assertTrue(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModelNew instanceof UpdateLogpushJobV2RequestLogpushJobsUpdateCosReq); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModelNew.enabled(), Boolean.valueOf(false)); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModelNew.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModelNew.cos().toString(), java.util.Collections.singletonMap("anyKey", "anyValue").toString()); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModelNew.ownershipChallenge(), "00000000000000000000000000000000"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateCosReqModelNew.frequency(), "high"); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReqTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReqTest.java new file mode 100644 index 000000000..0e320f980 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReqTest.java @@ -0,0 +1,60 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq model. + */ +public class UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReqTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq() throws Throwable { + UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModel = new UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq.Builder() + .name("My log push job") + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .destinationConf("s3://mybucket/logs?region=us-west-2") + .dataset("http_requests") + .frequency("high") + .build(); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModel.name(), "My log push job"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModel.enabled(), Boolean.valueOf(false)); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModel.destinationConf(), "s3://mybucket/logs?region=us-west-2"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModel.dataset(), "http_requests"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModel.frequency(), "high"); + + String json = TestUtilities.serialize(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModel); + + UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModelNew = TestUtilities.deserialize(json, UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq.class); + assertTrue(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModelNew instanceof UpdateLogpushJobV2RequestLogpushJobsUpdateGenericReq); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModelNew.name(), "My log push job"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModelNew.enabled(), Boolean.valueOf(false)); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModelNew.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModelNew.destinationConf(), "s3://mybucket/logs?region=us-west-2"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModelNew.dataset(), "http_requests"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateGenericReqModelNew.frequency(), "high"); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReqTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReqTest.java new file mode 100644 index 000000000..d8d27212f --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReqTest.java @@ -0,0 +1,64 @@ +/* + * (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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.LogpushJobsUpdateIbmclReqIbmcl; +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq model. + */ +public class UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReqTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq() throws Throwable { + LogpushJobsUpdateIbmclReqIbmcl logpushJobsUpdateIbmclReqIbmclModel = new LogpushJobsUpdateIbmclReqIbmcl.Builder() + .instanceId("90d208cc-e1dd-4fb2-a938-358e5996f056") + .region("eu-es") + .apiKey("XXXXXXXXXXXXXX") + .build(); + assertEquals(logpushJobsUpdateIbmclReqIbmclModel.instanceId(), "90d208cc-e1dd-4fb2-a938-358e5996f056"); + assertEquals(logpushJobsUpdateIbmclReqIbmclModel.region(), "eu-es"); + assertEquals(logpushJobsUpdateIbmclReqIbmclModel.apiKey(), "XXXXXXXXXXXXXX"); + + UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModel = new UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq.Builder() + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .ibmcl(logpushJobsUpdateIbmclReqIbmclModel) + .frequency("high") + .build(); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModel.enabled(), Boolean.valueOf(false)); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModel.ibmcl(), logpushJobsUpdateIbmclReqIbmclModel); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModel.frequency(), "high"); + + String json = TestUtilities.serialize(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModel); + + UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModelNew = TestUtilities.deserialize(json, UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq.class); + assertTrue(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModelNew instanceof UpdateLogpushJobV2RequestLogpushJobsUpdateIbmclReq); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModelNew.enabled(), Boolean.valueOf(false)); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModelNew.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModelNew.ibmcl().toString(), logpushJobsUpdateIbmclReqIbmclModel.toString()); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateIbmclReqModelNew.frequency(), "high"); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqTest.java new file mode 100644 index 000000000..763279cef --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq model. + */ +public class UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq() throws Throwable { + UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModel = new UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.Builder() + .enabled(false) + .logpullOptions("timestamps=rfc3339×tamps=rfc3339") + .logdna(java.util.Collections.singletonMap("anyKey", "anyValue")) + .frequency("high") + .build(); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModel.enabled(), Boolean.valueOf(false)); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModel.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModel.logdna(), java.util.Collections.singletonMap("anyKey", "anyValue")); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModel.frequency(), "high"); + + String json = TestUtilities.serialize(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModel); + + UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModelNew = TestUtilities.deserialize(json, UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq.class); + assertTrue(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModelNew instanceof UpdateLogpushJobV2RequestLogpushJobsUpdateLogdnaReq); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModelNew.enabled(), Boolean.valueOf(false)); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModelNew.logpullOptions(), "timestamps=rfc3339×tamps=rfc3339"); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModelNew.logdna().toString(), java.util.Collections.singletonMap("anyKey", "anyValue").toString()); + assertEquals(updateLogpushJobV2RequestLogpushJobsUpdateLogdnaReqModelNew.frequency(), "high"); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestTest.java new file mode 100644 index 000000000..0c3b3f12b --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/UpdateLogpushJobV2RequestTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.UpdateLogpushJobV2Request; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateLogpushJobV2Request model. + */ +public class UpdateLogpushJobV2RequestTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testUpdateLogpushJobV2Request() throws Throwable { + UpdateLogpushJobV2Request updateLogpushJobV2RequestModel = new UpdateLogpushJobV2Request(); + assertNotNull(updateLogpushJobV2RequestModel); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ValidateLogpushOwnershipChallengeV2OptionsTest.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ValidateLogpushOwnershipChallengeV2OptionsTest.java new file mode 100644 index 000000000..9cee35104 --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/model/ValidateLogpushOwnershipChallengeV2OptionsTest.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.logpush_jobs_api.v1.model; + +import com.ibm.cloud.networking.logpush_jobs_api.v1.model.ValidateLogpushOwnershipChallengeV2Options; +import com.ibm.cloud.networking.logpush_jobs_api.v1.utils.TestUtilities; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the ValidateLogpushOwnershipChallengeV2Options model. + */ +public class ValidateLogpushOwnershipChallengeV2OptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testValidateLogpushOwnershipChallengeV2Options() throws Throwable { + ValidateLogpushOwnershipChallengeV2Options validateLogpushOwnershipChallengeV2OptionsModel = new ValidateLogpushOwnershipChallengeV2Options.Builder() + .cos(java.util.Collections.singletonMap("anyKey", "anyValue")) + .ownershipChallenge("00000000000000000000") + .build(); + assertEquals(validateLogpushOwnershipChallengeV2OptionsModel.cos(), java.util.Collections.singletonMap("anyKey", "anyValue")); + assertEquals(validateLogpushOwnershipChallengeV2OptionsModel.ownershipChallenge(), "00000000000000000000"); + } +} \ No newline at end of file diff --git a/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/utils/TestUtilities.java b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/utils/TestUtilities.java new file mode 100644 index 000000000..7c8e6137d --- /dev/null +++ b/modules/logpush-jobs-api/src/test/java/com/ibm/cloud/networking/logpush_jobs_api/v1/utils/TestUtilities.java @@ -0,0 +1,131 @@ +/* + * (C) Copyright IBM Corp. 2026. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.networking.logpush_jobs_api.v1.utils; + +import java.util.Base64; +import java.util.Map; +import java.util.Set; +import java.util.List; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.io.InputStream; +import java.io.ByteArrayInputStream; + +import okhttp3.mockwebserver.RecordedRequest; +import okhttp3.HttpUrl; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.sdk.core.util.GsonSingleton; +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; + +/** + * A class used by the unit tests containing utility functions. + */ +public class TestUtilities { + public static Map createMockMap() { + Map mockMap = new HashMap<>(); + mockMap.put("foo", "bar"); + return mockMap; + } + + public static HashMap createMockStreamMap() { + return new HashMap() { + { put("key1", createMockStream("This is a mock file.")); } + }; + } + + public static Map parseQueryString(RecordedRequest req) { + Map queryMap = new HashMap<>(); + + try { + HttpUrl requestUrl = req.getRequestUrl(); + + if (requestUrl != null) { + Set queryParamsNames = requestUrl.queryParameterNames(); + // map the parameter name to its corresponding value + for (String p : queryParamsNames) { + // get the corresponding value for the parameter (p) + List val = requestUrl.queryParameterValues(p); + if (val != null && !val.isEmpty()) { + String joinedQuery = String.join(",", val); + queryMap.put(p, joinedQuery); + } + } + } + if (queryMap.isEmpty()) { + return null; + } + } catch (Exception e) { + return null; + } + + return queryMap; + } + + public static String parseReqPath(RecordedRequest req) { + String parsedPath = null; + + try { + String fullPath = req.getPath(); + if (fullPath != null && !fullPath.isEmpty()) { + // retrieve the path segment before the query parameter + parsedPath = fullPath.split("\\?", 2)[0]; + } + if (parsedPath.isEmpty() || parsedPath == null) { + return null; + } + + } catch (Exception e) { + return null; + } + + return parsedPath; + } + + public static String serialize(Object obj) { + return GsonSingleton.getGson().toJson(obj); + } + + public static T deserialize(String json, Class clazz) { + return GsonSingleton.getGson().fromJson(json, clazz); + } + + public static InputStream createMockStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + public static List creatMockListFileWithMetadata() { + List list = new ArrayList(); + byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; + InputStream inputStream = new ByteArrayInputStream(fileBytes); + FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); + builder.data(inputStream); + FileWithMetadata fileWithMetadata = builder.build(); + list.add(fileWithMetadata); + + return list; + } + + public static byte[] createMockByteArray(String encodedString) throws Exception { + return Base64.getDecoder().decode(encodedString); + } + + public static Date createMockDate(String date) throws Exception { + return DateUtils.parseAsDate(date); + } + + public static Date createMockDateTime(String date) throws Exception { + return DateUtils.parseAsDateTime(date); + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4ca5d9761..e06d699db 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,7 @@ modules/webhooks modules/alerts modules/rulesets + modules/logpush-jobs-api modules/coverage-reports