From fe11482670f9fbaf0b37db1039b7416cef1607c4 Mon Sep 17 00:00:00 2001 From: Gaurav Goswami Date: Thu, 28 Apr 2022 14:09:05 +0530 Subject: [PATCH] fix(FindingsAPI): deprecated BREAKING CHANGE: deprecating Security Insights --- .bumpversion.cfg | 4 - .github/workflows/main.yaml | 1 - README.md | 5 +- build/publishCodeCoverage.sh | 3 +- build/testScript.sh | 1 - modules/coverage-reports/pom.xml | 5 - modules/examples/pom.xml | 5 - .../scc/findings/v1/FindingsExamples.java | 331 ----- modules/findings/pom.xml | 64 - .../ibm/cloud/scc/findings/v1/Findings.java | 694 --------- .../model/ApiListNoteOccurrencesResponse.java | 51 - .../v1/model/ApiListNotesResponse.java | 52 - .../v1/model/ApiListOccurrencesResponse.java | 52 - .../v1/model/ApiListProvidersResponse.java | 75 - .../cloud/scc/findings/v1/model/ApiNote.java | 475 ------ .../findings/v1/model/ApiNoteRelatedUrl.java | 126 -- .../scc/findings/v1/model/ApiOccurrence.java | 371 ----- .../scc/findings/v1/model/ApiProvider.java | 47 - .../ibm/cloud/scc/findings/v1/model/Card.java | 360 ----- .../scc/findings/v1/model/CardElement.java | 135 -- .../CardElementBreakdownCardElement.java | 167 --- .../model/CardElementNumericCardElement.java | 147 -- .../CardElementTimeSeriesCardElement.java | 181 --- .../cloud/scc/findings/v1/model/Context.java | 329 ----- .../findings/v1/model/CreateNoteOptions.java | 548 ------- .../v1/model/CreateOccurrenceOptions.java | 441 ------ .../findings/v1/model/DataTransferred.java | 168 --- .../findings/v1/model/DeleteNoteOptions.java | 152 -- .../v1/model/DeleteOccurrenceOptions.java | 152 -- .../cloud/scc/findings/v1/model/Finding.java | 253 ---- .../scc/findings/v1/model/FindingType.java | 166 --- .../scc/findings/v1/model/GetNoteOptions.java | 152 -- .../v1/model/GetOccurrenceNoteOptions.java | 152 -- .../v1/model/GetOccurrenceOptions.java | 152 -- .../ibm/cloud/scc/findings/v1/model/Kpi.java | 122 -- .../cloud/scc/findings/v1/model/KpiType.java | 146 -- .../v1/model/ListNoteOccurrencesOptions.java | 204 --- .../findings/v1/model/ListNotesOptions.java | 174 --- .../v1/model/ListOccurrencesOptions.java | 174 --- .../v1/model/ListProvidersOptions.java | 190 --- .../findings/v1/model/NetworkConnection.java | 163 -- .../v1/model/NumericCardElementValueType.java | 142 -- .../findings/v1/model/PostGraphOptions.java | 155 -- .../findings/v1/model/RemediationStep.java | 111 -- .../cloud/scc/findings/v1/model/Reporter.java | 152 -- .../cloud/scc/findings/v1/model/Section.java | 126 -- .../scc/findings/v1/model/SocketAddress.java | 122 -- .../findings/v1/model/UpdateNoteOptions.java | 578 -------- .../v1/model/UpdateOccurrenceOptions.java | 445 ------ .../scc/findings/v1/model/ValueType.java | 101 -- .../model/ValueTypeFindingCountValueType.java | 146 -- .../v1/model/ValueTypeKpiValueType.java | 127 -- .../cloud/scc/findings/v1/package-info.java | 16 - .../ibm/cloud/scc/findings/v1/FindingsIT.java | 767 ---------- .../cloud/scc/findings/v1/FindingsTest.java | 1314 ----------------- .../model/ApiListNoteOccurrencesResponse.java | 51 - .../v1/model/ApiListNotesResponse.java | 52 - .../v1/model/ApiListOccurrencesResponse.java | 52 - .../v1/model/ApiListProvidersResponse.java | 75 - .../cloud/scc/findings/v1/model/ApiNote.java | 475 ------ .../findings/v1/model/ApiNoteRelatedUrl.java | 126 -- .../scc/findings/v1/model/ApiOccurrence.java | 371 ----- .../scc/findings/v1/model/ApiProvider.java | 47 - .../ibm/cloud/scc/findings/v1/model/Card.java | 360 ----- .../scc/findings/v1/model/CardElement.java | 135 -- .../CardElementBreakdownCardElement.java | 167 --- .../model/CardElementNumericCardElement.java | 147 -- .../CardElementTimeSeriesCardElement.java | 181 --- .../cloud/scc/findings/v1/model/Context.java | 329 ----- .../findings/v1/model/CreateNoteOptions.java | 548 ------- .../v1/model/CreateOccurrenceOptions.java | 441 ------ .../findings/v1/model/DataTransferred.java | 168 --- .../findings/v1/model/DeleteNoteOptions.java | 152 -- .../v1/model/DeleteOccurrenceOptions.java | 152 -- .../cloud/scc/findings/v1/model/Finding.java | 253 ---- .../scc/findings/v1/model/FindingType.java | 166 --- .../scc/findings/v1/model/GetNoteOptions.java | 152 -- .../v1/model/GetOccurrenceNoteOptions.java | 152 -- .../v1/model/GetOccurrenceOptions.java | 152 -- .../ibm/cloud/scc/findings/v1/model/Kpi.java | 122 -- .../cloud/scc/findings/v1/model/KpiType.java | 146 -- .../v1/model/ListNoteOccurrencesOptions.java | 204 --- .../findings/v1/model/ListNotesOptions.java | 174 --- .../v1/model/ListOccurrencesOptions.java | 174 --- .../v1/model/ListProvidersOptions.java | 190 --- .../findings/v1/model/NetworkConnection.java | 163 -- .../v1/model/NumericCardElementValueType.java | 142 -- .../findings/v1/model/PostGraphOptions.java | 155 -- .../findings/v1/model/RemediationStep.java | 111 -- .../cloud/scc/findings/v1/model/Reporter.java | 152 -- .../cloud/scc/findings/v1/model/Section.java | 126 -- .../scc/findings/v1/model/SocketAddress.java | 122 -- .../findings/v1/model/UpdateNoteOptions.java | 578 -------- .../v1/model/UpdateOccurrenceOptions.java | 445 ------ .../scc/findings/v1/model/ValueType.java | 101 -- .../model/ValueTypeFindingCountValueType.java | 146 -- .../v1/model/ValueTypeKpiValueType.java | 127 -- .../scc/findings/v1/utils/TestUtilities.java | 129 -- pom.xml | 1 - 99 files changed, 3 insertions(+), 19901 deletions(-) delete mode 100644 modules/examples/src/main/java/com/ibm/cloud/scc/findings/v1/FindingsExamples.java delete mode 100644 modules/findings/pom.xml delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/Findings.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListNoteOccurrencesResponse.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListNotesResponse.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListOccurrencesResponse.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Card.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElement.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementBreakdownCardElement.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementNumericCardElement.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementTimeSeriesCardElement.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Context.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DataTransferred.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Finding.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/FindingType.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Kpi.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/KpiType.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/NetworkConnection.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/NumericCardElementValueType.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/RemediationStep.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Reporter.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Section.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/SocketAddress.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueType.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeFindingCountValueType.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeKpiValueType.java delete mode 100644 modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/package-info.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsIT.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsTest.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListNoteOccurrencesResponse.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListNotesResponse.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListOccurrencesResponse.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Card.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElement.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementBreakdownCardElement.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementNumericCardElement.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementTimeSeriesCardElement.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Context.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DataTransferred.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Finding.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/FindingType.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Kpi.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/KpiType.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/NetworkConnection.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/NumericCardElementValueType.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/RemediationStep.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Reporter.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Section.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/SocketAddress.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueType.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeFindingCountValueType.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeKpiValueType.java delete mode 100644 modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/utils/TestUtilities.java diff --git a/.bumpversion.cfg b/.bumpversion.cfg index dbef63fd..54851e89 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -19,10 +19,6 @@ replace = {new_version} search = {current_version} replace = {new_version} -[bumpversion:file:modules/findings/pom.xml] -search = {current_version} -replace = {new_version} - [bumpversion:file:modules/configuration-governance/pom.xml] search = {current_version} replace = {new_version} diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 169b508a..ccb1704a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -47,7 +47,6 @@ jobs: - name: running integration tests env: ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} - FINDINGS_ENV: ${{ secrets.FINDINGS_ENV }} CONFIGURATION_GOVERNANCE_ENV: ${{ secrets.CONFIGURATION_GOVERNANCE_ENV }} RESOURCE_GROUP_ID: ${{ secrets.RESOURCE_GROUP_ID }} run: build/testScript.sh diff --git a/README.md b/README.md index e6740661..00f2720a 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ The IBM Cloud Security & Compliance Center Java SDK allows developers to program Service Name | Imported Class Name --- | --- -[FindingsApi](https://cloud.ibm.com/apidocs/security-compliance/findings) | FindingsApi:2.0.1 [ConfigurationGovernanceApi](https://cloud.ibm.com/apidocs/security-compliance/config) | ConfigurationGovernanceApi:2.0.1 ## Prerequisites @@ -76,14 +75,14 @@ Here are examples for maven and gradle: ```xml com.ibm.cloud - findings + configuration_governance 2.0.1 ``` ### Gradle ```gradle -compile 'com.ibm.cloud:findings:2.0.1' +compile 'com.ibm.cloud:configuration_governance:2.0.1' ``` ## Using the SDK diff --git a/build/publishCodeCoverage.sh b/build/publishCodeCoverage.sh index f005da48..a04c28ee 100755 --- a/build/publishCodeCoverage.sh +++ b/build/publishCodeCoverage.sh @@ -7,8 +7,7 @@ printf ">>>>> Publishing code coverage info\n" JACOCO_SOURCE_PATH=modules/common/src/main/java ./cc-test-reporter format-coverage modules/common/target/site/jacoco/jacoco.xml -d -o common.json -t jacoco JACOCO_SOURCE_PATH=modules/configuration-governance/src/main/java ./cc-test-reporter format-coverage modules/configuration-governance/target/site/jacoco/jacoco.xml -d -o configuration-governance.json -t jacoco -JACOCO_SOURCE_PATH=modules/findings/src/main/java ./cc-test-reporter format-coverage modules/findings/target/site/jacoco/jacoco.xml -d -o findings.json -t jacoco -./cc-test-reporter sum-coverage common.json configuration-governance.json findings.json -o coverage.json -d +./cc-test-reporter sum-coverage common.json configuration-governance.json -o coverage.json -d ./cc-test-reporter upload-coverage --input coverage.json diff --git a/build/testScript.sh b/build/testScript.sh index 8e47036f..8c62e7b5 100755 --- a/build/testScript.sh +++ b/build/testScript.sh @@ -3,6 +3,5 @@ set -euo pipefail curl https://us-south.functions.appdomain.cloud/api/v1/web/e6b54af6-ab44-4149-a8e4-e906dcc58136/default/secadvstg-location-shift.json -echo "${FINDINGS_ENV}" | base64 -d >> findings_v1.env echo "${CONFIGURATION_GOVERNANCE_ENV}" | base64 -d >> configuration_governance_v1.env mvn clean verify diff --git a/modules/coverage-reports/pom.xml b/modules/coverage-reports/pom.xml index d4522061..0b2d1ad9 100644 --- a/modules/coverage-reports/pom.xml +++ b/modules/coverage-reports/pom.xml @@ -38,11 +38,6 @@ - - ${project.groupId} - findings - ${project.version} - ${project.groupId} diff --git a/modules/examples/pom.xml b/modules/examples/pom.xml index 52183a04..ae2696e5 100644 --- a/modules/examples/pom.xml +++ b/modules/examples/pom.xml @@ -17,11 +17,6 @@ - - com.ibm.cloud - findings - ${project.version} - com.ibm.cloud configuration_governance diff --git a/modules/examples/src/main/java/com/ibm/cloud/scc/findings/v1/FindingsExamples.java b/modules/examples/src/main/java/com/ibm/cloud/scc/findings/v1/FindingsExamples.java deleted file mode 100644 index 43a0afd5..00000000 --- a/modules/examples/src/main/java/com/ibm/cloud/scc/findings/v1/FindingsExamples.java +++ /dev/null @@ -1,331 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.cloud.scc.findings.v1; - -import com.ibm.cloud.scc.findings.v1.model.ApiListNoteOccurrencesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListNotesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListOccurrencesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListProvidersResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiNote; -import com.ibm.cloud.scc.findings.v1.model.ApiOccurrence; -import com.ibm.cloud.scc.findings.v1.model.CreateNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.CreateOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.DeleteNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.DeleteOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.GetNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.GetOccurrenceNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.GetOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.ListNoteOccurrencesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListNotesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListOccurrencesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListProvidersOptions; -import com.ibm.cloud.scc.findings.v1.model.PostGraphOptions; -import com.ibm.cloud.scc.findings.v1.model.Reporter; -import com.ibm.cloud.scc.findings.v1.model.UpdateNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.UpdateOccurrenceOptions; -import com.ibm.cloud.sdk.core.http.Response; -import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException; -import com.ibm.cloud.sdk.core.util.CredentialUtils; -import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -// -// This file provides an example of how to use the Findings service. -// -// The following configuration properties are assumed to be defined: -// FINDINGS_URL= -// FINDINGS_AUTH_TYPE=iam -// FINDINGS_APIKEY= -// FINDINGS_AUTH_URL= -// -// These configuration properties can be exported as environment variables, or stored -// in a configuration file and then: -// export IBM_CREDENTIALS_FILE= -// -public class FindingsExamples { - private static final Logger logger = LoggerFactory.getLogger(FindingsExamples.class); - protected FindingsExamples() { } - - @SuppressWarnings("checkstyle:methodlength") - public static void main(String[] args) throws Exception { - String accountId = "testString"; - - Findings findingsService = Findings.newInstance(accountId); - - // Load up our test-specific config properties. - Map config = CredentialUtils.getServiceProperties(Findings.DEFAULT_SERVICE_NAME); - - try { - // begin-postGraph - PostGraphOptions postGraphOptions = new PostGraphOptions.Builder() - .body(new java.io.ByteArrayInputStream("This is a mock file.".getBytes())) - .build(); - - Response response = findingsService.postGraph(postGraphOptions).execute(); - // end-postGraph - System.out.printf("postGraph() response status code: %d%n", response.getStatusCode()); - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("createNote() result:"); - // begin-createNote - Reporter reporterModel = new Reporter.Builder() - .id("testString") - .title("testString") - .build(); - CreateNoteOptions createNoteOptions = new CreateNoteOptions.Builder() - .providerId("testString") - .shortDescription("testString") - .longDescription("testString") - .kind("FINDING") - .id("testString") - .reportedBy(reporterModel) - .build(); - - Response response = findingsService.createNote(createNoteOptions).execute(); - ApiNote apiNote = response.getResult(); - - System.out.println(apiNote); - // end-createNote - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("listNotes() result:"); - // begin-listNotes - ListNotesOptions listNotesOptions = new ListNotesOptions.Builder() - .providerId("testString") - .build(); - - Response response = findingsService.listNotes(listNotesOptions).execute(); - ApiListNotesResponse apiListNotesResponse = response.getResult(); - - System.out.println(apiListNotesResponse); - // end-listNotes - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("getNote() result:"); - // begin-getNote - GetNoteOptions getNoteOptions = new GetNoteOptions.Builder() - .providerId("testString") - .noteId("testString") - .build(); - - Response response = findingsService.getNote(getNoteOptions).execute(); - ApiNote apiNote = response.getResult(); - - System.out.println(apiNote); - // end-getNote - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("updateNote() result:"); - // begin-updateNote - Reporter reporterModel = new Reporter.Builder() - .id("testString") - .title("testString") - .build(); - UpdateNoteOptions updateNoteOptions = new UpdateNoteOptions.Builder() - .providerId("testString") - .noteId("testString") - .shortDescription("testString") - .longDescription("testString") - .kind("FINDING") - .id("testString") - .reportedBy(reporterModel) - .build(); - - Response response = findingsService.updateNote(updateNoteOptions).execute(); - ApiNote apiNote = response.getResult(); - - System.out.println(apiNote); - // end-updateNote - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("getOccurrenceNote() result:"); - // begin-getOccurrenceNote - GetOccurrenceNoteOptions getOccurrenceNoteOptions = new GetOccurrenceNoteOptions.Builder() - .providerId("testString") - .occurrenceId("testString") - .build(); - - Response response = findingsService.getOccurrenceNote(getOccurrenceNoteOptions).execute(); - ApiNote apiNote = response.getResult(); - - System.out.println(apiNote); - // end-getOccurrenceNote - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("createOccurrence() result:"); - // begin-createOccurrence - CreateOccurrenceOptions createOccurrenceOptions = new CreateOccurrenceOptions.Builder() - .providerId("testString") - .noteName("testString") - .kind("FINDING") - .id("testString") - .build(); - - Response response = findingsService.createOccurrence(createOccurrenceOptions).execute(); - ApiOccurrence apiOccurrence = response.getResult(); - - System.out.println(apiOccurrence); - // end-createOccurrence - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("listOccurrences() result:"); - // begin-listOccurrences - ListOccurrencesOptions listOccurrencesOptions = new ListOccurrencesOptions.Builder() - .providerId("testString") - .build(); - - Response response = findingsService.listOccurrences(listOccurrencesOptions).execute(); - ApiListOccurrencesResponse apiListOccurrencesResponse = response.getResult(); - - System.out.println(apiListOccurrencesResponse); - // end-listOccurrences - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("listNoteOccurrences() result:"); - // begin-listNoteOccurrences - ListNoteOccurrencesOptions listNoteOccurrencesOptions = new ListNoteOccurrencesOptions.Builder() - .providerId("testString") - .noteId("testString") - .build(); - - Response response = findingsService.listNoteOccurrences(listNoteOccurrencesOptions).execute(); - ApiListNoteOccurrencesResponse apiListNoteOccurrencesResponse = response.getResult(); - - System.out.println(apiListNoteOccurrencesResponse); - // end-listNoteOccurrences - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("getOccurrence() result:"); - // begin-getOccurrence - GetOccurrenceOptions getOccurrenceOptions = new GetOccurrenceOptions.Builder() - .providerId("testString") - .occurrenceId("testString") - .build(); - - Response response = findingsService.getOccurrence(getOccurrenceOptions).execute(); - ApiOccurrence apiOccurrence = response.getResult(); - - System.out.println(apiOccurrence); - // end-getOccurrence - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("updateOccurrence() result:"); - // begin-updateOccurrence - UpdateOccurrenceOptions updateOccurrenceOptions = new UpdateOccurrenceOptions.Builder() - .providerId("testString") - .occurrenceId("testString") - .noteName("testString") - .kind("FINDING") - .id("testString") - .build(); - - Response response = findingsService.updateOccurrence(updateOccurrenceOptions).execute(); - ApiOccurrence apiOccurrence = response.getResult(); - - System.out.println(apiOccurrence); - // end-updateOccurrence - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - System.out.println("listProviders() result:"); - // begin-listProviders - ListProvidersOptions listProvidersOptions = new ListProvidersOptions.Builder() - .build(); - - Response response = findingsService.listProviders(listProvidersOptions).execute(); - ApiListProvidersResponse apiListProvidersResponse = response.getResult(); - - System.out.println(apiListProvidersResponse); - // end-listProviders - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - // begin-deleteOccurrence - DeleteOccurrenceOptions deleteOccurrenceOptions = new DeleteOccurrenceOptions.Builder() - .providerId("testString") - .occurrenceId("testString") - .build(); - - Response response = findingsService.deleteOccurrence(deleteOccurrenceOptions).execute(); - // end-deleteOccurrence - System.out.printf("deleteOccurrence() response status code: %d%n", response.getStatusCode()); - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - try { - // begin-deleteNote - DeleteNoteOptions deleteNoteOptions = new DeleteNoteOptions.Builder() - .providerId("testString") - .noteId("testString") - .build(); - - Response response = findingsService.deleteNote(deleteNoteOptions).execute(); - // end-deleteNote - System.out.printf("deleteNote() response status code: %d%n", response.getStatusCode()); - } catch (ServiceResponseException e) { - logger.error(String.format("Service returned status code %s: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); - } - - } -} diff --git a/modules/findings/pom.xml b/modules/findings/pom.xml deleted file mode 100644 index f423a8bd..00000000 --- a/modules/findings/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - 4.0.0 - - - scc - com.ibm.cloud - 2.0.1 - ../.. - - - findings - jar - IBM Cloud Security & Compliance Center Findings API - - - - com.ibm.cloud - sdk-core - - - ${project.groupId} - common - ${project.version} - - - ${project.groupId} - common - test-jar - tests - test - ${project.version} - - - org.testng - testng - test - - - com.squareup.okhttp3 - mockwebserver - test - - - org.powermock - powermock-api-mockito2 - test - - - org.powermock - powermock-module-testng - test - - - - - - IBM Cloud DevX SDK Development - devxsdk@us.ibm.com - https://www.ibm.com/ - - - \ No newline at end of file diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/Findings.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/Findings.java deleted file mode 100644 index aecfd602..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/Findings.java +++ /dev/null @@ -1,694 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT 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.40.0-910cf8c2-20211006-154754 - */ - -package com.ibm.cloud.scc.findings.v1; - -import com.google.gson.JsonObject; -import com.ibm.cloud.scc.common.SdkCommon; -import com.ibm.cloud.scc.findings.v1.model.ApiListNoteOccurrencesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListNotesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListOccurrencesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListProvidersResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiNote; -import com.ibm.cloud.scc.findings.v1.model.ApiOccurrence; -import com.ibm.cloud.scc.findings.v1.model.CreateNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.CreateOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.DeleteNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.DeleteOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.GetNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.GetOccurrenceNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.GetOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.ListNoteOccurrencesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListNotesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListOccurrencesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListProvidersOptions; -import com.ibm.cloud.scc.findings.v1.model.PostGraphOptions; -import com.ibm.cloud.scc.findings.v1.model.UpdateNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.UpdateOccurrenceOptions; -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; - -/** - * The Findings API is used to find and display occurrences of security issues in your IBM Cloud account by using the - * artifact metadata specification. Findings are summarized in cards in the Security and Compliance Center that allow - * you to see the security status of your account at a glance and start an investigation into any potential issues. - * - * API Version: 1.0.0 - */ -public class Findings extends BaseService { - - public static final String DEFAULT_SERVICE_NAME = "findings"; - - public static final String DEFAULT_SERVICE_URL = "https://us-south.secadvisor.cloud.ibm.com/findings"; - - private String accountId; - - /** - * Class method which constructs an instance of the `Findings` client. - * The default service name is used to configure the client instance. - * - * @param accountId Account ID. - * @return an instance of the `Findings` client using external configuration - */ - public static Findings newInstance(String accountId) { - return newInstance(accountId, DEFAULT_SERVICE_NAME); - } - - /** - * Class method which constructs an instance of the `Findings` client. - * The specified service name is used to configure the client instance. - * - * @param accountId Account ID. - * @param serviceName the service name to be used when configuring the client instance - * @return an instance of the `Findings` client using external configuration - */ - public static Findings newInstance(String accountId, String serviceName) { - Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName); - Findings service = new Findings(accountId, serviceName, authenticator); - service.configureService(serviceName); - return service; - } - - /** - * Constructs an instance of the `Findings` client. - * The specified service name and authenticator are used to configure the client instance. - * - * @param accountId Account ID. - * @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 Findings(String accountId, String serviceName, Authenticator authenticator) { - super(serviceName, authenticator); - setServiceUrl(DEFAULT_SERVICE_URL); - setAccountId(accountId); - } - - /** - * Gets the accountId. - * - * Account ID. - * - * @return the accountId - */ - public String getAccountId() { - return this.accountId; - } - - /** - * Sets the accountId. - * - * @param accountId the new accountId - */ - public void setAccountId(final String accountId) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(accountId, "accountId cannot be empty."); - this.accountId = accountId; - } - - /** - * Query findings. - * - * Query findings by using the GraphQL query language. For more information about using GraphQL, see the [GraphQL - * documentation](https://graphql.org/learn/). - * - * @param postGraphOptions the {@link PostGraphOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall postGraph(PostGraphOptions postGraphOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(postGraphOptions, - "postGraphOptions cannot be null"); - - if (postGraphOptions.body() != null && postGraphOptions.contentType() == null) { - postGraphOptions = postGraphOptions.newBuilder().contentType("application/json").build(); - } - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/graph", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "postGraph"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (postGraphOptions.contentType() != null) { - builder.header("Content-Type", postGraphOptions.contentType()); - } - if (postGraphOptions.transactionId() != null) { - builder.header("Transaction-Id", postGraphOptions.transactionId()); - } - builder.bodyContent(postGraphOptions.contentType(), null, - null, postGraphOptions.body()); - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List providers. - * - * List all of the providers for a specified account. - * - * @param listProvidersOptions the {@link ListProvidersOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiListProvidersResponse} - */ - public ServiceCall listProviders(ListProvidersOptions listProvidersOptions) { - if (listProvidersOptions == null) { - listProvidersOptions = new ListProvidersOptions.Builder().build(); - } - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "listProviders"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listProvidersOptions.transactionId() != null) { - builder.header("Transaction-Id", listProvidersOptions.transactionId()); - } - if (listProvidersOptions.limit() != null) { - builder.query("limit", String.valueOf(listProvidersOptions.limit())); - } - if (listProvidersOptions.skip() != null) { - builder.query("skip", String.valueOf(listProvidersOptions.skip())); - } - if (listProvidersOptions.startProviderId() != null) { - builder.query("start_provider_id", String.valueOf(listProvidersOptions.startProviderId())); - } - if (listProvidersOptions.endProviderId() != null) { - builder.query("end_provider_id", String.valueOf(listProvidersOptions.endProviderId())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List providers. - * - * List all of the providers for a specified account. - * - * @return a {@link ServiceCall} with a result of type {@link ApiListProvidersResponse} - */ - public ServiceCall listProviders() { - return listProviders(null); - } - - /** - * Create a note. - * - * Register a new finding type with the Security and Compliance Center. - * - * A successful request creates a note with a high-level description of a particular type of finding. To learn more - * about creating notes to register findings, see [Custom - * findings](/docs/security-advisor?topic=security-advisor-setup_custom). - * - * @param createNoteOptions the {@link CreateNoteOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiNote} - */ - public ServiceCall createNote(CreateNoteOptions createNoteOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createNoteOptions, - "createNoteOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", createNoteOptions.providerId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/notes", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "createNote"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", createNoteOptions.transactionId()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("short_description", createNoteOptions.shortDescription()); - contentJson.addProperty("long_description", createNoteOptions.longDescription()); - contentJson.addProperty("kind", createNoteOptions.kind()); - contentJson.addProperty("id", createNoteOptions.id()); - contentJson.add("reported_by", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createNoteOptions.reportedBy())); - if (createNoteOptions.relatedUrl() != null) { - contentJson.add("related_url", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createNoteOptions.relatedUrl())); - } - if (createNoteOptions.createTime() != null) { - contentJson.add("create_time", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createNoteOptions.createTime())); - } - if (createNoteOptions.updateTime() != null) { - contentJson.add("update_time", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createNoteOptions.updateTime())); - } - if (createNoteOptions.shared() != null) { - contentJson.addProperty("shared", createNoteOptions.shared()); - } - if (createNoteOptions.finding() != null) { - contentJson.add("finding", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createNoteOptions.finding())); - } - if (createNoteOptions.kpi() != null) { - contentJson.add("kpi", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createNoteOptions.kpi())); - } - if (createNoteOptions.card() != null) { - contentJson.add("card", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createNoteOptions.card())); - } - if (createNoteOptions.section() != null) { - contentJson.add("section", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createNoteOptions.section())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List notes. - * - * List all of the available notes for a specific provider. - * - * @param listNotesOptions the {@link ListNotesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiListNotesResponse} - */ - public ServiceCall listNotes(ListNotesOptions listNotesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listNotesOptions, - "listNotesOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", listNotesOptions.providerId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/notes", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "listNotes"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listNotesOptions.transactionId() != null) { - builder.header("Transaction-Id", listNotesOptions.transactionId()); - } - if (listNotesOptions.pageSize() != null) { - builder.query("page_size", String.valueOf(listNotesOptions.pageSize())); - } - if (listNotesOptions.pageToken() != null) { - builder.query("page_token", String.valueOf(listNotesOptions.pageToken())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get a note by provider. - * - * Get the details of the note that is associated with a specified note ID and provider ID. - * - * @param getNoteOptions the {@link GetNoteOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiNote} - */ - public ServiceCall getNote(GetNoteOptions getNoteOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getNoteOptions, - "getNoteOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", getNoteOptions.providerId()); - pathParamsMap.put("note_id", getNoteOptions.noteId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/notes/{note_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "getNote"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", getNoteOptions.transactionId()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a note. - * - * Update a note that already exists in your account. - * - * @param updateNoteOptions the {@link UpdateNoteOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiNote} - */ - public ServiceCall updateNote(UpdateNoteOptions updateNoteOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateNoteOptions, - "updateNoteOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", updateNoteOptions.providerId()); - pathParamsMap.put("note_id", updateNoteOptions.noteId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/notes/{note_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "updateNote"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (updateNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", updateNoteOptions.transactionId()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("short_description", updateNoteOptions.shortDescription()); - contentJson.addProperty("long_description", updateNoteOptions.longDescription()); - contentJson.addProperty("kind", updateNoteOptions.kind()); - contentJson.addProperty("id", updateNoteOptions.id()); - contentJson.add("reported_by", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateNoteOptions.reportedBy())); - if (updateNoteOptions.relatedUrl() != null) { - contentJson.add("related_url", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateNoteOptions.relatedUrl())); - } - if (updateNoteOptions.createTime() != null) { - contentJson.add("create_time", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateNoteOptions.createTime())); - } - if (updateNoteOptions.updateTime() != null) { - contentJson.add("update_time", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateNoteOptions.updateTime())); - } - if (updateNoteOptions.shared() != null) { - contentJson.addProperty("shared", updateNoteOptions.shared()); - } - if (updateNoteOptions.finding() != null) { - contentJson.add("finding", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateNoteOptions.finding())); - } - if (updateNoteOptions.kpi() != null) { - contentJson.add("kpi", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateNoteOptions.kpi())); - } - if (updateNoteOptions.card() != null) { - contentJson.add("card", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateNoteOptions.card())); - } - if (updateNoteOptions.section() != null) { - contentJson.add("section", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateNoteOptions.section())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a note. - * - * Delete a note with the ID and provider ID that you specify. - * - * @param deleteNoteOptions the {@link DeleteNoteOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteNote(DeleteNoteOptions deleteNoteOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteNoteOptions, - "deleteNoteOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", deleteNoteOptions.providerId()); - pathParamsMap.put("note_id", deleteNoteOptions.noteId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/notes/{note_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "deleteNote"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (deleteNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", deleteNoteOptions.transactionId()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get a note by occurrence. - * - * Get a note that is associated with the occurrence ID that you specify. - * - * @param getOccurrenceNoteOptions the {@link GetOccurrenceNoteOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiNote} - */ - public ServiceCall getOccurrenceNote(GetOccurrenceNoteOptions getOccurrenceNoteOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getOccurrenceNoteOptions, - "getOccurrenceNoteOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", getOccurrenceNoteOptions.providerId()); - pathParamsMap.put("occurrence_id", getOccurrenceNoteOptions.occurrenceId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id}/note", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "getOccurrenceNote"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getOccurrenceNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", getOccurrenceNoteOptions.transactionId()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create an occurrence. - * - * Create an occurrence to denote the existence of a particular type of finding. - * - * An occurrence describes provider-specific details of a note and contains vulnerability details, remediation steps, - * and other general information. - * - * @param createOccurrenceOptions the {@link CreateOccurrenceOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiOccurrence} - */ - public ServiceCall createOccurrence(CreateOccurrenceOptions createOccurrenceOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createOccurrenceOptions, - "createOccurrenceOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", createOccurrenceOptions.providerId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/occurrences", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "createOccurrence"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (createOccurrenceOptions.transactionId() != null) { - builder.header("Transaction-Id", createOccurrenceOptions.transactionId()); - } - if (createOccurrenceOptions.replaceIfExists() != null) { - builder.header("Replace-If-Exists", createOccurrenceOptions.replaceIfExists()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("note_name", createOccurrenceOptions.noteName()); - contentJson.addProperty("kind", createOccurrenceOptions.kind()); - contentJson.addProperty("id", createOccurrenceOptions.id()); - if (createOccurrenceOptions.resourceUrl() != null) { - contentJson.addProperty("resource_url", createOccurrenceOptions.resourceUrl()); - } - if (createOccurrenceOptions.remediation() != null) { - contentJson.addProperty("remediation", createOccurrenceOptions.remediation()); - } - if (createOccurrenceOptions.context() != null) { - contentJson.add("context", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createOccurrenceOptions.context())); - } - if (createOccurrenceOptions.finding() != null) { - contentJson.add("finding", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createOccurrenceOptions.finding())); - } - if (createOccurrenceOptions.kpi() != null) { - contentJson.add("kpi", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createOccurrenceOptions.kpi())); - } - if (createOccurrenceOptions.referenceData() != null) { - contentJson.add("reference_data", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createOccurrenceOptions.referenceData())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List occurrences. - * - * List all of the occurrences that are associated with the provider ID that you specify. - * - * @param listOccurrencesOptions the {@link ListOccurrencesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiListOccurrencesResponse} - */ - public ServiceCall listOccurrences(ListOccurrencesOptions listOccurrencesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listOccurrencesOptions, - "listOccurrencesOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", listOccurrencesOptions.providerId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/occurrences", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "listOccurrences"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listOccurrencesOptions.transactionId() != null) { - builder.header("Transaction-Id", listOccurrencesOptions.transactionId()); - } - if (listOccurrencesOptions.pageSize() != null) { - builder.query("page_size", String.valueOf(listOccurrencesOptions.pageSize())); - } - if (listOccurrencesOptions.pageToken() != null) { - builder.query("page_token", String.valueOf(listOccurrencesOptions.pageToken())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List occurrences by note. - * - * Get a list of occurrences that are associated with a specific note. - * - * @param listNoteOccurrencesOptions the {@link ListNoteOccurrencesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiListNoteOccurrencesResponse} - */ - public ServiceCall listNoteOccurrences(ListNoteOccurrencesOptions listNoteOccurrencesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listNoteOccurrencesOptions, - "listNoteOccurrencesOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", listNoteOccurrencesOptions.providerId()); - pathParamsMap.put("note_id", listNoteOccurrencesOptions.noteId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/notes/{note_id}/occurrences", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "listNoteOccurrences"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listNoteOccurrencesOptions.transactionId() != null) { - builder.header("Transaction-Id", listNoteOccurrencesOptions.transactionId()); - } - if (listNoteOccurrencesOptions.pageSize() != null) { - builder.query("page_size", String.valueOf(listNoteOccurrencesOptions.pageSize())); - } - if (listNoteOccurrencesOptions.pageToken() != null) { - builder.query("page_token", String.valueOf(listNoteOccurrencesOptions.pageToken())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get a specific occurrence. - * - * Get the details of a specific occurrence by specifying the ID and provider ID. - * - * @param getOccurrenceOptions the {@link GetOccurrenceOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiOccurrence} - */ - public ServiceCall getOccurrence(GetOccurrenceOptions getOccurrenceOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getOccurrenceOptions, - "getOccurrenceOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", getOccurrenceOptions.providerId()); - pathParamsMap.put("occurrence_id", getOccurrenceOptions.occurrenceId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "getOccurrence"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getOccurrenceOptions.transactionId() != null) { - builder.header("Transaction-Id", getOccurrenceOptions.transactionId()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update an occurrence. - * - * Update an occurrence that already exists in your account. - * - * @param updateOccurrenceOptions the {@link UpdateOccurrenceOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiOccurrence} - */ - public ServiceCall updateOccurrence(UpdateOccurrenceOptions updateOccurrenceOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateOccurrenceOptions, - "updateOccurrenceOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", updateOccurrenceOptions.providerId()); - pathParamsMap.put("occurrence_id", updateOccurrenceOptions.occurrenceId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "updateOccurrence"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (updateOccurrenceOptions.transactionId() != null) { - builder.header("Transaction-Id", updateOccurrenceOptions.transactionId()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("note_name", updateOccurrenceOptions.noteName()); - contentJson.addProperty("kind", updateOccurrenceOptions.kind()); - contentJson.addProperty("id", updateOccurrenceOptions.id()); - if (updateOccurrenceOptions.resourceUrl() != null) { - contentJson.addProperty("resource_url", updateOccurrenceOptions.resourceUrl()); - } - if (updateOccurrenceOptions.remediation() != null) { - contentJson.addProperty("remediation", updateOccurrenceOptions.remediation()); - } - if (updateOccurrenceOptions.context() != null) { - contentJson.add("context", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateOccurrenceOptions.context())); - } - if (updateOccurrenceOptions.finding() != null) { - contentJson.add("finding", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateOccurrenceOptions.finding())); - } - if (updateOccurrenceOptions.kpi() != null) { - contentJson.add("kpi", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateOccurrenceOptions.kpi())); - } - if (updateOccurrenceOptions.referenceData() != null) { - contentJson.add("reference_data", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateOccurrenceOptions.referenceData())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete an occurrence. - * - * Delete an occurrence by specifying the occurrence ID and provider ID. - * - * @param deleteOccurrenceOptions the {@link DeleteOccurrenceOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteOccurrence(DeleteOccurrenceOptions deleteOccurrenceOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteOccurrenceOptions, - "deleteOccurrenceOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - pathParamsMap.put("provider_id", deleteOccurrenceOptions.providerId()); - pathParamsMap.put("occurrence_id", deleteOccurrenceOptions.occurrenceId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers/{provider_id}/occurrences/{occurrence_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "deleteOccurrence"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (deleteOccurrenceOptions.transactionId() != null) { - builder.header("Transaction-Id", deleteOccurrenceOptions.transactionId()); - } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - -} diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListNoteOccurrencesResponse.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListNoteOccurrencesResponse.java deleted file mode 100644 index fbf4881d..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListNoteOccurrencesResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Response including listed occurrences for a note. - */ -public class ApiListNoteOccurrencesResponse extends GenericModel { - - protected List occurrences; - @SerializedName("next_page_token") - protected String nextPageToken; - - /** - * Gets the occurrences. - * - * The occurrences attached to the specified note. - * - * @return the occurrences - */ - public List getOccurrences() { - return occurrences; - } - - /** - * Gets the nextPageToken. - * - * Token to receive the next page of notes. - * - * @return the nextPageToken - */ - public String getNextPageToken() { - return nextPageToken; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListNotesResponse.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListNotesResponse.java deleted file mode 100644 index 50935aee..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListNotesResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Response including listed notes. - */ -public class ApiListNotesResponse extends GenericModel { - - protected List notes; - @SerializedName("next_page_token") - protected String nextPageToken; - - /** - * Gets the notes. - * - * The occurrences requested. - * - * @return the notes - */ - public List getNotes() { - return notes; - } - - /** - * Gets the nextPageToken. - * - * The next pagination token in the list response. It should be used as page_token for the following request. An empty - * value means no more result. - * - * @return the nextPageToken - */ - public String getNextPageToken() { - return nextPageToken; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListOccurrencesResponse.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListOccurrencesResponse.java deleted file mode 100644 index b01defc3..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListOccurrencesResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Response including listed active occurrences. - */ -public class ApiListOccurrencesResponse extends GenericModel { - - protected List occurrences; - @SerializedName("next_page_token") - protected String nextPageToken; - - /** - * Gets the occurrences. - * - * The occurrences requested. - * - * @return the occurrences - */ - public List getOccurrences() { - return occurrences; - } - - /** - * Gets the nextPageToken. - * - * The next pagination token in the list response. It should be used as - * `page_token` for the following request. An empty value means no more results. - * - * @return the nextPageToken - */ - public String getNextPageToken() { - return nextPageToken; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java deleted file mode 100644 index 9d06f845..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A list of providers is returned. - */ -public class ApiListProvidersResponse extends GenericModel { - - protected List providers; - protected Long limit; - protected Long skip; - @SerializedName("total_count") - protected Long totalCount; - - /** - * Gets the providers. - * - * The providers requested. - * - * @return the providers - */ - public List getProviders() { - return providers; - } - - /** - * Gets the limit. - * - * The number of elements returned in the current instance. The default is 200. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the skip. - * - * The offset is the index of the item from which you want to start returning data from. The default is 0. - * - * @return the skip - */ - public Long getSkip() { - return skip; - } - - /** - * Gets the totalCount. - * - * The total number of providers available. - * - * @return the totalCount - */ - public Long getTotalCount() { - return totalCount; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java deleted file mode 100644 index ce282f20..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java +++ /dev/null @@ -1,475 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Provides a detailed description of a note. - */ -public class ApiNote extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - @SerializedName("short_description") - protected String shortDescription; - @SerializedName("long_description") - protected String longDescription; - protected String kind; - @SerializedName("related_url") - protected List relatedUrl; - @SerializedName("expiration_time") - protected Date expirationTime; - @SerializedName("create_time") - protected Date createTime; - @SerializedName("update_time") - protected Date updateTime; - protected String id; - protected Boolean shared; - @SerializedName("reported_by") - protected Reporter reportedBy; - protected FindingType finding; - protected KpiType kpi; - protected Card card; - protected Section section; - - /** - * Builder. - */ - public static class Builder { - private String shortDescription; - private String longDescription; - private String kind; - private List relatedUrl; - private Date expirationTime; - private String id; - private Boolean shared; - private Reporter reportedBy; - private FindingType finding; - private KpiType kpi; - private Card card; - private Section section; - - private Builder(ApiNote apiNote) { - this.shortDescription = apiNote.shortDescription; - this.longDescription = apiNote.longDescription; - this.kind = apiNote.kind; - this.relatedUrl = apiNote.relatedUrl; - this.expirationTime = apiNote.expirationTime; - this.id = apiNote.id; - this.shared = apiNote.shared; - this.reportedBy = apiNote.reportedBy; - this.finding = apiNote.finding; - this.kpi = apiNote.kpi; - this.card = apiNote.card; - this.section = apiNote.section; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param shortDescription the shortDescription - * @param longDescription the longDescription - * @param kind the kind - * @param id the id - * @param reportedBy the reportedBy - */ - public Builder(String shortDescription, String longDescription, String kind, String id, Reporter reportedBy) { - this.shortDescription = shortDescription; - this.longDescription = longDescription; - this.kind = kind; - this.id = id; - this.reportedBy = reportedBy; - } - - /** - * Builds a ApiNote. - * - * @return the new ApiNote instance - */ - public ApiNote build() { - return new ApiNote(this); - } - - /** - * Adds an relatedUrl to relatedUrl. - * - * @param relatedUrl the new relatedUrl - * @return the ApiNote builder - */ - public Builder addRelatedUrl(ApiNoteRelatedUrl relatedUrl) { - com.ibm.cloud.sdk.core.util.Validator.notNull(relatedUrl, - "relatedUrl cannot be null"); - if (this.relatedUrl == null) { - this.relatedUrl = new ArrayList(); - } - this.relatedUrl.add(relatedUrl); - return this; - } - - /** - * Set the shortDescription. - * - * @param shortDescription the shortDescription - * @return the ApiNote builder - */ - public Builder shortDescription(String shortDescription) { - this.shortDescription = shortDescription; - return this; - } - - /** - * Set the longDescription. - * - * @param longDescription the longDescription - * @return the ApiNote builder - */ - public Builder longDescription(String longDescription) { - this.longDescription = longDescription; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the ApiNote builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the relatedUrl. - * Existing relatedUrl will be replaced. - * - * @param relatedUrl the relatedUrl - * @return the ApiNote builder - */ - public Builder relatedUrl(List relatedUrl) { - this.relatedUrl = relatedUrl; - return this; - } - - /** - * Set the expirationTime. - * - * @param expirationTime the expirationTime - * @return the ApiNote builder - */ - public Builder expirationTime(Date expirationTime) { - this.expirationTime = expirationTime; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the ApiNote builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the shared. - * - * @param shared the shared - * @return the ApiNote builder - */ - public Builder shared(Boolean shared) { - this.shared = shared; - return this; - } - - /** - * Set the reportedBy. - * - * @param reportedBy the reportedBy - * @return the ApiNote builder - */ - public Builder reportedBy(Reporter reportedBy) { - this.reportedBy = reportedBy; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the ApiNote builder - */ - public Builder finding(FindingType finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the ApiNote builder - */ - public Builder kpi(KpiType kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the card. - * - * @param card the card - * @return the ApiNote builder - */ - public Builder card(Card card) { - this.card = card; - return this; - } - - /** - * Set the section. - * - * @param section the section - * @return the ApiNote builder - */ - public Builder section(Section section) { - this.section = section; - return this; - } - } - - protected ApiNote(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.shortDescription, - "shortDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.longDescription, - "longDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.reportedBy, - "reportedBy cannot be null"); - shortDescription = builder.shortDescription; - longDescription = builder.longDescription; - kind = builder.kind; - relatedUrl = builder.relatedUrl; - expirationTime = builder.expirationTime; - id = builder.id; - shared = builder.shared; - reportedBy = builder.reportedBy; - finding = builder.finding; - kpi = builder.kpi; - card = builder.card; - section = builder.section; - } - - /** - * New builder. - * - * @return a ApiNote builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the shortDescription. - * - * A one sentence description of your note. - * - * @return the shortDescription - */ - public String shortDescription() { - return shortDescription; - } - - /** - * Gets the longDescription. - * - * A more detailed description of your note. - * - * @return the longDescription - */ - public String longDescription() { - return longDescription; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the relatedUrl. - * - * @return the relatedUrl - */ - public List relatedUrl() { - return relatedUrl; - } - - /** - * Gets the expirationTime. - * - * Time of expiration for this note, null if note does not expire. - * - * @return the expirationTime - */ - public Date expirationTime() { - return expirationTime; - } - - /** - * Gets the createTime. - * - * Output only. The time this note was created. This field can be used as a filter in list requests. - * - * @return the createTime - */ - public Date createTime() { - return createTime; - } - - /** - * Gets the updateTime. - * - * Output only. The time this note was last updated. This field can be used as a filter in list requests. - * - * @return the updateTime - */ - public Date updateTime() { - return updateTime; - } - - /** - * Gets the id. - * - * The ID of the note. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the shared. - * - * True if this note can be shared by multiple accounts. - * - * @return the shared - */ - public Boolean shared() { - return shared; - } - - /** - * Gets the reportedBy. - * - * The entity reporting a note. - * - * @return the reportedBy - */ - public Reporter reportedBy() { - return reportedBy; - } - - /** - * Gets the finding. - * - * FindingType provides details about a finding note. - * - * @return the finding - */ - public FindingType finding() { - return finding; - } - - /** - * Gets the kpi. - * - * KpiType provides details about a KPI note. - * - * @return the kpi - */ - public KpiType kpi() { - return kpi; - } - - /** - * Gets the card. - * - * Card provides details about a card kind of note. - * - * @return the card - */ - public Card card() { - return card; - } - - /** - * Gets the section. - * - * Card provides details about a card kind of note. - * - * @return the section - */ - public Section section() { - return section; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java deleted file mode 100644 index 3a888794..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Metadata for any related URL information. - */ -public class ApiNoteRelatedUrl extends GenericModel { - - protected String label; - protected String url; - - /** - * Builder. - */ - public static class Builder { - private String label; - private String url; - - private Builder(ApiNoteRelatedUrl apiNoteRelatedUrl) { - this.label = apiNoteRelatedUrl.label; - this.url = apiNoteRelatedUrl.url; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param label the label - * @param url the url - */ - public Builder(String label, String url) { - this.label = label; - this.url = url; - } - - /** - * Builds a ApiNoteRelatedUrl. - * - * @return the new ApiNoteRelatedUrl instance - */ - public ApiNoteRelatedUrl build() { - return new ApiNoteRelatedUrl(this); - } - - /** - * Set the label. - * - * @param label the label - * @return the ApiNoteRelatedUrl builder - */ - public Builder label(String label) { - this.label = label; - return this; - } - - /** - * Set the url. - * - * @param url the url - * @return the ApiNoteRelatedUrl builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - } - - protected ApiNoteRelatedUrl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.label, - "label cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.url, - "url cannot be null"); - label = builder.label; - url = builder.url; - } - - /** - * New builder. - * - * @return a ApiNoteRelatedUrl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the label. - * - * Label to describe usage of the URL. - * - * @return the label - */ - public String label() { - return label; - } - - /** - * Gets the url. - * - * The URL that you want to associate with the note. - * - * @return the url - */ - public String url() { - return url; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java deleted file mode 100644 index 5573504e..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java +++ /dev/null @@ -1,371 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.Date; -import java.util.Map; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * `Occurrence` includes information about analysis occurrences for an image. - */ -public class ApiOccurrence extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - @SerializedName("resource_url") - protected String resourceUrl; - @SerializedName("note_name") - protected String noteName; - protected String kind; - protected String remediation; - @SerializedName("create_time") - protected Date createTime; - @SerializedName("update_time") - protected Date updateTime; - protected String id; - protected Context context; - protected Finding finding; - protected Kpi kpi; - @SerializedName("reference_data") - protected Map referenceData; - - /** - * Builder. - */ - public static class Builder { - private String resourceUrl; - private String noteName; - private String kind; - private String remediation; - private String id; - private Context context; - private Finding finding; - private Kpi kpi; - private Map referenceData; - - private Builder(ApiOccurrence apiOccurrence) { - this.resourceUrl = apiOccurrence.resourceUrl; - this.noteName = apiOccurrence.noteName; - this.kind = apiOccurrence.kind; - this.remediation = apiOccurrence.remediation; - this.id = apiOccurrence.id; - this.context = apiOccurrence.context; - this.finding = apiOccurrence.finding; - this.kpi = apiOccurrence.kpi; - this.referenceData = apiOccurrence.referenceData; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param noteName the noteName - * @param kind the kind - * @param id the id - */ - public Builder(String noteName, String kind, String id) { - this.noteName = noteName; - this.kind = kind; - this.id = id; - } - - /** - * Builds a ApiOccurrence. - * - * @return the new ApiOccurrence instance - */ - public ApiOccurrence build() { - return new ApiOccurrence(this); - } - - /** - * Set the resourceUrl. - * - * @param resourceUrl the resourceUrl - * @return the ApiOccurrence builder - */ - public Builder resourceUrl(String resourceUrl) { - this.resourceUrl = resourceUrl; - return this; - } - - /** - * Set the noteName. - * - * @param noteName the noteName - * @return the ApiOccurrence builder - */ - public Builder noteName(String noteName) { - this.noteName = noteName; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the ApiOccurrence builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the remediation. - * - * @param remediation the remediation - * @return the ApiOccurrence builder - */ - public Builder remediation(String remediation) { - this.remediation = remediation; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the ApiOccurrence builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the context. - * - * @param context the context - * @return the ApiOccurrence builder - */ - public Builder context(Context context) { - this.context = context; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the ApiOccurrence builder - */ - public Builder finding(Finding finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the ApiOccurrence builder - */ - public Builder kpi(Kpi kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the referenceData. - * - * @param referenceData the referenceData - * @return the ApiOccurrence builder - */ - public Builder referenceData(Map referenceData) { - this.referenceData = referenceData; - return this; - } - } - - protected ApiOccurrence(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.noteName, - "noteName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - resourceUrl = builder.resourceUrl; - noteName = builder.noteName; - kind = builder.kind; - remediation = builder.remediation; - id = builder.id; - context = builder.context; - finding = builder.finding; - kpi = builder.kpi; - referenceData = builder.referenceData; - } - - /** - * New builder. - * - * @return a ApiOccurrence builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the resourceUrl. - * - * The unique URL of the resource, image or the container, for which the `Occurrence` applies. For example, - * https://gcr.io/provider/image@sha256:foo. This field can be used as a filter in list requests. - * - * @return the resourceUrl - */ - public String resourceUrl() { - return resourceUrl; - } - - /** - * Gets the noteName. - * - * An analysis note associated with this image, in the form "{account_id}/providers/{provider_id}/notes/{note_id}" - * This field can be used as a filter in list requests. - * - * @return the noteName - */ - public String noteName() { - return noteName; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the remediation. - * - * A description of actions that can be taken to remedy the `Note`. - * - * @return the remediation - */ - public String remediation() { - return remediation; - } - - /** - * Gets the createTime. - * - * Output only. The time this `Occurrence` was created. - * - * @return the createTime - */ - public Date createTime() { - return createTime; - } - - /** - * Gets the updateTime. - * - * Output only. The time this `Occurrence` was last updated. - * - * @return the updateTime - */ - public Date updateTime() { - return updateTime; - } - - /** - * Gets the id. - * - * The id of the occurrence. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the context. - * - * @return the context - */ - public Context context() { - return context; - } - - /** - * Gets the finding. - * - * Finding provides details about a finding occurrence. - * - * @return the finding - */ - public Finding finding() { - return finding; - } - - /** - * Gets the kpi. - * - * Kpi provides details about a KPI occurrence. - * - * @return the kpi - */ - public Kpi kpi() { - return kpi; - } - - /** - * Gets the referenceData. - * - * Additional data for the finding, like AT event etc. - * - * @return the referenceData - */ - public Map referenceData() { - return referenceData; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java deleted file mode 100644 index 40f74d79..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Provides a detailed description of a provider. - */ -public class ApiProvider extends GenericModel { - - protected String name; - protected String id; - - /** - * Gets the name. - * - * The name of the provider in the form '{account_id}/providers/{provider_id}'. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the id. - * - * The ID of the provider. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Card.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Card.java deleted file mode 100644 index 4d62635f..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Card.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Card provides details about a card kind of note. - */ -public class Card extends GenericModel { - - protected String section; - protected String title; - protected String subtitle; - protected Long order; - @SerializedName("finding_note_names") - protected List findingNoteNames; - @SerializedName("requires_configuration") - protected Boolean requiresConfiguration; - @SerializedName("badge_text") - protected String badgeText; - @SerializedName("badge_image") - protected String badgeImage; - protected List elements; - - /** - * Builder. - */ - public static class Builder { - private String section; - private String title; - private String subtitle; - private Long order; - private List findingNoteNames; - private Boolean requiresConfiguration; - private String badgeText; - private String badgeImage; - private List elements; - - private Builder(Card card) { - this.section = card.section; - this.title = card.title; - this.subtitle = card.subtitle; - this.order = card.order; - this.findingNoteNames = card.findingNoteNames; - this.requiresConfiguration = card.requiresConfiguration; - this.badgeText = card.badgeText; - this.badgeImage = card.badgeImage; - this.elements = card.elements; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param section the section - * @param title the title - * @param subtitle the subtitle - * @param findingNoteNames the findingNoteNames - * @param elements the elements - */ - public Builder(String section, String title, String subtitle, List findingNoteNames, List elements) { - this.section = section; - this.title = title; - this.subtitle = subtitle; - this.findingNoteNames = findingNoteNames; - this.elements = elements; - } - - /** - * Builds a Card. - * - * @return the new Card instance - */ - public Card build() { - return new Card(this); - } - - /** - * Adds an findingNoteNames to findingNoteNames. - * - * @param findingNoteNames the new findingNoteNames - * @return the Card builder - */ - public Builder addFindingNoteNames(String findingNoteNames) { - com.ibm.cloud.sdk.core.util.Validator.notNull(findingNoteNames, - "findingNoteNames cannot be null"); - if (this.findingNoteNames == null) { - this.findingNoteNames = new ArrayList(); - } - this.findingNoteNames.add(findingNoteNames); - return this; - } - - /** - * Adds an elements to elements. - * - * @param elements the new elements - * @return the Card builder - */ - public Builder addElements(CardElement elements) { - com.ibm.cloud.sdk.core.util.Validator.notNull(elements, - "elements cannot be null"); - if (this.elements == null) { - this.elements = new ArrayList(); - } - this.elements.add(elements); - return this; - } - - /** - * Set the section. - * - * @param section the section - * @return the Card builder - */ - public Builder section(String section) { - this.section = section; - return this; - } - - /** - * Set the title. - * - * @param title the title - * @return the Card builder - */ - public Builder title(String title) { - this.title = title; - return this; - } - - /** - * Set the subtitle. - * - * @param subtitle the subtitle - * @return the Card builder - */ - public Builder subtitle(String subtitle) { - this.subtitle = subtitle; - return this; - } - - /** - * Set the order. - * - * @param order the order - * @return the Card builder - */ - public Builder order(long order) { - this.order = order; - return this; - } - - /** - * Set the findingNoteNames. - * Existing findingNoteNames will be replaced. - * - * @param findingNoteNames the findingNoteNames - * @return the Card builder - */ - public Builder findingNoteNames(List findingNoteNames) { - this.findingNoteNames = findingNoteNames; - return this; - } - - /** - * Set the requiresConfiguration. - * - * @param requiresConfiguration the requiresConfiguration - * @return the Card builder - */ - public Builder requiresConfiguration(Boolean requiresConfiguration) { - this.requiresConfiguration = requiresConfiguration; - return this; - } - - /** - * Set the badgeText. - * - * @param badgeText the badgeText - * @return the Card builder - */ - public Builder badgeText(String badgeText) { - this.badgeText = badgeText; - return this; - } - - /** - * Set the badgeImage. - * - * @param badgeImage the badgeImage - * @return the Card builder - */ - public Builder badgeImage(String badgeImage) { - this.badgeImage = badgeImage; - return this; - } - - /** - * Set the elements. - * Existing elements will be replaced. - * - * @param elements the elements - * @return the Card builder - */ - public Builder elements(List elements) { - this.elements = elements; - return this; - } - } - - protected Card(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.section, - "section cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.title, - "title cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subtitle, - "subtitle cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.findingNoteNames, - "findingNoteNames cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.elements, - "elements cannot be null"); - section = builder.section; - title = builder.title; - subtitle = builder.subtitle; - order = builder.order; - findingNoteNames = builder.findingNoteNames; - requiresConfiguration = builder.requiresConfiguration; - badgeText = builder.badgeText; - badgeImage = builder.badgeImage; - elements = builder.elements; - } - - /** - * New builder. - * - * @return a Card builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the section. - * - * The section this card belongs to. - * - * @return the section - */ - public String section() { - return section; - } - - /** - * Gets the title. - * - * The title of this card. - * - * @return the title - */ - public String title() { - return title; - } - - /** - * Gets the subtitle. - * - * The subtitle of this card. - * - * @return the subtitle - */ - public String subtitle() { - return subtitle; - } - - /** - * Gets the order. - * - * The order of the card in which it will appear on SA dashboard in the mentioned section. - * - * @return the order - */ - public Long order() { - return order; - } - - /** - * Gets the findingNoteNames. - * - * The finding note names associated to this card. - * - * @return the findingNoteNames - */ - public List findingNoteNames() { - return findingNoteNames; - } - - /** - * Gets the requiresConfiguration. - * - * @return the requiresConfiguration - */ - public Boolean requiresConfiguration() { - return requiresConfiguration; - } - - /** - * Gets the badgeText. - * - * The text associated to the card's badge. - * - * @return the badgeText - */ - public String badgeText() { - return badgeText; - } - - /** - * Gets the badgeImage. - * - * The base64 content of the image associated to the card's badge. - * - * @return the badgeImage - */ - public String badgeImage() { - return badgeImage; - } - - /** - * Gets the elements. - * - * The elements of this card. - * - * @return the elements - */ - public List elements() { - return elements; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElement.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElement.java deleted file mode 100644 index 9050869f..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElement.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * CardElement provides details about the elements of a Card. - * - * Classes which extend this class: - * - CardElementNumericCardElement - * - CardElementBreakdownCardElement - * - CardElementTimeSeriesCardElement - */ -public class CardElement extends GenericModel { - @SuppressWarnings("unused") - protected static String discriminatorPropertyName = "kind"; - protected static java.util.Map> discriminatorMapping; - static { - discriminatorMapping = new java.util.HashMap<>(); - discriminatorMapping.put("NUMERIC", CardElementNumericCardElement.class); - discriminatorMapping.put("BREAKDOWN", CardElementBreakdownCardElement.class); - discriminatorMapping.put("TIME_SERIES", CardElementTimeSeriesCardElement.class); - } - - /** - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - */ - public interface Kind { - /** NUMERIC. */ - String NUMERIC = "NUMERIC"; - /** BREAKDOWN. */ - String BREAKDOWN = "BREAKDOWN"; - /** TIME_SERIES. */ - String TIME_SERIES = "TIME_SERIES"; - } - - protected String text; - protected String kind; - @SerializedName("default_time_range") - protected String defaultTimeRange; - @SerializedName("value_type") - protected NumericCardElementValueType valueType; - @SerializedName("value_types") - protected List valueTypes; - @SerializedName("default_interval") - protected String defaultInterval; - - protected CardElement() { - } - - /** - * Gets the text. - * - * The text of this card element. - * - * @return the text - */ - public String text() { - return text; - } - - /** - * Gets the kind. - * - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the defaultTimeRange. - * - * The default time range of this card element. - * - * @return the defaultTimeRange - */ - public String defaultTimeRange() { - return defaultTimeRange; - } - - /** - * Gets the valueType. - * - * @return the valueType - */ - public NumericCardElementValueType valueType() { - return valueType; - } - - /** - * Gets the valueTypes. - * - * the value types associated to this card element. - * - * @return the valueTypes - */ - public List valueTypes() { - return valueTypes; - } - - /** - * Gets the defaultInterval. - * - * The default interval of the time series. - * - * @return the defaultInterval - */ - public String defaultInterval() { - return defaultInterval; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementBreakdownCardElement.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementBreakdownCardElement.java deleted file mode 100644 index a691588a..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementBreakdownCardElement.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * A card element with a breakdown of values. - */ -public class CardElementBreakdownCardElement extends CardElement { - - /** - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - */ - public interface Kind { - /** NUMERIC. */ - String NUMERIC = "NUMERIC"; - /** BREAKDOWN. */ - String BREAKDOWN = "BREAKDOWN"; - /** TIME_SERIES. */ - String TIME_SERIES = "TIME_SERIES"; - } - - - /** - * Builder. - */ - public static class Builder { - private String text; - private String kind; - private String defaultTimeRange; - private List valueTypes; - - public Builder(CardElement cardElementBreakdownCardElement) { - this.text = cardElementBreakdownCardElement.text; - this.kind = cardElementBreakdownCardElement.kind; - this.defaultTimeRange = cardElementBreakdownCardElement.defaultTimeRange; - this.valueTypes = cardElementBreakdownCardElement.valueTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param text the text - * @param kind the kind - * @param valueTypes the valueTypes - */ - public Builder(String text, String kind, List valueTypes) { - this.text = text; - this.kind = kind; - this.valueTypes = valueTypes; - } - - /** - * Builds a CardElementBreakdownCardElement. - * - * @return the new CardElementBreakdownCardElement instance - */ - public CardElementBreakdownCardElement build() { - return new CardElementBreakdownCardElement(this); - } - - /** - * Adds an valueTypes to valueTypes. - * - * @param valueTypes the new valueTypes - * @return the CardElementBreakdownCardElement builder - */ - public Builder addValueTypes(ValueType valueTypes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(valueTypes, - "valueTypes cannot be null"); - if (this.valueTypes == null) { - this.valueTypes = new ArrayList(); - } - this.valueTypes.add(valueTypes); - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the CardElementBreakdownCardElement builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CardElementBreakdownCardElement builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the defaultTimeRange. - * - * @param defaultTimeRange the defaultTimeRange - * @return the CardElementBreakdownCardElement builder - */ - public Builder defaultTimeRange(String defaultTimeRange) { - this.defaultTimeRange = defaultTimeRange; - return this; - } - - /** - * Set the valueTypes. - * Existing valueTypes will be replaced. - * - * @param valueTypes the valueTypes - * @return the CardElementBreakdownCardElement builder - */ - public Builder valueTypes(List valueTypes) { - this.valueTypes = valueTypes; - return this; - } - } - - protected CardElementBreakdownCardElement(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.valueTypes, - "valueTypes cannot be null"); - text = builder.text; - kind = builder.kind; - defaultTimeRange = builder.defaultTimeRange; - valueTypes = builder.valueTypes; - } - - /** - * New builder. - * - * @return a CardElementBreakdownCardElement builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementNumericCardElement.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementNumericCardElement.java deleted file mode 100644 index f49a9014..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementNumericCardElement.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -/** - * A card element with a single numeric value". - */ -public class CardElementNumericCardElement extends CardElement { - - /** - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - */ - public interface Kind { - /** NUMERIC. */ - String NUMERIC = "NUMERIC"; - /** BREAKDOWN. */ - String BREAKDOWN = "BREAKDOWN"; - /** TIME_SERIES. */ - String TIME_SERIES = "TIME_SERIES"; - } - - - /** - * Builder. - */ - public static class Builder { - private String text; - private String kind; - private String defaultTimeRange; - private NumericCardElementValueType valueType; - - public Builder(CardElement cardElementNumericCardElement) { - this.text = cardElementNumericCardElement.text; - this.kind = cardElementNumericCardElement.kind; - this.defaultTimeRange = cardElementNumericCardElement.defaultTimeRange; - this.valueType = cardElementNumericCardElement.valueType; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param text the text - * @param kind the kind - * @param valueType the valueType - */ - public Builder(String text, String kind, NumericCardElementValueType valueType) { - this.text = text; - this.kind = kind; - this.valueType = valueType; - } - - /** - * Builds a CardElementNumericCardElement. - * - * @return the new CardElementNumericCardElement instance - */ - public CardElementNumericCardElement build() { - return new CardElementNumericCardElement(this); - } - - /** - * Set the text. - * - * @param text the text - * @return the CardElementNumericCardElement builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CardElementNumericCardElement builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the defaultTimeRange. - * - * @param defaultTimeRange the defaultTimeRange - * @return the CardElementNumericCardElement builder - */ - public Builder defaultTimeRange(String defaultTimeRange) { - this.defaultTimeRange = defaultTimeRange; - return this; - } - - /** - * Set the valueType. - * - * @param valueType the valueType - * @return the CardElementNumericCardElement builder - */ - public Builder valueType(NumericCardElementValueType valueType) { - this.valueType = valueType; - return this; - } - } - - protected CardElementNumericCardElement(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.valueType, - "valueType cannot be null"); - text = builder.text; - kind = builder.kind; - defaultTimeRange = builder.defaultTimeRange; - valueType = builder.valueType; - } - - /** - * New builder. - * - * @return a CardElementNumericCardElement builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementTimeSeriesCardElement.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementTimeSeriesCardElement.java deleted file mode 100644 index 64e4bb35..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CardElementTimeSeriesCardElement.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * A card element with a time series chart. - */ -public class CardElementTimeSeriesCardElement extends CardElement { - - /** - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - */ - public interface Kind { - /** NUMERIC. */ - String NUMERIC = "NUMERIC"; - /** BREAKDOWN. */ - String BREAKDOWN = "BREAKDOWN"; - /** TIME_SERIES. */ - String TIME_SERIES = "TIME_SERIES"; - } - - - /** - * Builder. - */ - public static class Builder { - private String text; - private String defaultInterval; - private String kind; - private String defaultTimeRange; - private List valueTypes; - - public Builder(CardElement cardElementTimeSeriesCardElement) { - this.text = cardElementTimeSeriesCardElement.text; - this.defaultInterval = cardElementTimeSeriesCardElement.defaultInterval; - this.kind = cardElementTimeSeriesCardElement.kind; - this.defaultTimeRange = cardElementTimeSeriesCardElement.defaultTimeRange; - this.valueTypes = cardElementTimeSeriesCardElement.valueTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param text the text - * @param kind the kind - * @param valueTypes the valueTypes - */ - public Builder(String text, String kind, List valueTypes) { - this.text = text; - this.kind = kind; - this.valueTypes = valueTypes; - } - - /** - * Builds a CardElementTimeSeriesCardElement. - * - * @return the new CardElementTimeSeriesCardElement instance - */ - public CardElementTimeSeriesCardElement build() { - return new CardElementTimeSeriesCardElement(this); - } - - /** - * Adds an valueTypes to valueTypes. - * - * @param valueTypes the new valueTypes - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder addValueTypes(ValueType valueTypes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(valueTypes, - "valueTypes cannot be null"); - if (this.valueTypes == null) { - this.valueTypes = new ArrayList(); - } - this.valueTypes.add(valueTypes); - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Set the defaultInterval. - * - * @param defaultInterval the defaultInterval - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder defaultInterval(String defaultInterval) { - this.defaultInterval = defaultInterval; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the defaultTimeRange. - * - * @param defaultTimeRange the defaultTimeRange - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder defaultTimeRange(String defaultTimeRange) { - this.defaultTimeRange = defaultTimeRange; - return this; - } - - /** - * Set the valueTypes. - * Existing valueTypes will be replaced. - * - * @param valueTypes the valueTypes - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder valueTypes(List valueTypes) { - this.valueTypes = valueTypes; - return this; - } - } - - protected CardElementTimeSeriesCardElement(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.valueTypes, - "valueTypes cannot be null"); - text = builder.text; - defaultInterval = builder.defaultInterval; - kind = builder.kind; - defaultTimeRange = builder.defaultTimeRange; - valueTypes = builder.valueTypes; - } - - /** - * New builder. - * - * @return a CardElementTimeSeriesCardElement builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Context.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Context.java deleted file mode 100644 index af5dadcc..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Context.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Context. - */ -public class Context extends GenericModel { - - protected String region; - @SerializedName("resource_crn") - protected String resourceCrn; - @SerializedName("resource_id") - protected String resourceId; - @SerializedName("resource_name") - protected String resourceName; - @SerializedName("resource_type") - protected String resourceType; - @SerializedName("service_crn") - protected String serviceCrn; - @SerializedName("service_name") - protected String serviceName; - @SerializedName("environment_name") - protected String environmentName; - @SerializedName("component_name") - protected String componentName; - @SerializedName("toolchain_id") - protected String toolchainId; - - /** - * Builder. - */ - public static class Builder { - private String region; - private String resourceCrn; - private String resourceId; - private String resourceName; - private String resourceType; - private String serviceCrn; - private String serviceName; - private String environmentName; - private String componentName; - private String toolchainId; - - private Builder(Context context) { - this.region = context.region; - this.resourceCrn = context.resourceCrn; - this.resourceId = context.resourceId; - this.resourceName = context.resourceName; - this.resourceType = context.resourceType; - this.serviceCrn = context.serviceCrn; - this.serviceName = context.serviceName; - this.environmentName = context.environmentName; - this.componentName = context.componentName; - this.toolchainId = context.toolchainId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a Context. - * - * @return the new Context instance - */ - public Context build() { - return new Context(this); - } - - /** - * Set the region. - * - * @param region the region - * @return the Context builder - */ - public Builder region(String region) { - this.region = region; - return this; - } - - /** - * Set the resourceCrn. - * - * @param resourceCrn the resourceCrn - * @return the Context builder - */ - public Builder resourceCrn(String resourceCrn) { - this.resourceCrn = resourceCrn; - return this; - } - - /** - * Set the resourceId. - * - * @param resourceId the resourceId - * @return the Context builder - */ - public Builder resourceId(String resourceId) { - this.resourceId = resourceId; - return this; - } - - /** - * Set the resourceName. - * - * @param resourceName the resourceName - * @return the Context builder - */ - public Builder resourceName(String resourceName) { - this.resourceName = resourceName; - return this; - } - - /** - * Set the resourceType. - * - * @param resourceType the resourceType - * @return the Context builder - */ - public Builder resourceType(String resourceType) { - this.resourceType = resourceType; - return this; - } - - /** - * Set the serviceCrn. - * - * @param serviceCrn the serviceCrn - * @return the Context builder - */ - public Builder serviceCrn(String serviceCrn) { - this.serviceCrn = serviceCrn; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the Context builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the environmentName. - * - * @param environmentName the environmentName - * @return the Context builder - */ - public Builder environmentName(String environmentName) { - this.environmentName = environmentName; - return this; - } - - /** - * Set the componentName. - * - * @param componentName the componentName - * @return the Context builder - */ - public Builder componentName(String componentName) { - this.componentName = componentName; - return this; - } - - /** - * Set the toolchainId. - * - * @param toolchainId the toolchainId - * @return the Context builder - */ - public Builder toolchainId(String toolchainId) { - this.toolchainId = toolchainId; - return this; - } - } - - protected Context(Builder builder) { - region = builder.region; - resourceCrn = builder.resourceCrn; - resourceId = builder.resourceId; - resourceName = builder.resourceName; - resourceType = builder.resourceType; - serviceCrn = builder.serviceCrn; - serviceName = builder.serviceName; - environmentName = builder.environmentName; - componentName = builder.componentName; - toolchainId = builder.toolchainId; - } - - /** - * New builder. - * - * @return a Context builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the region. - * - * The IBM Cloud region. - * - * @return the region - */ - public String region() { - return region; - } - - /** - * Gets the resourceCrn. - * - * The resource CRN (e.g. certificate CRN, image CRN). - * - * @return the resourceCrn - */ - public String resourceCrn() { - return resourceCrn; - } - - /** - * Gets the resourceId. - * - * The resource ID, in case the CRN is not available. - * - * @return the resourceId - */ - public String resourceId() { - return resourceId; - } - - /** - * Gets the resourceName. - * - * The user-friendly resource name. - * - * @return the resourceName - */ - public String resourceName() { - return resourceName; - } - - /** - * Gets the resourceType. - * - * The resource type name (e.g. Pod, Cluster, Certificate, Image). - * - * @return the resourceType - */ - public String resourceType() { - return resourceType; - } - - /** - * Gets the serviceCrn. - * - * The service CRN (e.g. CertMgr Instance CRN). - * - * @return the serviceCrn - */ - public String serviceCrn() { - return serviceCrn; - } - - /** - * Gets the serviceName. - * - * The service name (e.g. CertMgr). - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the environmentName. - * - * The name of the environment the occurrence applies to. - * - * @return the environmentName - */ - public String environmentName() { - return environmentName; - } - - /** - * Gets the componentName. - * - * The name of the component the occurrence applies to. - * - * @return the componentName - */ - public String componentName() { - return componentName; - } - - /** - * Gets the toolchainId. - * - * The id of the toolchain the occurrence applies to. - * - * @return the toolchainId - */ - public String toolchainId() { - return toolchainId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java deleted file mode 100644 index 8cd0bed8..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java +++ /dev/null @@ -1,548 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createNote options. - */ -public class CreateNoteOptions extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - protected String providerId; - protected String shortDescription; - protected String longDescription; - protected String kind; - protected String id; - protected Reporter reportedBy; - protected List relatedUrl; - protected Date createTime; - protected Date updateTime; - protected Boolean shared; - protected FindingType finding; - protected KpiType kpi; - protected Card card; - protected Section section; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String shortDescription; - private String longDescription; - private String kind; - private String id; - private Reporter reportedBy; - private List relatedUrl; - private Date createTime; - private Date updateTime; - private Boolean shared; - private FindingType finding; - private KpiType kpi; - private Card card; - private Section section; - private String transactionId; - - private Builder(CreateNoteOptions createNoteOptions) { - this.providerId = createNoteOptions.providerId; - this.shortDescription = createNoteOptions.shortDescription; - this.longDescription = createNoteOptions.longDescription; - this.kind = createNoteOptions.kind; - this.id = createNoteOptions.id; - this.reportedBy = createNoteOptions.reportedBy; - this.relatedUrl = createNoteOptions.relatedUrl; - this.createTime = createNoteOptions.createTime; - this.updateTime = createNoteOptions.updateTime; - this.shared = createNoteOptions.shared; - this.finding = createNoteOptions.finding; - this.kpi = createNoteOptions.kpi; - this.card = createNoteOptions.card; - this.section = createNoteOptions.section; - this.transactionId = createNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param shortDescription the shortDescription - * @param longDescription the longDescription - * @param kind the kind - * @param id the id - * @param reportedBy the reportedBy - */ - public Builder(String providerId, String shortDescription, String longDescription, String kind, String id, Reporter reportedBy) { - this.providerId = providerId; - this.shortDescription = shortDescription; - this.longDescription = longDescription; - this.kind = kind; - this.id = id; - this.reportedBy = reportedBy; - } - - /** - * Builds a CreateNoteOptions. - * - * @return the new CreateNoteOptions instance - */ - public CreateNoteOptions build() { - return new CreateNoteOptions(this); - } - - /** - * Adds an relatedUrl to relatedUrl. - * - * @param relatedUrl the new relatedUrl - * @return the CreateNoteOptions builder - */ - public Builder addRelatedUrl(ApiNoteRelatedUrl relatedUrl) { - com.ibm.cloud.sdk.core.util.Validator.notNull(relatedUrl, - "relatedUrl cannot be null"); - if (this.relatedUrl == null) { - this.relatedUrl = new ArrayList(); - } - this.relatedUrl.add(relatedUrl); - return this; - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the CreateNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the shortDescription. - * - * @param shortDescription the shortDescription - * @return the CreateNoteOptions builder - */ - public Builder shortDescription(String shortDescription) { - this.shortDescription = shortDescription; - return this; - } - - /** - * Set the longDescription. - * - * @param longDescription the longDescription - * @return the CreateNoteOptions builder - */ - public Builder longDescription(String longDescription) { - this.longDescription = longDescription; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CreateNoteOptions builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the CreateNoteOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the reportedBy. - * - * @param reportedBy the reportedBy - * @return the CreateNoteOptions builder - */ - public Builder reportedBy(Reporter reportedBy) { - this.reportedBy = reportedBy; - return this; - } - - /** - * Set the relatedUrl. - * Existing relatedUrl will be replaced. - * - * @param relatedUrl the relatedUrl - * @return the CreateNoteOptions builder - */ - public Builder relatedUrl(List relatedUrl) { - this.relatedUrl = relatedUrl; - return this; - } - - /** - * Set the createTime. - * - * @param createTime the createTime - * @return the CreateNoteOptions builder - */ - public Builder createTime(Date createTime) { - this.createTime = createTime; - return this; - } - - /** - * Set the updateTime. - * - * @param updateTime the updateTime - * @return the CreateNoteOptions builder - */ - public Builder updateTime(Date updateTime) { - this.updateTime = updateTime; - return this; - } - - /** - * Set the shared. - * - * @param shared the shared - * @return the CreateNoteOptions builder - */ - public Builder shared(Boolean shared) { - this.shared = shared; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the CreateNoteOptions builder - */ - public Builder finding(FindingType finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the CreateNoteOptions builder - */ - public Builder kpi(KpiType kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the card. - * - * @param card the card - * @return the CreateNoteOptions builder - */ - public Builder card(Card card) { - this.card = card; - return this; - } - - /** - * Set the section. - * - * @param section the section - * @return the CreateNoteOptions builder - */ - public Builder section(Section section) { - this.section = section; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the CreateNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the apiNote. - * - * @param apiNote the apiNote - * @return the CreateNoteOptions builder - */ - public Builder apiNote(ApiNote apiNote) { - this.shortDescription = apiNote.shortDescription(); - this.longDescription = apiNote.longDescription(); - this.kind = apiNote.kind(); - this.id = apiNote.id(); - this.reportedBy = apiNote.reportedBy(); - this.relatedUrl = apiNote.relatedUrl(); - this.createTime = apiNote.createTime(); - this.updateTime = apiNote.updateTime(); - this.shared = apiNote.shared(); - this.finding = apiNote.finding(); - this.kpi = apiNote.kpi(); - this.card = apiNote.card(); - this.section = apiNote.section(); - return this; - } - } - - protected CreateNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.shortDescription, - "shortDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.longDescription, - "longDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.reportedBy, - "reportedBy cannot be null"); - providerId = builder.providerId; - shortDescription = builder.shortDescription; - longDescription = builder.longDescription; - kind = builder.kind; - id = builder.id; - reportedBy = builder.reportedBy; - relatedUrl = builder.relatedUrl; - createTime = builder.createTime; - updateTime = builder.updateTime; - shared = builder.shared; - finding = builder.finding; - kpi = builder.kpi; - card = builder.card; - section = builder.section; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a CreateNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the shortDescription. - * - * A one sentence description of your note. - * - * @return the shortDescription - */ - public String shortDescription() { - return shortDescription; - } - - /** - * Gets the longDescription. - * - * A more detailed description of your note. - * - * @return the longDescription - */ - public String longDescription() { - return longDescription; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the id. - * - * The ID of the note. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the reportedBy. - * - * The entity reporting a note. - * - * @return the reportedBy - */ - public Reporter reportedBy() { - return reportedBy; - } - - /** - * Gets the relatedUrl. - * - * @return the relatedUrl - */ - public List relatedUrl() { - return relatedUrl; - } - - /** - * Gets the createTime. - * - * Output only. The time this note was created. This field can be used as a filter in list requests. - * - * @return the createTime - */ - public Date createTime() { - return createTime; - } - - /** - * Gets the updateTime. - * - * Output only. The time this note was last updated. This field can be used as a filter in list requests. - * - * @return the updateTime - */ - public Date updateTime() { - return updateTime; - } - - /** - * Gets the shared. - * - * True if this note can be shared by multiple accounts. - * - * @return the shared - */ - public Boolean shared() { - return shared; - } - - /** - * Gets the finding. - * - * FindingType provides details about a finding note. - * - * @return the finding - */ - public FindingType finding() { - return finding; - } - - /** - * Gets the kpi. - * - * KpiType provides details about a KPI note. - * - * @return the kpi - */ - public KpiType kpi() { - return kpi; - } - - /** - * Gets the card. - * - * Card provides details about a card kind of note. - * - * @return the card - */ - public Card card() { - return card; - } - - /** - * Gets the section. - * - * Card provides details about a card kind of note. - * - * @return the section - */ - public Section section() { - return section; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java deleted file mode 100644 index d5b6c6b8..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java +++ /dev/null @@ -1,441 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.Map; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createOccurrence options. - */ -public class CreateOccurrenceOptions extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - protected String providerId; - protected String noteName; - protected String kind; - protected String id; - protected String resourceUrl; - protected String remediation; - protected Context context; - protected Finding finding; - protected Kpi kpi; - protected Map referenceData; - protected String transactionId; - protected Boolean replaceIfExists; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteName; - private String kind; - private String id; - private String resourceUrl; - private String remediation; - private Context context; - private Finding finding; - private Kpi kpi; - private Map referenceData; - private String transactionId; - private Boolean replaceIfExists; - - private Builder(CreateOccurrenceOptions createOccurrenceOptions) { - this.providerId = createOccurrenceOptions.providerId; - this.noteName = createOccurrenceOptions.noteName; - this.kind = createOccurrenceOptions.kind; - this.id = createOccurrenceOptions.id; - this.resourceUrl = createOccurrenceOptions.resourceUrl; - this.remediation = createOccurrenceOptions.remediation; - this.context = createOccurrenceOptions.context; - this.finding = createOccurrenceOptions.finding; - this.kpi = createOccurrenceOptions.kpi; - this.referenceData = createOccurrenceOptions.referenceData; - this.transactionId = createOccurrenceOptions.transactionId; - this.replaceIfExists = createOccurrenceOptions.replaceIfExists; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteName the noteName - * @param kind the kind - * @param id the id - */ - public Builder(String providerId, String noteName, String kind, String id) { - this.providerId = providerId; - this.noteName = noteName; - this.kind = kind; - this.id = id; - } - - /** - * Builds a CreateOccurrenceOptions. - * - * @return the new CreateOccurrenceOptions instance - */ - public CreateOccurrenceOptions build() { - return new CreateOccurrenceOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the CreateOccurrenceOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteName. - * - * @param noteName the noteName - * @return the CreateOccurrenceOptions builder - */ - public Builder noteName(String noteName) { - this.noteName = noteName; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CreateOccurrenceOptions builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the CreateOccurrenceOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the resourceUrl. - * - * @param resourceUrl the resourceUrl - * @return the CreateOccurrenceOptions builder - */ - public Builder resourceUrl(String resourceUrl) { - this.resourceUrl = resourceUrl; - return this; - } - - /** - * Set the remediation. - * - * @param remediation the remediation - * @return the CreateOccurrenceOptions builder - */ - public Builder remediation(String remediation) { - this.remediation = remediation; - return this; - } - - /** - * Set the context. - * - * @param context the context - * @return the CreateOccurrenceOptions builder - */ - public Builder context(Context context) { - this.context = context; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the CreateOccurrenceOptions builder - */ - public Builder finding(Finding finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the CreateOccurrenceOptions builder - */ - public Builder kpi(Kpi kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the referenceData. - * - * @param referenceData the referenceData - * @return the CreateOccurrenceOptions builder - */ - public Builder referenceData(Map referenceData) { - this.referenceData = referenceData; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the CreateOccurrenceOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the replaceIfExists. - * - * @param replaceIfExists the replaceIfExists - * @return the CreateOccurrenceOptions builder - */ - public Builder replaceIfExists(Boolean replaceIfExists) { - this.replaceIfExists = replaceIfExists; - return this; - } - - /** - * Set the apiOccurrence. - * - * @param apiOccurrence the apiOccurrence - * @return the CreateOccurrenceOptions builder - */ - public Builder apiOccurrence(ApiOccurrence apiOccurrence) { - this.noteName = apiOccurrence.noteName(); - this.kind = apiOccurrence.kind(); - this.id = apiOccurrence.id(); - this.resourceUrl = apiOccurrence.resourceUrl(); - this.remediation = apiOccurrence.remediation(); - this.context = apiOccurrence.context(); - this.finding = apiOccurrence.finding(); - this.kpi = apiOccurrence.kpi(); - this.referenceData = apiOccurrence.referenceData(); - return this; - } - } - - protected CreateOccurrenceOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.noteName, - "noteName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - providerId = builder.providerId; - noteName = builder.noteName; - kind = builder.kind; - id = builder.id; - resourceUrl = builder.resourceUrl; - remediation = builder.remediation; - context = builder.context; - finding = builder.finding; - kpi = builder.kpi; - referenceData = builder.referenceData; - transactionId = builder.transactionId; - replaceIfExists = builder.replaceIfExists; - } - - /** - * New builder. - * - * @return a CreateOccurrenceOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteName. - * - * An analysis note associated with this image, in the form "{account_id}/providers/{provider_id}/notes/{note_id}" - * This field can be used as a filter in list requests. - * - * @return the noteName - */ - public String noteName() { - return noteName; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the id. - * - * The id of the occurrence. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the resourceUrl. - * - * The unique URL of the resource, image or the container, for which the `Occurrence` applies. For example, - * https://gcr.io/provider/image@sha256:foo. This field can be used as a filter in list requests. - * - * @return the resourceUrl - */ - public String resourceUrl() { - return resourceUrl; - } - - /** - * Gets the remediation. - * - * A description of actions that can be taken to remedy the `Note`. - * - * @return the remediation - */ - public String remediation() { - return remediation; - } - - /** - * Gets the context. - * - * @return the context - */ - public Context context() { - return context; - } - - /** - * Gets the finding. - * - * Finding provides details about a finding occurrence. - * - * @return the finding - */ - public Finding finding() { - return finding; - } - - /** - * Gets the kpi. - * - * Kpi provides details about a KPI occurrence. - * - * @return the kpi - */ - public Kpi kpi() { - return kpi; - } - - /** - * Gets the referenceData. - * - * Additional data for the finding, like AT event etc. - * - * @return the referenceData - */ - public Map referenceData() { - return referenceData; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the replaceIfExists. - * - * When set to true, an existing occurrence is replaced rather than duplicated. - * - * @return the replaceIfExists - */ - public Boolean replaceIfExists() { - return replaceIfExists; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DataTransferred.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DataTransferred.java deleted file mode 100644 index c30ac442..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DataTransferred.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * It provides details about data transferred between clients and servers. - */ -public class DataTransferred extends GenericModel { - - @SerializedName("client_bytes") - protected Long clientBytes; - @SerializedName("server_bytes") - protected Long serverBytes; - @SerializedName("client_packets") - protected Long clientPackets; - @SerializedName("server_packets") - protected Long serverPackets; - - /** - * Builder. - */ - public static class Builder { - private Long clientBytes; - private Long serverBytes; - private Long clientPackets; - private Long serverPackets; - - private Builder(DataTransferred dataTransferred) { - this.clientBytes = dataTransferred.clientBytes; - this.serverBytes = dataTransferred.serverBytes; - this.clientPackets = dataTransferred.clientPackets; - this.serverPackets = dataTransferred.serverPackets; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a DataTransferred. - * - * @return the new DataTransferred instance - */ - public DataTransferred build() { - return new DataTransferred(this); - } - - /** - * Set the clientBytes. - * - * @param clientBytes the clientBytes - * @return the DataTransferred builder - */ - public Builder clientBytes(long clientBytes) { - this.clientBytes = clientBytes; - return this; - } - - /** - * Set the serverBytes. - * - * @param serverBytes the serverBytes - * @return the DataTransferred builder - */ - public Builder serverBytes(long serverBytes) { - this.serverBytes = serverBytes; - return this; - } - - /** - * Set the clientPackets. - * - * @param clientPackets the clientPackets - * @return the DataTransferred builder - */ - public Builder clientPackets(long clientPackets) { - this.clientPackets = clientPackets; - return this; - } - - /** - * Set the serverPackets. - * - * @param serverPackets the serverPackets - * @return the DataTransferred builder - */ - public Builder serverPackets(long serverPackets) { - this.serverPackets = serverPackets; - return this; - } - } - - protected DataTransferred(Builder builder) { - clientBytes = builder.clientBytes; - serverBytes = builder.serverBytes; - clientPackets = builder.clientPackets; - serverPackets = builder.serverPackets; - } - - /** - * New builder. - * - * @return a DataTransferred builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the clientBytes. - * - * The number of client bytes transferred. - * - * @return the clientBytes - */ - public Long clientBytes() { - return clientBytes; - } - - /** - * Gets the serverBytes. - * - * The number of server bytes transferred. - * - * @return the serverBytes - */ - public Long serverBytes() { - return serverBytes; - } - - /** - * Gets the clientPackets. - * - * The number of client packets transferred. - * - * @return the clientPackets - */ - public Long clientPackets() { - return clientPackets; - } - - /** - * Gets the serverPackets. - * - * The number of server packets transferred. - * - * @return the serverPackets - */ - public Long serverPackets() { - return serverPackets; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java deleted file mode 100644 index 93d46f53..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteNote options. - */ -public class DeleteNoteOptions extends GenericModel { - - protected String providerId; - protected String noteId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteId; - private String transactionId; - - private Builder(DeleteNoteOptions deleteNoteOptions) { - this.providerId = deleteNoteOptions.providerId; - this.noteId = deleteNoteOptions.noteId; - this.transactionId = deleteNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteId the noteId - */ - public Builder(String providerId, String noteId) { - this.providerId = providerId; - this.noteId = noteId; - } - - /** - * Builds a DeleteNoteOptions. - * - * @return the new DeleteNoteOptions instance - */ - public DeleteNoteOptions build() { - return new DeleteNoteOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the DeleteNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteId. - * - * @param noteId the noteId - * @return the DeleteNoteOptions builder - */ - public Builder noteId(String noteId) { - this.noteId = noteId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the DeleteNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected DeleteNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.noteId, - "noteId cannot be empty"); - providerId = builder.providerId; - noteId = builder.noteId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a DeleteNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteId. - * - * Second part of note `name`: providers/{provider_id}/notes/{note_id}. - * - * @return the noteId - */ - public String noteId() { - return noteId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java deleted file mode 100644 index 4a15c573..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteOccurrence options. - */ -public class DeleteOccurrenceOptions extends GenericModel { - - protected String providerId; - protected String occurrenceId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String occurrenceId; - private String transactionId; - - private Builder(DeleteOccurrenceOptions deleteOccurrenceOptions) { - this.providerId = deleteOccurrenceOptions.providerId; - this.occurrenceId = deleteOccurrenceOptions.occurrenceId; - this.transactionId = deleteOccurrenceOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param occurrenceId the occurrenceId - */ - public Builder(String providerId, String occurrenceId) { - this.providerId = providerId; - this.occurrenceId = occurrenceId; - } - - /** - * Builds a DeleteOccurrenceOptions. - * - * @return the new DeleteOccurrenceOptions instance - */ - public DeleteOccurrenceOptions build() { - return new DeleteOccurrenceOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the DeleteOccurrenceOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the occurrenceId. - * - * @param occurrenceId the occurrenceId - * @return the DeleteOccurrenceOptions builder - */ - public Builder occurrenceId(String occurrenceId) { - this.occurrenceId = occurrenceId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the DeleteOccurrenceOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected DeleteOccurrenceOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.occurrenceId, - "occurrenceId cannot be empty"); - providerId = builder.providerId; - occurrenceId = builder.occurrenceId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a DeleteOccurrenceOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the occurrenceId. - * - * Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. - * - * @return the occurrenceId - */ - public String occurrenceId() { - return occurrenceId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Finding.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Finding.java deleted file mode 100644 index e40094ef..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Finding.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Finding provides details about a finding occurrence. - */ -public class Finding extends GenericModel { - - /** - * Note provider-assigned severity/impact ranking - * - LOW&#58; Low Impact - * - MEDIUM&#58; Medium Impact - * - HIGH&#58; High Impact - * - CRITICAL&#58; Critical Impact. - */ - public interface Severity { - /** LOW. */ - String LOW = "LOW"; - /** MEDIUM. */ - String MEDIUM = "MEDIUM"; - /** HIGH. */ - String HIGH = "HIGH"; - /** CRITICAL. */ - String CRITICAL = "CRITICAL"; - } - - /** - * Note provider-assigned confidence on the validity of an occurrence - * - LOW&#58; Low Certainty - * - MEDIUM&#58; Medium Certainty - * - HIGH&#58; High Certainty. - */ - public interface Certainty { - /** LOW. */ - String LOW = "LOW"; - /** MEDIUM. */ - String MEDIUM = "MEDIUM"; - /** HIGH. */ - String HIGH = "HIGH"; - } - - protected String severity; - protected String certainty; - @SerializedName("next_steps") - protected List nextSteps; - @SerializedName("network_connection") - protected NetworkConnection networkConnection; - @SerializedName("data_transferred") - protected DataTransferred dataTransferred; - - /** - * Builder. - */ - public static class Builder { - private String severity; - private String certainty; - private List nextSteps; - private NetworkConnection networkConnection; - private DataTransferred dataTransferred; - - private Builder(Finding finding) { - this.severity = finding.severity; - this.certainty = finding.certainty; - this.nextSteps = finding.nextSteps; - this.networkConnection = finding.networkConnection; - this.dataTransferred = finding.dataTransferred; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a Finding. - * - * @return the new Finding instance - */ - public Finding build() { - return new Finding(this); - } - - /** - * Adds an nextSteps to nextSteps. - * - * @param nextSteps the new nextSteps - * @return the Finding builder - */ - public Builder addNextSteps(RemediationStep nextSteps) { - com.ibm.cloud.sdk.core.util.Validator.notNull(nextSteps, - "nextSteps cannot be null"); - if (this.nextSteps == null) { - this.nextSteps = new ArrayList(); - } - this.nextSteps.add(nextSteps); - return this; - } - - /** - * Set the severity. - * - * @param severity the severity - * @return the Finding builder - */ - public Builder severity(String severity) { - this.severity = severity; - return this; - } - - /** - * Set the certainty. - * - * @param certainty the certainty - * @return the Finding builder - */ - public Builder certainty(String certainty) { - this.certainty = certainty; - return this; - } - - /** - * Set the nextSteps. - * Existing nextSteps will be replaced. - * - * @param nextSteps the nextSteps - * @return the Finding builder - */ - public Builder nextSteps(List nextSteps) { - this.nextSteps = nextSteps; - return this; - } - - /** - * Set the networkConnection. - * - * @param networkConnection the networkConnection - * @return the Finding builder - */ - public Builder networkConnection(NetworkConnection networkConnection) { - this.networkConnection = networkConnection; - return this; - } - - /** - * Set the dataTransferred. - * - * @param dataTransferred the dataTransferred - * @return the Finding builder - */ - public Builder dataTransferred(DataTransferred dataTransferred) { - this.dataTransferred = dataTransferred; - return this; - } - } - - protected Finding(Builder builder) { - severity = builder.severity; - certainty = builder.certainty; - nextSteps = builder.nextSteps; - networkConnection = builder.networkConnection; - dataTransferred = builder.dataTransferred; - } - - /** - * New builder. - * - * @return a Finding builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the severity. - * - * Note provider-assigned severity/impact ranking - * - LOW&#58; Low Impact - * - MEDIUM&#58; Medium Impact - * - HIGH&#58; High Impact - * - CRITICAL&#58; Critical Impact. - * - * @return the severity - */ - public String severity() { - return severity; - } - - /** - * Gets the certainty. - * - * Note provider-assigned confidence on the validity of an occurrence - * - LOW&#58; Low Certainty - * - MEDIUM&#58; Medium Certainty - * - HIGH&#58; High Certainty. - * - * @return the certainty - */ - public String certainty() { - return certainty; - } - - /** - * Gets the nextSteps. - * - * Remediation steps for the issues reported in this finding. They override the note's next steps. - * - * @return the nextSteps - */ - public List nextSteps() { - return nextSteps; - } - - /** - * Gets the networkConnection. - * - * It provides details about a network connection. - * - * @return the networkConnection - */ - public NetworkConnection networkConnection() { - return networkConnection; - } - - /** - * Gets the dataTransferred. - * - * It provides details about data transferred between clients and servers. - * - * @return the dataTransferred - */ - public DataTransferred dataTransferred() { - return dataTransferred; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/FindingType.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/FindingType.java deleted file mode 100644 index 6686251f..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/FindingType.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * FindingType provides details about a finding note. - */ -public class FindingType extends GenericModel { - - /** - * Note provider-assigned severity/impact ranking - * - LOW&#58; Low Impact - * - MEDIUM&#58; Medium Impact - * - HIGH&#58; High Impact - * - CRITICAL&#58; Critical Impact. - */ - public interface Severity { - /** LOW. */ - String LOW = "LOW"; - /** MEDIUM. */ - String MEDIUM = "MEDIUM"; - /** HIGH. */ - String HIGH = "HIGH"; - /** CRITICAL. */ - String CRITICAL = "CRITICAL"; - } - - protected String severity; - @SerializedName("next_steps") - protected List nextSteps; - - /** - * Builder. - */ - public static class Builder { - private String severity; - private List nextSteps; - - private Builder(FindingType findingType) { - this.severity = findingType.severity; - this.nextSteps = findingType.nextSteps; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param severity the severity - */ - public Builder(String severity) { - this.severity = severity; - } - - /** - * Builds a FindingType. - * - * @return the new FindingType instance - */ - public FindingType build() { - return new FindingType(this); - } - - /** - * Adds an nextSteps to nextSteps. - * - * @param nextSteps the new nextSteps - * @return the FindingType builder - */ - public Builder addNextSteps(RemediationStep nextSteps) { - com.ibm.cloud.sdk.core.util.Validator.notNull(nextSteps, - "nextSteps cannot be null"); - if (this.nextSteps == null) { - this.nextSteps = new ArrayList(); - } - this.nextSteps.add(nextSteps); - return this; - } - - /** - * Set the severity. - * - * @param severity the severity - * @return the FindingType builder - */ - public Builder severity(String severity) { - this.severity = severity; - return this; - } - - /** - * Set the nextSteps. - * Existing nextSteps will be replaced. - * - * @param nextSteps the nextSteps - * @return the FindingType builder - */ - public Builder nextSteps(List nextSteps) { - this.nextSteps = nextSteps; - return this; - } - } - - protected FindingType(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.severity, - "severity cannot be null"); - severity = builder.severity; - nextSteps = builder.nextSteps; - } - - /** - * New builder. - * - * @return a FindingType builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the severity. - * - * Note provider-assigned severity/impact ranking - * - LOW&#58; Low Impact - * - MEDIUM&#58; Medium Impact - * - HIGH&#58; High Impact - * - CRITICAL&#58; Critical Impact. - * - * @return the severity - */ - public String severity() { - return severity; - } - - /** - * Gets the nextSteps. - * - * Common remediation steps for the finding of this type. - * - * @return the nextSteps - */ - public List nextSteps() { - return nextSteps; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java deleted file mode 100644 index e00408a3..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getNote options. - */ -public class GetNoteOptions extends GenericModel { - - protected String providerId; - protected String noteId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteId; - private String transactionId; - - private Builder(GetNoteOptions getNoteOptions) { - this.providerId = getNoteOptions.providerId; - this.noteId = getNoteOptions.noteId; - this.transactionId = getNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteId the noteId - */ - public Builder(String providerId, String noteId) { - this.providerId = providerId; - this.noteId = noteId; - } - - /** - * Builds a GetNoteOptions. - * - * @return the new GetNoteOptions instance - */ - public GetNoteOptions build() { - return new GetNoteOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the GetNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteId. - * - * @param noteId the noteId - * @return the GetNoteOptions builder - */ - public Builder noteId(String noteId) { - this.noteId = noteId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the GetNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected GetNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.noteId, - "noteId cannot be empty"); - providerId = builder.providerId; - noteId = builder.noteId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a GetNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteId. - * - * Second part of note `name`: providers/{provider_id}/notes/{note_id}. - * - * @return the noteId - */ - public String noteId() { - return noteId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java deleted file mode 100644 index 549c87fd..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getOccurrenceNote options. - */ -public class GetOccurrenceNoteOptions extends GenericModel { - - protected String providerId; - protected String occurrenceId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String occurrenceId; - private String transactionId; - - private Builder(GetOccurrenceNoteOptions getOccurrenceNoteOptions) { - this.providerId = getOccurrenceNoteOptions.providerId; - this.occurrenceId = getOccurrenceNoteOptions.occurrenceId; - this.transactionId = getOccurrenceNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param occurrenceId the occurrenceId - */ - public Builder(String providerId, String occurrenceId) { - this.providerId = providerId; - this.occurrenceId = occurrenceId; - } - - /** - * Builds a GetOccurrenceNoteOptions. - * - * @return the new GetOccurrenceNoteOptions instance - */ - public GetOccurrenceNoteOptions build() { - return new GetOccurrenceNoteOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the GetOccurrenceNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the occurrenceId. - * - * @param occurrenceId the occurrenceId - * @return the GetOccurrenceNoteOptions builder - */ - public Builder occurrenceId(String occurrenceId) { - this.occurrenceId = occurrenceId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the GetOccurrenceNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected GetOccurrenceNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.occurrenceId, - "occurrenceId cannot be empty"); - providerId = builder.providerId; - occurrenceId = builder.occurrenceId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a GetOccurrenceNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the occurrenceId. - * - * Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. - * - * @return the occurrenceId - */ - public String occurrenceId() { - return occurrenceId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java deleted file mode 100644 index 37c395b2..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getOccurrence options. - */ -public class GetOccurrenceOptions extends GenericModel { - - protected String providerId; - protected String occurrenceId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String occurrenceId; - private String transactionId; - - private Builder(GetOccurrenceOptions getOccurrenceOptions) { - this.providerId = getOccurrenceOptions.providerId; - this.occurrenceId = getOccurrenceOptions.occurrenceId; - this.transactionId = getOccurrenceOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param occurrenceId the occurrenceId - */ - public Builder(String providerId, String occurrenceId) { - this.providerId = providerId; - this.occurrenceId = occurrenceId; - } - - /** - * Builds a GetOccurrenceOptions. - * - * @return the new GetOccurrenceOptions instance - */ - public GetOccurrenceOptions build() { - return new GetOccurrenceOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the GetOccurrenceOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the occurrenceId. - * - * @param occurrenceId the occurrenceId - * @return the GetOccurrenceOptions builder - */ - public Builder occurrenceId(String occurrenceId) { - this.occurrenceId = occurrenceId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the GetOccurrenceOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected GetOccurrenceOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.occurrenceId, - "occurrenceId cannot be empty"); - providerId = builder.providerId; - occurrenceId = builder.occurrenceId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a GetOccurrenceOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the occurrenceId. - * - * Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. - * - * @return the occurrenceId - */ - public String occurrenceId() { - return occurrenceId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Kpi.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Kpi.java deleted file mode 100644 index f06b2e33..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Kpi.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Kpi provides details about a KPI occurrence. - */ -public class Kpi extends GenericModel { - - protected Double value; - protected Double total; - - /** - * Builder. - */ - public static class Builder { - private Double value; - private Double total; - - private Builder(Kpi kpi) { - this.value = kpi.value; - this.total = kpi.total; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param value the value - */ - public Builder(Double value) { - this.value = value; - } - - /** - * Builds a Kpi. - * - * @return the new Kpi instance - */ - public Kpi build() { - return new Kpi(this); - } - - /** - * Set the value. - * - * @param value the value - * @return the Kpi builder - */ - public Builder value(Double value) { - this.value = value; - return this; - } - - /** - * Set the total. - * - * @param total the total - * @return the Kpi builder - */ - public Builder total(Double total) { - this.total = total; - return this; - } - } - - protected Kpi(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - value = builder.value; - total = builder.total; - } - - /** - * New builder. - * - * @return a Kpi builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the value. - * - * The value of this KPI. - * - * @return the value - */ - public Double value() { - return value; - } - - /** - * Gets the total. - * - * The total value of this KPI. - * - * @return the total - */ - public Double total() { - return total; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/KpiType.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/KpiType.java deleted file mode 100644 index 8432dc6f..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/KpiType.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * KpiType provides details about a KPI note. - */ -public class KpiType extends GenericModel { - - public interface Severity { - /** LOW. */ - String LOW = "LOW"; - /** MEDIUM. */ - String MEDIUM = "MEDIUM"; - /** HIGH. */ - String HIGH = "HIGH"; - /** CRITICAL. */ - String CRITICAL = "CRITICAL"; - } - - /** - * The aggregation type of the KPI values. - SUM&#58; A single-value metrics aggregation type that sums up numeric - * values - * that are extracted from KPI occurrences. - */ - public interface AggregationType { - /** SUM. */ - String SUM = "SUM"; - } - - @SerializedName("Severity") - protected String severity; - @SerializedName("aggregation_type") - protected String aggregationType; - - /** - * Builder. - */ - public static class Builder { - private String severity; - private String aggregationType; - - private Builder(KpiType kpiType) { - this.severity = kpiType.severity; - this.aggregationType = kpiType.aggregationType; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param aggregationType the aggregationType - */ - public Builder(String aggregationType) { - this.aggregationType = aggregationType; - } - - /** - * Builds a KpiType. - * - * @return the new KpiType instance - */ - public KpiType build() { - return new KpiType(this); - } - - /** - * Set the severity. - * - * @param severity the severity - * @return the KpiType builder - */ - public Builder severity(String severity) { - this.severity = severity; - return this; - } - - /** - * Set the aggregationType. - * - * @param aggregationType the aggregationType - * @return the KpiType builder - */ - public Builder aggregationType(String aggregationType) { - this.aggregationType = aggregationType; - return this; - } - } - - protected KpiType(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.aggregationType, - "aggregationType cannot be null"); - severity = builder.severity; - aggregationType = builder.aggregationType; - } - - /** - * New builder. - * - * @return a KpiType builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the severity. - * - * @return the severity - */ - public String severity() { - return severity; - } - - /** - * Gets the aggregationType. - * - * The aggregation type of the KPI values. - SUM&#58; A single-value metrics aggregation type that sums up numeric - * values - * that are extracted from KPI occurrences. - * - * @return the aggregationType - */ - public String aggregationType() { - return aggregationType; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java deleted file mode 100644 index e05463ad..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listNoteOccurrences options. - */ -public class ListNoteOccurrencesOptions extends GenericModel { - - protected String providerId; - protected String noteId; - protected String transactionId; - protected Long pageSize; - protected String pageToken; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteId; - private String transactionId; - private Long pageSize; - private String pageToken; - - private Builder(ListNoteOccurrencesOptions listNoteOccurrencesOptions) { - this.providerId = listNoteOccurrencesOptions.providerId; - this.noteId = listNoteOccurrencesOptions.noteId; - this.transactionId = listNoteOccurrencesOptions.transactionId; - this.pageSize = listNoteOccurrencesOptions.pageSize; - this.pageToken = listNoteOccurrencesOptions.pageToken; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteId the noteId - */ - public Builder(String providerId, String noteId) { - this.providerId = providerId; - this.noteId = noteId; - } - - /** - * Builds a ListNoteOccurrencesOptions. - * - * @return the new ListNoteOccurrencesOptions instance - */ - public ListNoteOccurrencesOptions build() { - return new ListNoteOccurrencesOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the ListNoteOccurrencesOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteId. - * - * @param noteId the noteId - * @return the ListNoteOccurrencesOptions builder - */ - public Builder noteId(String noteId) { - this.noteId = noteId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the ListNoteOccurrencesOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the pageSize. - * - * @param pageSize the pageSize - * @return the ListNoteOccurrencesOptions builder - */ - public Builder pageSize(long pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Set the pageToken. - * - * @param pageToken the pageToken - * @return the ListNoteOccurrencesOptions builder - */ - public Builder pageToken(String pageToken) { - this.pageToken = pageToken; - return this; - } - } - - protected ListNoteOccurrencesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.noteId, - "noteId cannot be empty"); - providerId = builder.providerId; - noteId = builder.noteId; - transactionId = builder.transactionId; - pageSize = builder.pageSize; - pageToken = builder.pageToken; - } - - /** - * New builder. - * - * @return a ListNoteOccurrencesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteId. - * - * Second part of note `name`: providers/{provider_id}/notes/{note_id}. - * - * @return the noteId - */ - public String noteId() { - return noteId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the pageSize. - * - * Number of notes to return in the list. - * - * @return the pageSize - */ - public Long pageSize() { - return pageSize; - } - - /** - * Gets the pageToken. - * - * Token to provide to skip to a particular spot in the list. - * - * @return the pageToken - */ - public String pageToken() { - return pageToken; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java deleted file mode 100644 index 795125c9..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listNotes options. - */ -public class ListNotesOptions extends GenericModel { - - protected String providerId; - protected String transactionId; - protected Long pageSize; - protected String pageToken; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String transactionId; - private Long pageSize; - private String pageToken; - - private Builder(ListNotesOptions listNotesOptions) { - this.providerId = listNotesOptions.providerId; - this.transactionId = listNotesOptions.transactionId; - this.pageSize = listNotesOptions.pageSize; - this.pageToken = listNotesOptions.pageToken; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - */ - public Builder(String providerId) { - this.providerId = providerId; - } - - /** - * Builds a ListNotesOptions. - * - * @return the new ListNotesOptions instance - */ - public ListNotesOptions build() { - return new ListNotesOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the ListNotesOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the ListNotesOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the pageSize. - * - * @param pageSize the pageSize - * @return the ListNotesOptions builder - */ - public Builder pageSize(long pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Set the pageToken. - * - * @param pageToken the pageToken - * @return the ListNotesOptions builder - */ - public Builder pageToken(String pageToken) { - this.pageToken = pageToken; - return this; - } - } - - protected ListNotesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - providerId = builder.providerId; - transactionId = builder.transactionId; - pageSize = builder.pageSize; - pageToken = builder.pageToken; - } - - /** - * New builder. - * - * @return a ListNotesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the pageSize. - * - * Number of notes to return in the list. - * - * @return the pageSize - */ - public Long pageSize() { - return pageSize; - } - - /** - * Gets the pageToken. - * - * Token to provide to skip to a particular spot in the list. - * - * @return the pageToken - */ - public String pageToken() { - return pageToken; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java deleted file mode 100644 index 1fe4fe7e..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listOccurrences options. - */ -public class ListOccurrencesOptions extends GenericModel { - - protected String providerId; - protected String transactionId; - protected Long pageSize; - protected String pageToken; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String transactionId; - private Long pageSize; - private String pageToken; - - private Builder(ListOccurrencesOptions listOccurrencesOptions) { - this.providerId = listOccurrencesOptions.providerId; - this.transactionId = listOccurrencesOptions.transactionId; - this.pageSize = listOccurrencesOptions.pageSize; - this.pageToken = listOccurrencesOptions.pageToken; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - */ - public Builder(String providerId) { - this.providerId = providerId; - } - - /** - * Builds a ListOccurrencesOptions. - * - * @return the new ListOccurrencesOptions instance - */ - public ListOccurrencesOptions build() { - return new ListOccurrencesOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the ListOccurrencesOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the ListOccurrencesOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the pageSize. - * - * @param pageSize the pageSize - * @return the ListOccurrencesOptions builder - */ - public Builder pageSize(long pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Set the pageToken. - * - * @param pageToken the pageToken - * @return the ListOccurrencesOptions builder - */ - public Builder pageToken(String pageToken) { - this.pageToken = pageToken; - return this; - } - } - - protected ListOccurrencesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - providerId = builder.providerId; - transactionId = builder.transactionId; - pageSize = builder.pageSize; - pageToken = builder.pageToken; - } - - /** - * New builder. - * - * @return a ListOccurrencesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the pageSize. - * - * Number of notes to return in the list. - * - * @return the pageSize - */ - public Long pageSize() { - return pageSize; - } - - /** - * Gets the pageToken. - * - * Token to provide to skip to a particular spot in the list. - * - * @return the pageToken - */ - public String pageToken() { - return pageToken; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java deleted file mode 100644 index 5403bde8..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listProviders options. - */ -public class ListProvidersOptions extends GenericModel { - - protected String transactionId; - protected Long limit; - protected Long skip; - protected String startProviderId; - protected String endProviderId; - - /** - * Builder. - */ - public static class Builder { - private String transactionId; - private Long limit; - private Long skip; - private String startProviderId; - private String endProviderId; - - private Builder(ListProvidersOptions listProvidersOptions) { - this.transactionId = listProvidersOptions.transactionId; - this.limit = listProvidersOptions.limit; - this.skip = listProvidersOptions.skip; - this.startProviderId = listProvidersOptions.startProviderId; - this.endProviderId = listProvidersOptions.endProviderId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ListProvidersOptions. - * - * @return the new ListProvidersOptions instance - */ - public ListProvidersOptions build() { - return new ListProvidersOptions(this); - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the ListProvidersOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListProvidersOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the skip. - * - * @param skip the skip - * @return the ListProvidersOptions builder - */ - public Builder skip(long skip) { - this.skip = skip; - return this; - } - - /** - * Set the startProviderId. - * - * @param startProviderId the startProviderId - * @return the ListProvidersOptions builder - */ - public Builder startProviderId(String startProviderId) { - this.startProviderId = startProviderId; - return this; - } - - /** - * Set the endProviderId. - * - * @param endProviderId the endProviderId - * @return the ListProvidersOptions builder - */ - public Builder endProviderId(String endProviderId) { - this.endProviderId = endProviderId; - return this; - } - } - - protected ListProvidersOptions(Builder builder) { - transactionId = builder.transactionId; - limit = builder.limit; - skip = builder.skip; - startProviderId = builder.startProviderId; - endProviderId = builder.endProviderId; - } - - /** - * New builder. - * - * @return a ListProvidersOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the limit. - * - * The number of documents that you want to return. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the skip. - * - * The offset is the index of the item from which you want to start returning data from. Default is 0. - * - * @return the skip - */ - public Long skip() { - return skip; - } - - /** - * Gets the startProviderId. - * - * The first provider ID included in the result, sorted in ascending order. If not provided, this parameter is - * ignored. - * - * @return the startProviderId - */ - public String startProviderId() { - return startProviderId; - } - - /** - * Gets the endProviderId. - * - * The last provider ID included in the result, sorted in ascending order. If not provided, this parameter is ignored. - * - * @return the endProviderId - */ - public String endProviderId() { - return endProviderId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/NetworkConnection.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/NetworkConnection.java deleted file mode 100644 index 22664a00..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/NetworkConnection.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * It provides details about a network connection. - */ -public class NetworkConnection extends GenericModel { - - protected String direction; - protected String protocol; - protected SocketAddress client; - protected SocketAddress server; - - /** - * Builder. - */ - public static class Builder { - private String direction; - private String protocol; - private SocketAddress client; - private SocketAddress server; - - private Builder(NetworkConnection networkConnection) { - this.direction = networkConnection.direction; - this.protocol = networkConnection.protocol; - this.client = networkConnection.client; - this.server = networkConnection.server; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a NetworkConnection. - * - * @return the new NetworkConnection instance - */ - public NetworkConnection build() { - return new NetworkConnection(this); - } - - /** - * Set the direction. - * - * @param direction the direction - * @return the NetworkConnection builder - */ - public Builder direction(String direction) { - this.direction = direction; - return this; - } - - /** - * Set the protocol. - * - * @param protocol the protocol - * @return the NetworkConnection builder - */ - public Builder protocol(String protocol) { - this.protocol = protocol; - return this; - } - - /** - * Set the client. - * - * @param client the client - * @return the NetworkConnection builder - */ - public Builder client(SocketAddress client) { - this.client = client; - return this; - } - - /** - * Set the server. - * - * @param server the server - * @return the NetworkConnection builder - */ - public Builder server(SocketAddress server) { - this.server = server; - return this; - } - } - - protected NetworkConnection(Builder builder) { - direction = builder.direction; - protocol = builder.protocol; - client = builder.client; - server = builder.server; - } - - /** - * New builder. - * - * @return a NetworkConnection builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the direction. - * - * The direction of this network connection. - * - * @return the direction - */ - public String direction() { - return direction; - } - - /** - * Gets the protocol. - * - * The protocol of this network connection. - * - * @return the protocol - */ - public String protocol() { - return protocol; - } - - /** - * Gets the client. - * - * It provides details about a socket address. - * - * @return the client - */ - public SocketAddress client() { - return client; - } - - /** - * Gets the server. - * - * It provides details about a socket address. - * - * @return the server - */ - public SocketAddress server() { - return server; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/NumericCardElementValueType.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/NumericCardElementValueType.java deleted file mode 100644 index 97c4cf4a..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/NumericCardElementValueType.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * NumericCardElementValueType. - */ -public class NumericCardElementValueType extends ValueType { - - /** - * Kind of element - * - KPI&#58; Kind of value derived from a KPI occurrence. - */ - public interface Kind { - /** KPI. */ - String KPI = "KPI"; - } - - - /** - * Builder. - */ - public static class Builder { - private String kind; - private String kpiNoteName; - private String text; - private List findingNoteNames; - - public Builder(ValueType numericCardElementValueType) { - this.kind = numericCardElementValueType.kind; - this.kpiNoteName = numericCardElementValueType.kpiNoteName; - this.text = numericCardElementValueType.text; - this.findingNoteNames = numericCardElementValueType.findingNoteNames; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a NumericCardElementValueType. - * - * @return the new NumericCardElementValueType instance - */ - public NumericCardElementValueType build() { - return new NumericCardElementValueType(this); - } - - /** - * Adds an findingNoteNames to findingNoteNames. - * - * @param findingNoteNames the new findingNoteNames - * @return the NumericCardElementValueType builder - */ - public Builder addFindingNoteNames(String findingNoteNames) { - com.ibm.cloud.sdk.core.util.Validator.notNull(findingNoteNames, - "findingNoteNames cannot be null"); - if (this.findingNoteNames == null) { - this.findingNoteNames = new ArrayList(); - } - this.findingNoteNames.add(findingNoteNames); - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the NumericCardElementValueType builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the kpiNoteName. - * - * @param kpiNoteName the kpiNoteName - * @return the NumericCardElementValueType builder - */ - public Builder kpiNoteName(String kpiNoteName) { - this.kpiNoteName = kpiNoteName; - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the NumericCardElementValueType builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Set the findingNoteNames. - * Existing findingNoteNames will be replaced. - * - * @param findingNoteNames the findingNoteNames - * @return the NumericCardElementValueType builder - */ - public Builder findingNoteNames(List findingNoteNames) { - this.findingNoteNames = findingNoteNames; - return this; - } - } - - protected NumericCardElementValueType(Builder builder) { - kind = builder.kind; - kpiNoteName = builder.kpiNoteName; - text = builder.text; - findingNoteNames = builder.findingNoteNames; - } - - /** - * New builder. - * - * @return a NumericCardElementValueType builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java deleted file mode 100644 index aaf9a9ff..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The postGraph options. - */ -public class PostGraphOptions extends GenericModel { - - protected InputStream body; - protected String contentType; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private InputStream body; - private String contentType; - private String transactionId; - - private Builder(PostGraphOptions postGraphOptions) { - this.body = postGraphOptions.body; - this.contentType = postGraphOptions.contentType; - this.transactionId = postGraphOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a PostGraphOptions. - * - * @return the new PostGraphOptions instance - */ - public PostGraphOptions build() { - return new PostGraphOptions(this); - } - - /** - * Set the body. - * - * @param body the body - * @return the PostGraphOptions builder - */ - public Builder body(InputStream body) { - this.body = body; - return this; - } - - /** - * Set the contentType. - * - * @param contentType the contentType - * @return the PostGraphOptions builder - */ - public Builder contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the PostGraphOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the body. - * - * @param body the body - * @return the PostGraphOptions builder - * - * @throws FileNotFoundException if the file could not be found - */ - public Builder body(File body) throws FileNotFoundException { - this.body = new FileInputStream(body); - return this; - } - } - - protected PostGraphOptions(Builder builder) { - body = builder.body; - contentType = builder.contentType; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a PostGraphOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the body. - * - * Body for query findings. - * - * @return the body - */ - public InputStream body() { - return body; - } - - /** - * Gets the contentType. - * - * The type of the input. - * - * @return the contentType - */ - public String contentType() { - return contentType; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/RemediationStep.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/RemediationStep.java deleted file mode 100644 index c12e47d1..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/RemediationStep.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A remediation step description and associated URL. - */ -public class RemediationStep extends GenericModel { - - protected String title; - protected String url; - - /** - * Builder. - */ - public static class Builder { - private String title; - private String url; - - private Builder(RemediationStep remediationStep) { - this.title = remediationStep.title; - this.url = remediationStep.url; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a RemediationStep. - * - * @return the new RemediationStep instance - */ - public RemediationStep build() { - return new RemediationStep(this); - } - - /** - * Set the title. - * - * @param title the title - * @return the RemediationStep builder - */ - public Builder title(String title) { - this.title = title; - return this; - } - - /** - * Set the url. - * - * @param url the url - * @return the RemediationStep builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - } - - protected RemediationStep(Builder builder) { - title = builder.title; - url = builder.url; - } - - /** - * New builder. - * - * @return a RemediationStep builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the title. - * - * Title of this next step. - * - * @return the title - */ - public String title() { - return title; - } - - /** - * Gets the url. - * - * The URL associated to this next steps. - * - * @return the url - */ - public String url() { - return url; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Reporter.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Reporter.java deleted file mode 100644 index d3d79fac..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Reporter.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The entity reporting a note. - */ -public class Reporter extends GenericModel { - - protected String id; - protected String title; - protected String url; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String title; - private String url; - - private Builder(Reporter reporter) { - this.id = reporter.id; - this.title = reporter.title; - this.url = reporter.url; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param title the title - */ - public Builder(String id, String title) { - this.id = id; - this.title = title; - } - - /** - * Builds a Reporter. - * - * @return the new Reporter instance - */ - public Reporter build() { - return new Reporter(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the Reporter builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the title. - * - * @param title the title - * @return the Reporter builder - */ - public Builder title(String title) { - this.title = title; - return this; - } - - /** - * Set the url. - * - * @param url the url - * @return the Reporter builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - } - - protected Reporter(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.title, - "title cannot be null"); - id = builder.id; - title = builder.title; - url = builder.url; - } - - /** - * New builder. - * - * @return a Reporter builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The id of this reporter. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the title. - * - * The title of this reporter. - * - * @return the title - */ - public String title() { - return title; - } - - /** - * Gets the url. - * - * The url of this reporter. - * - * @return the url - */ - public String url() { - return url; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Section.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Section.java deleted file mode 100644 index ee29c62d..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/Section.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Card provides details about a card kind of note. - */ -public class Section extends GenericModel { - - protected String title; - protected String image; - - /** - * Builder. - */ - public static class Builder { - private String title; - private String image; - - private Builder(Section section) { - this.title = section.title; - this.image = section.image; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param title the title - * @param image the image - */ - public Builder(String title, String image) { - this.title = title; - this.image = image; - } - - /** - * Builds a Section. - * - * @return the new Section instance - */ - public Section build() { - return new Section(this); - } - - /** - * Set the title. - * - * @param title the title - * @return the Section builder - */ - public Builder title(String title) { - this.title = title; - return this; - } - - /** - * Set the image. - * - * @param image the image - * @return the Section builder - */ - public Builder image(String image) { - this.image = image; - return this; - } - } - - protected Section(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.title, - "title cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.image, - "image cannot be null"); - title = builder.title; - image = builder.image; - } - - /** - * New builder. - * - * @return a Section builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the title. - * - * The title of this section. - * - * @return the title - */ - public String title() { - return title; - } - - /** - * Gets the image. - * - * The image of this section. - * - * @return the image - */ - public String image() { - return image; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/SocketAddress.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/SocketAddress.java deleted file mode 100644 index 83df521a..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/SocketAddress.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * It provides details about a socket address. - */ -public class SocketAddress extends GenericModel { - - protected String address; - protected Long port; - - /** - * Builder. - */ - public static class Builder { - private String address; - private Long port; - - private Builder(SocketAddress socketAddress) { - this.address = socketAddress.address; - this.port = socketAddress.port; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param address the address - */ - public Builder(String address) { - this.address = address; - } - - /** - * Builds a SocketAddress. - * - * @return the new SocketAddress instance - */ - public SocketAddress build() { - return new SocketAddress(this); - } - - /** - * Set the address. - * - * @param address the address - * @return the SocketAddress builder - */ - public Builder address(String address) { - this.address = address; - return this; - } - - /** - * Set the port. - * - * @param port the port - * @return the SocketAddress builder - */ - public Builder port(long port) { - this.port = port; - return this; - } - } - - protected SocketAddress(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.address, - "address cannot be null"); - address = builder.address; - port = builder.port; - } - - /** - * New builder. - * - * @return a SocketAddress builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the address. - * - * The IP address of this socket address. - * - * @return the address - */ - public String address() { - return address; - } - - /** - * Gets the port. - * - * The port number of this socket address. - * - * @return the port - */ - public Long port() { - return port; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java deleted file mode 100644 index 68fd78cd..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java +++ /dev/null @@ -1,578 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateNote options. - */ -public class UpdateNoteOptions extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - protected String providerId; - protected String noteId; - protected String shortDescription; - protected String longDescription; - protected String kind; - protected String id; - protected Reporter reportedBy; - protected List relatedUrl; - protected Date createTime; - protected Date updateTime; - protected Boolean shared; - protected FindingType finding; - protected KpiType kpi; - protected Card card; - protected Section section; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteId; - private String shortDescription; - private String longDescription; - private String kind; - private String id; - private Reporter reportedBy; - private List relatedUrl; - private Date createTime; - private Date updateTime; - private Boolean shared; - private FindingType finding; - private KpiType kpi; - private Card card; - private Section section; - private String transactionId; - - private Builder(UpdateNoteOptions updateNoteOptions) { - this.providerId = updateNoteOptions.providerId; - this.noteId = updateNoteOptions.noteId; - this.shortDescription = updateNoteOptions.shortDescription; - this.longDescription = updateNoteOptions.longDescription; - this.kind = updateNoteOptions.kind; - this.id = updateNoteOptions.id; - this.reportedBy = updateNoteOptions.reportedBy; - this.relatedUrl = updateNoteOptions.relatedUrl; - this.createTime = updateNoteOptions.createTime; - this.updateTime = updateNoteOptions.updateTime; - this.shared = updateNoteOptions.shared; - this.finding = updateNoteOptions.finding; - this.kpi = updateNoteOptions.kpi; - this.card = updateNoteOptions.card; - this.section = updateNoteOptions.section; - this.transactionId = updateNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteId the noteId - * @param shortDescription the shortDescription - * @param longDescription the longDescription - * @param kind the kind - * @param id the id - * @param reportedBy the reportedBy - */ - public Builder(String providerId, String noteId, String shortDescription, String longDescription, String kind, String id, Reporter reportedBy) { - this.providerId = providerId; - this.noteId = noteId; - this.shortDescription = shortDescription; - this.longDescription = longDescription; - this.kind = kind; - this.id = id; - this.reportedBy = reportedBy; - } - - /** - * Builds a UpdateNoteOptions. - * - * @return the new UpdateNoteOptions instance - */ - public UpdateNoteOptions build() { - return new UpdateNoteOptions(this); - } - - /** - * Adds an relatedUrl to relatedUrl. - * - * @param relatedUrl the new relatedUrl - * @return the UpdateNoteOptions builder - */ - public Builder addRelatedUrl(ApiNoteRelatedUrl relatedUrl) { - com.ibm.cloud.sdk.core.util.Validator.notNull(relatedUrl, - "relatedUrl cannot be null"); - if (this.relatedUrl == null) { - this.relatedUrl = new ArrayList(); - } - this.relatedUrl.add(relatedUrl); - return this; - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the UpdateNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteId. - * - * @param noteId the noteId - * @return the UpdateNoteOptions builder - */ - public Builder noteId(String noteId) { - this.noteId = noteId; - return this; - } - - /** - * Set the shortDescription. - * - * @param shortDescription the shortDescription - * @return the UpdateNoteOptions builder - */ - public Builder shortDescription(String shortDescription) { - this.shortDescription = shortDescription; - return this; - } - - /** - * Set the longDescription. - * - * @param longDescription the longDescription - * @return the UpdateNoteOptions builder - */ - public Builder longDescription(String longDescription) { - this.longDescription = longDescription; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the UpdateNoteOptions builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the UpdateNoteOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the reportedBy. - * - * @param reportedBy the reportedBy - * @return the UpdateNoteOptions builder - */ - public Builder reportedBy(Reporter reportedBy) { - this.reportedBy = reportedBy; - return this; - } - - /** - * Set the relatedUrl. - * Existing relatedUrl will be replaced. - * - * @param relatedUrl the relatedUrl - * @return the UpdateNoteOptions builder - */ - public Builder relatedUrl(List relatedUrl) { - this.relatedUrl = relatedUrl; - return this; - } - - /** - * Set the createTime. - * - * @param createTime the createTime - * @return the UpdateNoteOptions builder - */ - public Builder createTime(Date createTime) { - this.createTime = createTime; - return this; - } - - /** - * Set the updateTime. - * - * @param updateTime the updateTime - * @return the UpdateNoteOptions builder - */ - public Builder updateTime(Date updateTime) { - this.updateTime = updateTime; - return this; - } - - /** - * Set the shared. - * - * @param shared the shared - * @return the UpdateNoteOptions builder - */ - public Builder shared(Boolean shared) { - this.shared = shared; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the UpdateNoteOptions builder - */ - public Builder finding(FindingType finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the UpdateNoteOptions builder - */ - public Builder kpi(KpiType kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the card. - * - * @param card the card - * @return the UpdateNoteOptions builder - */ - public Builder card(Card card) { - this.card = card; - return this; - } - - /** - * Set the section. - * - * @param section the section - * @return the UpdateNoteOptions builder - */ - public Builder section(Section section) { - this.section = section; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the UpdateNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the apiNote. - * - * @param apiNote the apiNote - * @return the UpdateNoteOptions builder - */ - public Builder apiNote(ApiNote apiNote) { - this.shortDescription = apiNote.shortDescription(); - this.longDescription = apiNote.longDescription(); - this.kind = apiNote.kind(); - this.id = apiNote.id(); - this.reportedBy = apiNote.reportedBy(); - this.relatedUrl = apiNote.relatedUrl(); - this.createTime = apiNote.createTime(); - this.updateTime = apiNote.updateTime(); - this.shared = apiNote.shared(); - this.finding = apiNote.finding(); - this.kpi = apiNote.kpi(); - this.card = apiNote.card(); - this.section = apiNote.section(); - return this; - } - } - - protected UpdateNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.noteId, - "noteId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.shortDescription, - "shortDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.longDescription, - "longDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.reportedBy, - "reportedBy cannot be null"); - providerId = builder.providerId; - noteId = builder.noteId; - shortDescription = builder.shortDescription; - longDescription = builder.longDescription; - kind = builder.kind; - id = builder.id; - reportedBy = builder.reportedBy; - relatedUrl = builder.relatedUrl; - createTime = builder.createTime; - updateTime = builder.updateTime; - shared = builder.shared; - finding = builder.finding; - kpi = builder.kpi; - card = builder.card; - section = builder.section; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a UpdateNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteId. - * - * Second part of note `name`: providers/{provider_id}/notes/{note_id}. - * - * @return the noteId - */ - public String noteId() { - return noteId; - } - - /** - * Gets the shortDescription. - * - * A one sentence description of your note. - * - * @return the shortDescription - */ - public String shortDescription() { - return shortDescription; - } - - /** - * Gets the longDescription. - * - * A more detailed description of your note. - * - * @return the longDescription - */ - public String longDescription() { - return longDescription; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the id. - * - * The ID of the note. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the reportedBy. - * - * The entity reporting a note. - * - * @return the reportedBy - */ - public Reporter reportedBy() { - return reportedBy; - } - - /** - * Gets the relatedUrl. - * - * @return the relatedUrl - */ - public List relatedUrl() { - return relatedUrl; - } - - /** - * Gets the createTime. - * - * Output only. The time this note was created. This field can be used as a filter in list requests. - * - * @return the createTime - */ - public Date createTime() { - return createTime; - } - - /** - * Gets the updateTime. - * - * Output only. The time this note was last updated. This field can be used as a filter in list requests. - * - * @return the updateTime - */ - public Date updateTime() { - return updateTime; - } - - /** - * Gets the shared. - * - * True if this note can be shared by multiple accounts. - * - * @return the shared - */ - public Boolean shared() { - return shared; - } - - /** - * Gets the finding. - * - * FindingType provides details about a finding note. - * - * @return the finding - */ - public FindingType finding() { - return finding; - } - - /** - * Gets the kpi. - * - * KpiType provides details about a KPI note. - * - * @return the kpi - */ - public KpiType kpi() { - return kpi; - } - - /** - * Gets the card. - * - * Card provides details about a card kind of note. - * - * @return the card - */ - public Card card() { - return card; - } - - /** - * Gets the section. - * - * Card provides details about a card kind of note. - * - * @return the section - */ - public Section section() { - return section; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java deleted file mode 100644 index 53c73e3a..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java +++ /dev/null @@ -1,445 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.Map; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateOccurrence options. - */ -public class UpdateOccurrenceOptions extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - protected String providerId; - protected String occurrenceId; - protected String noteName; - protected String kind; - protected String id; - protected String resourceUrl; - protected String remediation; - protected Context context; - protected Finding finding; - protected Kpi kpi; - protected Map referenceData; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String occurrenceId; - private String noteName; - private String kind; - private String id; - private String resourceUrl; - private String remediation; - private Context context; - private Finding finding; - private Kpi kpi; - private Map referenceData; - private String transactionId; - - private Builder(UpdateOccurrenceOptions updateOccurrenceOptions) { - this.providerId = updateOccurrenceOptions.providerId; - this.occurrenceId = updateOccurrenceOptions.occurrenceId; - this.noteName = updateOccurrenceOptions.noteName; - this.kind = updateOccurrenceOptions.kind; - this.id = updateOccurrenceOptions.id; - this.resourceUrl = updateOccurrenceOptions.resourceUrl; - this.remediation = updateOccurrenceOptions.remediation; - this.context = updateOccurrenceOptions.context; - this.finding = updateOccurrenceOptions.finding; - this.kpi = updateOccurrenceOptions.kpi; - this.referenceData = updateOccurrenceOptions.referenceData; - this.transactionId = updateOccurrenceOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param occurrenceId the occurrenceId - * @param noteName the noteName - * @param kind the kind - * @param id the id - */ - public Builder(String providerId, String occurrenceId, String noteName, String kind, String id) { - this.providerId = providerId; - this.occurrenceId = occurrenceId; - this.noteName = noteName; - this.kind = kind; - this.id = id; - } - - /** - * Builds a UpdateOccurrenceOptions. - * - * @return the new UpdateOccurrenceOptions instance - */ - public UpdateOccurrenceOptions build() { - return new UpdateOccurrenceOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the UpdateOccurrenceOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the occurrenceId. - * - * @param occurrenceId the occurrenceId - * @return the UpdateOccurrenceOptions builder - */ - public Builder occurrenceId(String occurrenceId) { - this.occurrenceId = occurrenceId; - return this; - } - - /** - * Set the noteName. - * - * @param noteName the noteName - * @return the UpdateOccurrenceOptions builder - */ - public Builder noteName(String noteName) { - this.noteName = noteName; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the UpdateOccurrenceOptions builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the UpdateOccurrenceOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the resourceUrl. - * - * @param resourceUrl the resourceUrl - * @return the UpdateOccurrenceOptions builder - */ - public Builder resourceUrl(String resourceUrl) { - this.resourceUrl = resourceUrl; - return this; - } - - /** - * Set the remediation. - * - * @param remediation the remediation - * @return the UpdateOccurrenceOptions builder - */ - public Builder remediation(String remediation) { - this.remediation = remediation; - return this; - } - - /** - * Set the context. - * - * @param context the context - * @return the UpdateOccurrenceOptions builder - */ - public Builder context(Context context) { - this.context = context; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the UpdateOccurrenceOptions builder - */ - public Builder finding(Finding finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the UpdateOccurrenceOptions builder - */ - public Builder kpi(Kpi kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the referenceData. - * - * @param referenceData the referenceData - * @return the UpdateOccurrenceOptions builder - */ - public Builder referenceData(Map referenceData) { - this.referenceData = referenceData; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the UpdateOccurrenceOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the apiOccurrence. - * - * @param apiOccurrence the apiOccurrence - * @return the UpdateOccurrenceOptions builder - */ - public Builder apiOccurrence(ApiOccurrence apiOccurrence) { - this.noteName = apiOccurrence.noteName(); - this.kind = apiOccurrence.kind(); - this.id = apiOccurrence.id(); - this.resourceUrl = apiOccurrence.resourceUrl(); - this.remediation = apiOccurrence.remediation(); - this.context = apiOccurrence.context(); - this.finding = apiOccurrence.finding(); - this.kpi = apiOccurrence.kpi(); - this.referenceData = apiOccurrence.referenceData(); - return this; - } - } - - protected UpdateOccurrenceOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.occurrenceId, - "occurrenceId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.noteName, - "noteName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - providerId = builder.providerId; - occurrenceId = builder.occurrenceId; - noteName = builder.noteName; - kind = builder.kind; - id = builder.id; - resourceUrl = builder.resourceUrl; - remediation = builder.remediation; - context = builder.context; - finding = builder.finding; - kpi = builder.kpi; - referenceData = builder.referenceData; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a UpdateOccurrenceOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the occurrenceId. - * - * Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. - * - * @return the occurrenceId - */ - public String occurrenceId() { - return occurrenceId; - } - - /** - * Gets the noteName. - * - * An analysis note associated with this image, in the form "{account_id}/providers/{provider_id}/notes/{note_id}" - * This field can be used as a filter in list requests. - * - * @return the noteName - */ - public String noteName() { - return noteName; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the id. - * - * The id of the occurrence. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the resourceUrl. - * - * The unique URL of the resource, image or the container, for which the `Occurrence` applies. For example, - * https://gcr.io/provider/image@sha256:foo. This field can be used as a filter in list requests. - * - * @return the resourceUrl - */ - public String resourceUrl() { - return resourceUrl; - } - - /** - * Gets the remediation. - * - * A description of actions that can be taken to remedy the `Note`. - * - * @return the remediation - */ - public String remediation() { - return remediation; - } - - /** - * Gets the context. - * - * @return the context - */ - public Context context() { - return context; - } - - /** - * Gets the finding. - * - * Finding provides details about a finding occurrence. - * - * @return the finding - */ - public Finding finding() { - return finding; - } - - /** - * Gets the kpi. - * - * Kpi provides details about a KPI occurrence. - * - * @return the kpi - */ - public Kpi kpi() { - return kpi; - } - - /** - * Gets the referenceData. - * - * Additional data for the finding, like AT event etc. - * - * @return the referenceData - */ - public Map referenceData() { - return referenceData; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueType.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueType.java deleted file mode 100644 index 7e2e2497..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueType.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * the value type of a card element. - * - * Classes which extend this class: - * - ValueTypeKpiValueType - * - ValueTypeFindingCountValueType - */ -public class ValueType extends GenericModel { - @SuppressWarnings("unused") - protected static String discriminatorPropertyName = "kind"; - protected static java.util.Map> discriminatorMapping; - static { - discriminatorMapping = new java.util.HashMap<>(); - discriminatorMapping.put("KPI", ValueTypeKpiValueType.class); - discriminatorMapping.put("FINDING_COUNT", ValueTypeFindingCountValueType.class); - } - - /** - * Kind of element - * - KPI&#58; Kind of value derived from a KPI occurrence. - */ - public interface Kind { - /** KPI. */ - String KPI = "KPI"; - } - - protected String kind; - @SerializedName("kpi_note_name") - protected String kpiNoteName; - protected String text; - @SerializedName("finding_note_names") - protected List findingNoteNames; - - protected ValueType() { - } - - /** - * Gets the kind. - * - * Kind of element - * - KPI&#58; Kind of value derived from a KPI occurrence. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the kpiNoteName. - * - * The name of the kpi note associated to the occurrence with the value for this card element value type. - * - * @return the kpiNoteName - */ - public String kpiNoteName() { - return kpiNoteName; - } - - /** - * Gets the text. - * - * The text of this element type. - * - * @return the text - */ - public String text() { - return text; - } - - /** - * Gets the findingNoteNames. - * - * the names of the finding note associated that act as filters for counting the occurrences. - * - * @return the findingNoteNames - */ - public List findingNoteNames() { - return findingNoteNames; - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeFindingCountValueType.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeFindingCountValueType.java deleted file mode 100644 index 1ba7ddf0..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeFindingCountValueType.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * ValueTypeFindingCountValueType. - */ -public class ValueTypeFindingCountValueType extends ValueType { - - /** - * Kind of element - FINDING_COUNT&#58; Kind of value derived from a count of finding occurrences. - */ - public interface Kind { - /** FINDING_COUNT. */ - String FINDING_COUNT = "FINDING_COUNT"; - } - - - /** - * Builder. - */ - public static class Builder { - private String kind; - private List findingNoteNames; - private String text; - - public Builder(ValueType valueTypeFindingCountValueType) { - this.kind = valueTypeFindingCountValueType.kind; - this.findingNoteNames = valueTypeFindingCountValueType.findingNoteNames; - this.text = valueTypeFindingCountValueType.text; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param kind the kind - * @param findingNoteNames the findingNoteNames - * @param text the text - */ - public Builder(String kind, List findingNoteNames, String text) { - this.kind = kind; - this.findingNoteNames = findingNoteNames; - this.text = text; - } - - /** - * Builds a ValueTypeFindingCountValueType. - * - * @return the new ValueTypeFindingCountValueType instance - */ - public ValueTypeFindingCountValueType build() { - return new ValueTypeFindingCountValueType(this); - } - - /** - * Adds an findingNoteNames to findingNoteNames. - * - * @param findingNoteNames the new findingNoteNames - * @return the ValueTypeFindingCountValueType builder - */ - public Builder addFindingNoteNames(String findingNoteNames) { - com.ibm.cloud.sdk.core.util.Validator.notNull(findingNoteNames, - "findingNoteNames cannot be null"); - if (this.findingNoteNames == null) { - this.findingNoteNames = new ArrayList(); - } - this.findingNoteNames.add(findingNoteNames); - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the ValueTypeFindingCountValueType builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the findingNoteNames. - * Existing findingNoteNames will be replaced. - * - * @param findingNoteNames the findingNoteNames - * @return the ValueTypeFindingCountValueType builder - */ - public Builder findingNoteNames(List findingNoteNames) { - this.findingNoteNames = findingNoteNames; - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the ValueTypeFindingCountValueType builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - } - - protected ValueTypeFindingCountValueType(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.findingNoteNames, - "findingNoteNames cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - kind = builder.kind; - findingNoteNames = builder.findingNoteNames; - text = builder.text; - } - - /** - * New builder. - * - * @return a ValueTypeFindingCountValueType builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeKpiValueType.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeKpiValueType.java deleted file mode 100644 index 3d44f00a..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeKpiValueType.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -/** - * ValueTypeKpiValueType. - */ -public class ValueTypeKpiValueType extends ValueType { - - /** - * Kind of element - * - KPI&#58; Kind of value derived from a KPI occurrence. - */ - public interface Kind { - /** KPI. */ - String KPI = "KPI"; - } - - - /** - * Builder. - */ - public static class Builder { - private String kind; - private String kpiNoteName; - private String text; - - public Builder(ValueType valueTypeKpiValueType) { - this.kind = valueTypeKpiValueType.kind; - this.kpiNoteName = valueTypeKpiValueType.kpiNoteName; - this.text = valueTypeKpiValueType.text; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param kind the kind - * @param kpiNoteName the kpiNoteName - * @param text the text - */ - public Builder(String kind, String kpiNoteName, String text) { - this.kind = kind; - this.kpiNoteName = kpiNoteName; - this.text = text; - } - - /** - * Builds a ValueTypeKpiValueType. - * - * @return the new ValueTypeKpiValueType instance - */ - public ValueTypeKpiValueType build() { - return new ValueTypeKpiValueType(this); - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the ValueTypeKpiValueType builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the kpiNoteName. - * - * @param kpiNoteName the kpiNoteName - * @return the ValueTypeKpiValueType builder - */ - public Builder kpiNoteName(String kpiNoteName) { - this.kpiNoteName = kpiNoteName; - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the ValueTypeKpiValueType builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - } - - protected ValueTypeKpiValueType(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kpiNoteName, - "kpiNoteName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - kind = builder.kind; - kpiNoteName = builder.kpiNoteName; - text = builder.text; - } - - /** - * New builder. - * - * @return a ValueTypeKpiValueType builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/package-info.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/package-info.java deleted file mode 100644 index 050fe648..00000000 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/package-info.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -/** - * Security Insights Findings API v1. - */ -package com.ibm.cloud.scc.findings.v1; diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsIT.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsIT.java deleted file mode 100644 index 89c91a50..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsIT.java +++ /dev/null @@ -1,767 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.cloud.scc.findings.v1; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.fail; - -import java.io.InputStream; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.text.SimpleDateFormat; - -import com.ibm.cloud.scc.findings.v1.model.ApiListNoteOccurrencesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListNotesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListOccurrencesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListProvidersResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiNote; -import com.ibm.cloud.scc.findings.v1.model.ApiNoteRelatedUrl; -import com.ibm.cloud.scc.findings.v1.model.ApiOccurrence; -import com.ibm.cloud.scc.findings.v1.model.ApiProvider; -import com.ibm.cloud.scc.findings.v1.model.Card; -import com.ibm.cloud.scc.findings.v1.model.CardElement; -import com.ibm.cloud.scc.findings.v1.model.CardElementTimeSeriesCardElement; -import com.ibm.cloud.scc.findings.v1.model.Context; -import com.ibm.cloud.scc.findings.v1.model.CreateNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.CreateOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.DataTransferred; -import com.ibm.cloud.scc.findings.v1.model.DeleteNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.DeleteOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.Finding; -import com.ibm.cloud.scc.findings.v1.model.FindingType; -import com.ibm.cloud.scc.findings.v1.model.GetNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.GetOccurrenceNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.GetOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.Kpi; -import com.ibm.cloud.scc.findings.v1.model.KpiType; -import com.ibm.cloud.scc.findings.v1.model.ListNoteOccurrencesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListNotesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListOccurrencesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListProvidersOptions; -import com.ibm.cloud.scc.findings.v1.model.NetworkConnection; -import com.ibm.cloud.scc.findings.v1.model.PostGraphOptions; -import com.ibm.cloud.scc.findings.v1.model.RemediationStep; -import com.ibm.cloud.scc.findings.v1.model.Reporter; -import com.ibm.cloud.scc.findings.v1.model.Section; -import com.ibm.cloud.scc.findings.v1.model.SocketAddress; -import com.ibm.cloud.scc.findings.v1.model.UpdateNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.UpdateOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.ValueType; -import com.ibm.cloud.scc.findings.v1.model.ValueTypeFindingCountValueType; -import com.ibm.cloud.scc.findings.v1.utils.TestUtilities; -import com.ibm.cloud.scc.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 com.ibm.cloud.sdk.core.util.DateUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import static org.testng.Assert.*; -import org.testng.annotations.AfterGroups; - -/** - * Integration test class for the Findings service. - */ -public class FindingsIT extends SdkIntegrationTestBase { - public Findings service = null; - public static Map config = null; - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - /** - * This method provides our config filename to the base class. - */ - - final String accountID = System.getenv("ACCOUNT_ID"); - String providerID = System.getenv("PROVIDER_ID"); - final String testString = "testString"; - String identifier = "jv-" + (System.currentTimeMillis() / 1000); - - public String getConfigFilename() { - return "../../findings_v1.env"; - } - - @BeforeClass - public void constructService() { - - if (providerID == null) { - providerID = "sdk-it"; - } - - // Ask super if we should skip the tests. - if (skipTests()) { - return; - } - - service = Findings.newInstance(accountID); - assertNotNull(service); - assertNotNull(service.getServiceUrl()); - - // Load up our test-specific config properties. - config = CredentialUtils.getServiceProperties(Findings.DEFAULT_SERVICE_NAME); - assertNotNull(config); - assertFalse(config.isEmpty()); - assertEquals(service.getServiceUrl(), config.get("URL")); - - System.out.println("Setup complete."); - } - - @Test - public void testPostGraph() throws Exception { - try { - PostGraphOptions postGraphOptions = new PostGraphOptions.Builder() - .body(TestUtilities.createMockStream("{notes{id}}")).contentType("application/graphql").build(); - - // Invoke operation - Response response = service.postGraph(postGraphOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.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 testCreateNoteFinding() throws Exception { - try { - Reporter reporterModel = new Reporter.Builder().id(testString).title(testString).url(testString).build(); - - ApiNoteRelatedUrl apiNoteRelatedUrlModel = new ApiNoteRelatedUrl.Builder().label(testString).url(testString) - .build(); - - RemediationStep remediationStepModel = new RemediationStep.Builder().title(testString).url(testString).build(); - - FindingType findingTypeModel = new FindingType.Builder().severity("LOW") - .nextSteps(new java.util.ArrayList(java.util.Arrays.asList(remediationStepModel))).build(); - - CreateNoteOptions createNoteOptions = new CreateNoteOptions.Builder().providerId(providerID) - .shortDescription(testString).longDescription(testString).kind("FINDING") - .id(String.format("finding-note-%s", identifier)).reportedBy(reporterModel) - .relatedUrl(new java.util.ArrayList(java.util.Arrays.asList(apiNoteRelatedUrlModel))) - .shared(true).finding(findingTypeModel).build(); - - // Invoke operation - Response response = service.createNote(createNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test(groups = { "kpi" }) - public void testCreateNoteKpi() throws Exception { - try { - Reporter reporterModel = new Reporter.Builder().id(testString).title(testString).url(testString).build(); - - KpiType kpiTypeModel = new KpiType.Builder().aggregationType("SUM").build(); - - CreateNoteOptions createNoteOptions = new CreateNoteOptions.Builder().providerId(providerID) - .shortDescription(testString).longDescription(testString).kind("KPI") - .id(String.format("kpi-note-%s", identifier)).reportedBy(reporterModel) - - .shared(true).kpi(kpiTypeModel).build(); - - // Invoke operation - Response response = service.createNote(createNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testCreateNoteCard() throws Exception { - try { - Reporter reporterModel = new Reporter.Builder().id(testString).title(testString).url(testString).build(); - - ValueTypeFindingCountValueType valueTypeModel = new ValueTypeFindingCountValueType.Builder().kind("FINDING_COUNT") - .findingNoteNames(new java.util.ArrayList(java.util.Arrays.asList(testString))).text(testString) - .build(); - - CardElementTimeSeriesCardElement cardElementModel = new CardElementTimeSeriesCardElement.Builder() - .text(testString).defaultInterval(testString).kind("TIME_SERIES").defaultTimeRange("1d") - .valueTypes(new java.util.ArrayList(java.util.Arrays.asList(valueTypeModel))).build(); - - Card cardModel = new Card.Builder().section(testString).title(testString).subtitle(testString) - .findingNoteNames(new java.util.ArrayList(java.util.Arrays - .asList(String.format("%s/providers/%s/notes/finding-note-%s", accountID, providerID, identifier)))) - .requiresConfiguration(true).badgeText(testString).badgeImage(testString) - .elements(new java.util.ArrayList(java.util.Arrays.asList(cardElementModel))).build(); - - CreateNoteOptions createNoteOptions = new CreateNoteOptions.Builder().providerId(providerID) - .shortDescription(testString).longDescription(testString).kind("CARD") - .id(String.format("card-note-%s", identifier)).reportedBy(reporterModel) - - .shared(true).card(cardModel).build(); - - // Invoke operation - Response response = service.createNote(createNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testCreateNoteSection() throws Exception { - try { - Reporter reporterModel = new Reporter.Builder().id(testString).title(testString).url(testString).build(); - - Section sectionModel = new Section.Builder().title(testString).image(testString).build(); - - CreateNoteOptions createNoteOptions = new CreateNoteOptions.Builder().providerId(providerID) - .shortDescription(testString).longDescription(testString).kind("SECTION") - .id(String.format("section-note-%s", identifier)).reportedBy(reporterModel) - - .shared(true).section(sectionModel).build(); - - // Invoke operation - Response response = service.createNote(createNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testListNotes() throws Exception { - try { - ListNotesOptions listNotesOptions = new ListNotesOptions.Builder().providerId(providerID).build(); - - // Invoke operation - Response response = service.listNotes(listNotesOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiListNotesResponse apiListNotesResponseResult = response.getResult(); - - assertNotNull(apiListNotesResponseResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test(groups = { "kpi" }) - public void testGetNote() throws Exception { - try { - GetNoteOptions getNoteOptions = new GetNoteOptions.Builder().providerId(providerID) - .noteId(String.format("kpi-note-%s", identifier)).build(); - - // Invoke operation - Response response = service.getNote(getNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testUpdateNoteFinding() throws Exception { - try { - Reporter reporterModel = new Reporter.Builder().id(testString).title(testString).url(testString).build(); - - ApiNoteRelatedUrl apiNoteRelatedUrlModel = new ApiNoteRelatedUrl.Builder().label(testString).url(testString) - .build(); - - RemediationStep remediationStepModel = new RemediationStep.Builder().title(testString).url(testString).build(); - - FindingType findingTypeModel = new FindingType.Builder().severity("LOW") - .nextSteps(new java.util.ArrayList(java.util.Arrays.asList(remediationStepModel))).build(); - - UpdateNoteOptions updateNoteOptions = new UpdateNoteOptions.Builder().providerId(providerID) - .noteId(String.format("finding-note-%s", identifier)).shortDescription(testString).longDescription(testString) - .kind("FINDING").id(String.format("finding-note-%s", identifier)).reportedBy(reporterModel) - .relatedUrl(new java.util.ArrayList(java.util.Arrays.asList(apiNoteRelatedUrlModel))) - - .shared(true).finding(findingTypeModel).build(); - - // Invoke operation - Response response = service.updateNote(updateNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test(groups = { "kpi" }) - public void testUpdateNoteKpi() throws Exception { - try { - Reporter reporterModel = new Reporter.Builder().id(testString).title(testString).url(testString).build(); - - KpiType kpiTypeModel = new KpiType.Builder().aggregationType("SUM").build(); - - UpdateNoteOptions updateNoteOptions = new UpdateNoteOptions.Builder().providerId(providerID) - .noteId(String.format("kpi-note-%s", identifier)).shortDescription(testString).longDescription(testString) - .kind("KPI").id(String.format("kpi-note-%s", identifier)).reportedBy(reporterModel) - - .shared(true).kpi(kpiTypeModel).build(); - - // Invoke operation - Response response = service.updateNote(updateNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testUpdateNoteCard() throws Exception { - try { - Reporter reporterModel = new Reporter.Builder().id(testString).title(testString).url(testString).build(); - - ValueTypeFindingCountValueType valueTypeModel = new ValueTypeFindingCountValueType.Builder().kind("FINDING_COUNT") - .findingNoteNames(new java.util.ArrayList(java.util.Arrays.asList(testString))).text(testString) - .build(); - - CardElementTimeSeriesCardElement cardElementModel = new CardElementTimeSeriesCardElement.Builder() - .text(testString).defaultInterval(testString).kind("TIME_SERIES").defaultTimeRange("1d") - .valueTypes(new java.util.ArrayList(java.util.Arrays.asList(valueTypeModel))).build(); - - Card cardModel = new Card.Builder().section(testString).title(testString).subtitle(testString) - .findingNoteNames(new java.util.ArrayList(java.util.Arrays.asList(testString))) - .requiresConfiguration(true).badgeText(testString).badgeImage(testString) - .elements(new java.util.ArrayList(java.util.Arrays.asList(cardElementModel))).build(); - - UpdateNoteOptions updateNoteOptions = new UpdateNoteOptions.Builder().providerId(providerID) - .noteId(String.format("card-note-%s", identifier)).shortDescription(testString).longDescription(testString) - .kind("CARD").id(String.format("card-note-%s", identifier)).reportedBy(reporterModel) - - .shared(true).card(cardModel).build(); - - // Invoke operation - Response response = service.updateNote(updateNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testUpdateNoteSection() throws Exception { - try { - Reporter reporterModel = new Reporter.Builder().id(testString).title(testString).url(testString).build(); - - Section sectionModel = new Section.Builder().title(testString).image(testString).build(); - - UpdateNoteOptions updateNoteOptions = new UpdateNoteOptions.Builder().providerId(providerID) - .noteId(String.format("section-note-%s", identifier)).shortDescription(testString).longDescription(testString) - .kind("SECTION").id(String.format("section-note-%s", identifier)).reportedBy(reporterModel) - - .shared(true).section(sectionModel).build(); - - // Invoke operation - Response response = service.updateNote(updateNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testCreateOccurrenceFinding() throws Exception { - try { - Context contextModel = new Context.Builder().region(testString).resourceCrn(testString).resourceId(testString) - .resourceName(testString).resourceType(testString).serviceCrn(testString).serviceName(testString) - .environmentName(testString).componentName(testString).toolchainId(testString).build(); - - RemediationStep remediationStepModel = new RemediationStep.Builder().title(testString).url(testString).build(); - - SocketAddress socketAddressModel = new SocketAddress.Builder().address(testString).port(Long.valueOf("26")) - .build(); - - NetworkConnection networkConnectionModel = new NetworkConnection.Builder().direction(testString) - .protocol(testString).client(socketAddressModel).server(socketAddressModel).build(); - - DataTransferred dataTransferredModel = new DataTransferred.Builder().clientBytes(Long.valueOf("26")) - .serverBytes(Long.valueOf("26")).clientPackets(Long.valueOf("26")).serverPackets(Long.valueOf("26")).build(); - - Finding findingModel = new Finding.Builder().severity("LOW").certainty("LOW") - .nextSteps(new java.util.ArrayList(java.util.Arrays.asList(remediationStepModel))) - .networkConnection(networkConnectionModel).dataTransferred(dataTransferredModel).build(); - - CreateOccurrenceOptions createOccurrenceOptions = new CreateOccurrenceOptions.Builder().providerId(providerID) - .noteName(String.format("%s/providers/%s/notes/finding-note-%s", accountID, providerID, identifier)) - .kind("FINDING").id(String.format("finding-occurrence-%s", identifier)).resourceUrl(testString) - .remediation(testString).context(contextModel).finding(findingModel).replaceIfExists(true).build(); - - // Invoke operation - Response response = service.createOccurrence(createOccurrenceOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiOccurrence apiOccurrenceResult = response.getResult(); - - assertNotNull(apiOccurrenceResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test(groups = { "kpi" }) - public void testCreateOccurrenceKpi() throws Exception { - try { - Context contextModel = new Context.Builder().region(testString).resourceCrn(testString).resourceId(testString) - .resourceName(testString).resourceType(testString).serviceCrn(testString).serviceName(testString) - .environmentName(testString).componentName(testString).toolchainId(testString).build(); - - Kpi kpiModel = new Kpi.Builder().value(Double.valueOf("72.5")).total(Double.valueOf("72.5")).build(); - - CreateOccurrenceOptions createOccurrenceOptions = new CreateOccurrenceOptions.Builder().providerId(providerID) - .noteName(String.format("%s/providers/%s/notes/kpi-note-%s", accountID, providerID, identifier)).kind("KPI") - .id(String.format("kpi-occurrence-%s", identifier)).resourceUrl(testString).remediation(testString) - .context(contextModel).kpi(kpiModel).replaceIfExists(true).build(); - - // Invoke operation - Response response = service.createOccurrence(createOccurrenceOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiOccurrence apiOccurrenceResult = response.getResult(); - - assertNotNull(apiOccurrenceResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testGetOccurrenceNote() throws Exception { - try { - GetOccurrenceNoteOptions getOccurrenceNoteOptions = new GetOccurrenceNoteOptions.Builder().providerId(providerID) - .occurrenceId(String.format("kpi-occurrence-%s", identifier)).build(); - - // Invoke operation - Response response = service.getOccurrenceNote(getOccurrenceNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiNote apiNoteResult = response.getResult(); - - assertNotNull(apiNoteResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testListOccurrences() throws Exception { - try { - ListOccurrencesOptions listOccurrencesOptions = new ListOccurrencesOptions.Builder().providerId(providerID) - .build(); - - // Invoke operation - Response response = service.listOccurrences(listOccurrencesOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiListOccurrencesResponse apiListOccurrencesResponseResult = response.getResult(); - - assertNotNull(apiListOccurrencesResponseResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testListNoteOccurrences() throws Exception { - try { - ListNoteOccurrencesOptions listNoteOccurrencesOptions = new ListNoteOccurrencesOptions.Builder() - .providerId(providerID).noteId(String.format("kpi-note-%s", identifier)).build(); - - // Invoke operation - Response response = service.listNoteOccurrences(listNoteOccurrencesOptions) - .execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiListNoteOccurrencesResponse apiListNoteOccurrencesResponseResult = response.getResult(); - - assertNotNull(apiListNoteOccurrencesResponseResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testGetOccurrence() throws Exception { - try { - GetOccurrenceOptions getOccurrenceOptions = new GetOccurrenceOptions.Builder().providerId(providerID) - .occurrenceId(String.format("kpi-occurrence-%s", identifier)).build(); - - // Invoke operation - Response response = service.getOccurrence(getOccurrenceOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiOccurrence apiOccurrenceResponseResult = response.getResult(); - - assertNotNull(apiOccurrenceResponseResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testUpdateOccurrenceFinding() throws Exception { - try { - Context contextModel = new Context.Builder().region(testString).resourceCrn(testString).resourceId(testString) - .resourceName(testString).resourceType(testString).serviceCrn(testString).serviceName(testString) - .environmentName(testString).componentName(testString).toolchainId(testString).build(); - - RemediationStep remediationStepModel = new RemediationStep.Builder().title(testString).url(testString).build(); - - SocketAddress socketAddressModel = new SocketAddress.Builder().address(testString).port(Long.valueOf("26")) - .build(); - - NetworkConnection networkConnectionModel = new NetworkConnection.Builder().direction(testString) - .protocol(testString).client(socketAddressModel).server(socketAddressModel).build(); - - DataTransferred dataTransferredModel = new DataTransferred.Builder().clientBytes(Long.valueOf("26")) - .serverBytes(Long.valueOf("26")).clientPackets(Long.valueOf("26")).serverPackets(Long.valueOf("26")).build(); - - Finding findingModel = new Finding.Builder().severity("LOW").certainty("LOW") - .nextSteps(new java.util.ArrayList(java.util.Arrays.asList(remediationStepModel))) - .networkConnection(networkConnectionModel).dataTransferred(dataTransferredModel).build(); - - UpdateOccurrenceOptions updateOccurrenceOptions = new UpdateOccurrenceOptions.Builder().providerId(providerID) - .occurrenceId(String.format("finding-occurrence-%s", identifier)) - .noteName(String.format("%s/providers/%s/notes/finding-note-%s", accountID, providerID, identifier)) - .kind("FINDING").id(String.format("finding-occurrence-%s", identifier)).resourceUrl(testString) - .remediation(testString).context(contextModel).finding(findingModel).build(); - - // Invoke operation - Response response = service.updateOccurrence(updateOccurrenceOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiOccurrence apiOccurrenceResult = response.getResult(); - - assertNotNull(apiOccurrenceResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test(groups = { "kpi" }) - public void testUpdateOccurrenceKpi() throws Exception { - try { - Context contextModel = new Context.Builder().region(testString).resourceCrn(testString).resourceId(testString) - .resourceName(testString).resourceType(testString).serviceCrn(testString).serviceName(testString) - .environmentName(testString).componentName(testString).toolchainId(testString).build(); - - Kpi kpiModel = new Kpi.Builder().value(Double.valueOf("72.5")).total(Double.valueOf("72.5")).build(); - - UpdateOccurrenceOptions updateOccurrenceOptions = new UpdateOccurrenceOptions.Builder().providerId(providerID) - .occurrenceId(String.format("kpi-occurrence-%s", identifier)) - .noteName(String.format("%s/providers/%s/notes/kpi-note-%s", accountID, providerID, identifier)).kind("KPI") - .id(String.format("kpi-occurrence-%s", identifier)).resourceUrl(testString).remediation(testString) - .context(contextModel).kpi(kpiModel).build(); - - // Invoke operation - Response response = service.updateOccurrence(updateOccurrenceOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiOccurrence apiOccurrenceResult = response.getResult(); - - assertNotNull(apiOccurrenceResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @Test - public void testListProviders() throws Exception { - try { - ListProvidersOptions listProvidersOptions = new ListProvidersOptions.Builder().build(); - - // Invoke operation - Response response = service.listProviders(listProvidersOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - ApiListProvidersResponse apiListProvidersResponseResult = response.getResult(); - - assertNotNull(apiListProvidersResponseResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @AfterGroups(groups = { "kpi" }) - public void testDeleteOccurrence() throws Exception { - try { - DeleteOccurrenceOptions deleteOccurrenceOptions = new DeleteOccurrenceOptions.Builder().providerId(providerID) - .occurrenceId(String.format("kpi-occurrence-%s", identifier)).build(); - - // Invoke operation - Response response = service.deleteOccurrence(deleteOccurrenceOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @AfterGroups(groups = { "kpi" }) - public void testDeleteNote() throws Exception { - try { - DeleteNoteOptions deleteNoteOptions = new DeleteNoteOptions.Builder().providerId(providerID) - .noteId(String.format("kpi-note-%s", identifier)).build(); - - // Invoke operation - Response response = service.deleteNote(deleteNoteOptions).execute(); - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s\nError details: %s", e.getStatusCode(), e.getMessage(), - e.getDebuggingInfo())); - } - } - - @AfterClass - public void tearDown() { - service = Findings.newInstance(accountID); - config = CredentialUtils.getServiceProperties(Findings.DEFAULT_SERVICE_NAME); - System.out.println("Setup complete."); - - System.out.println(String.format("cleaning up account: %s with provider: %s", accountID, providerID)); - - ListNotesOptions listNotesOptions = new ListNotesOptions.Builder().providerId(providerID).build(); - Response notes = service.listNotes(listNotesOptions).execute(); - for (ApiNote note : notes.getResult().getNotes()) { - String[] parts = note.id().split("-"); - if (identifier.equals(parts[parts.length - 2] + "-" + parts[parts.length - 1])) { - DeleteNoteOptions deleteNoteOptions = new DeleteNoteOptions.Builder().providerId(providerID).noteId(note.id()) - .build(); - service.deleteNote(deleteNoteOptions).execute(); - } - } - - ListOccurrencesOptions listOccurrencesOptions = new ListOccurrencesOptions.Builder().providerId(providerID).build(); - Response occurrences = service.listOccurrences(listOccurrencesOptions).execute(); - for (ApiOccurrence occurrence : occurrences.getResult().getOccurrences()) { - String[] parts = occurrence.id().split("-"); - if (identifier.equals(parts[parts.length - 2] + "-" + parts[parts.length - 1])) { - DeleteOccurrenceOptions deleteOccurrenceOptions = new DeleteOccurrenceOptions.Builder().providerId(providerID) - .occurrenceId(occurrence.id()).build(); - service.deleteOccurrence(deleteOccurrenceOptions).execute(); - } - } - System.out.println("cleanup was successful"); - - ListProvidersOptions listProvidersOptions = new ListProvidersOptions.Builder().build(); - Response providers = service.listProviders(listProvidersOptions).execute(); - for (ApiProvider provider : providers.getResult().getProviders()) { - if (provider.getId() == providerID) { - System.out.println(String.format( - "seems like account has some resources left even after a successful cleanup, please consider manual cleanup for account: %s and provider: %s", - accountID, providerID)); - } - } - } -} diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsTest.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsTest.java deleted file mode 100644 index e3d69288..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsTest.java +++ /dev/null @@ -1,1314 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1; - -import com.ibm.cloud.scc.findings.v1.Findings; -import com.ibm.cloud.scc.findings.v1.model.ApiListNoteOccurrencesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListNotesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListOccurrencesResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiListProvidersResponse; -import com.ibm.cloud.scc.findings.v1.model.ApiNote; -import com.ibm.cloud.scc.findings.v1.model.ApiNoteRelatedUrl; -import com.ibm.cloud.scc.findings.v1.model.ApiOccurrence; -import com.ibm.cloud.scc.findings.v1.model.ApiProvider; -import com.ibm.cloud.scc.findings.v1.model.Card; -import com.ibm.cloud.scc.findings.v1.model.CardElement; -import com.ibm.cloud.scc.findings.v1.model.CardElementBreakdownCardElement; -import com.ibm.cloud.scc.findings.v1.model.CardElementNumericCardElement; -import com.ibm.cloud.scc.findings.v1.model.CardElementTimeSeriesCardElement; -import com.ibm.cloud.scc.findings.v1.model.Context; -import com.ibm.cloud.scc.findings.v1.model.CreateNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.CreateOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.DataTransferred; -import com.ibm.cloud.scc.findings.v1.model.DeleteNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.DeleteOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.Finding; -import com.ibm.cloud.scc.findings.v1.model.FindingType; -import com.ibm.cloud.scc.findings.v1.model.GetNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.GetOccurrenceNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.GetOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.Kpi; -import com.ibm.cloud.scc.findings.v1.model.KpiType; -import com.ibm.cloud.scc.findings.v1.model.ListNoteOccurrencesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListNotesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListOccurrencesOptions; -import com.ibm.cloud.scc.findings.v1.model.ListProvidersOptions; -import com.ibm.cloud.scc.findings.v1.model.NetworkConnection; -import com.ibm.cloud.scc.findings.v1.model.NumericCardElementValueType; -import com.ibm.cloud.scc.findings.v1.model.PostGraphOptions; -import com.ibm.cloud.scc.findings.v1.model.RemediationStep; -import com.ibm.cloud.scc.findings.v1.model.Reporter; -import com.ibm.cloud.scc.findings.v1.model.Section; -import com.ibm.cloud.scc.findings.v1.model.SocketAddress; -import com.ibm.cloud.scc.findings.v1.model.UpdateNoteOptions; -import com.ibm.cloud.scc.findings.v1.model.UpdateOccurrenceOptions; -import com.ibm.cloud.scc.findings.v1.model.ValueType; -import com.ibm.cloud.scc.findings.v1.model.ValueTypeFindingCountValueType; -import com.ibm.cloud.scc.findings.v1.model.ValueTypeKpiValueType; -import com.ibm.cloud.scc.findings.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 com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.EnvironmentUtils; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -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.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.testng.PowerMockTestCase; -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 Findings service. - */ -@PrepareForTest({ EnvironmentUtils.class }) -@PowerMockIgnore({"javax.net.ssl.*", "org.mockito.*"}) -public class FindingsTest extends PowerMockTestCase { - - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - protected MockWebServer server; - protected Findings findingsService; - - // Creates a mock set of environment variables that are returned by EnvironmentUtils.getenv(). - private Map getTestProcessEnvironment() { - Map env = new HashMap<>(); - env.put("TESTSERVICE_AUTH_TYPE", "noAuth"); - return env; - } - - public void constructClientService() throws Throwable { - PowerMockito.spy(EnvironmentUtils.class); - PowerMockito.when(EnvironmentUtils.getenv()).thenReturn(getTestProcessEnvironment()); - final String serviceName = "testService"; - // set mock values for global params - String accountId = "testString"; - - findingsService = Findings.newInstance(accountId, serviceName); - String url = server.url("/").toString(); - findingsService.setServiceUrl(url); - } - - /** - * Negative Test - construct the service with a null authenticator. - */ - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConstructorWithNullAuthenticator() throws Throwable { - final String serviceName = "testService"; - // set mock values for global params - String accountId = "testString"; - - new Findings(accountId, serviceName, null); - } - - - @Test - public void testGetAccountId() throws Throwable { - constructClientService(); - assertEquals(findingsService.getAccountId(), "testString"); - } - - @Test - public void testPostGraphWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = ""; - String postGraphPath = "/v1/testString/graph"; - - server.enqueue(new MockResponse() - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the PostGraphOptions model - PostGraphOptions postGraphOptionsModel = new PostGraphOptions.Builder() - .body(TestUtilities.createMockStream("This is a mock file.")) - .contentType("application/json") - .transactionId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.postGraph(postGraphOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - // Response does not have a return type. Check that the result is null. - assertNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, postGraphPath); - } - - public void testPostGraphWOptionsWRetries() throws Throwable { - // Enable retries and run testPostGraphWOptions. - findingsService.enableRetries(4, 30); - testPostGraphWOptions(); - - // Disable retries and run testPostGraphWOptions. - findingsService.disableRetries(); - testPostGraphWOptions(); - } - - // Test the postGraph operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testPostGraphNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.postGraph(null).execute(); - } - - @Test - public void testListProvidersWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"providers\": [{\"name\": \"name\", \"id\": \"id\"}], \"limit\": 5, \"skip\": 4, \"total_count\": 10}"; - String listProvidersPath = "/v1/testString/providers"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the ListProvidersOptions model - ListProvidersOptions listProvidersOptionsModel = new ListProvidersOptions.Builder() - .transactionId("testString") - .limit(Long.valueOf("2")) - .skip(Long.valueOf("26")) - .startProviderId("testString") - .endProviderId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.listProviders(listProvidersOptionsModel).execute(); - assertNotNull(response); - ApiListProvidersResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - // Get query params - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("2")); - assertEquals(Long.valueOf(query.get("skip")), Long.valueOf("26")); - assertEquals(query.get("start_provider_id"), "testString"); - assertEquals(query.get("end_provider_id"), "testString"); - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listProvidersPath); - } - - public void testListProvidersWOptionsWRetries() throws Throwable { - // Enable retries and run testListProvidersWOptions. - findingsService.enableRetries(4, 30); - testListProvidersWOptions(); - - // Disable retries and run testListProvidersWOptions. - findingsService.disableRetries(); - testListProvidersWOptions(); - } - - @Test - public void testCreateNoteWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"short_description\": \"shortDescription\", \"long_description\": \"longDescription\", \"kind\": \"FINDING\", \"related_url\": [{\"label\": \"label\", \"url\": \"url\"}], \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"shared\": true, \"reported_by\": {\"id\": \"id\", \"title\": \"title\", \"url\": \"url\"}, \"finding\": {\"severity\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}]}, \"kpi\": {\"Severity\": \"MEDIUM\", \"aggregation_type\": \"SUM\"}, \"card\": {\"section\": \"section\", \"title\": \"title\", \"subtitle\": \"subtitle\", \"order\": 1, \"finding_note_names\": [\"findingNoteNames\"], \"requires_configuration\": false, \"badge_text\": \"badgeText\", \"badge_image\": \"badgeImage\", \"elements\": [{\"text\": \"text\", \"default_interval\": \"d\", \"kind\": \"TIME_SERIES\", \"default_time_range\": \"4d\", \"value_types\": [{\"kind\": \"FINDING_COUNT\", \"finding_note_names\": [\"findingNoteNames\"], \"text\": \"label\"}]}]}, \"section\": {\"title\": \"title\", \"image\": \"image\"}}"; - String createNotePath = "/v1/testString/providers/testString/notes"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the Reporter model - Reporter reporterModel = new Reporter.Builder() - .id("testString") - .title("testString") - .url("testString") - .build(); - - // Construct an instance of the ApiNoteRelatedUrl model - ApiNoteRelatedUrl apiNoteRelatedUrlModel = new ApiNoteRelatedUrl.Builder() - .label("testString") - .url("testString") - .build(); - - // Construct an instance of the RemediationStep model - RemediationStep remediationStepModel = new RemediationStep.Builder() - .title("testString") - .url("testString") - .build(); - - // Construct an instance of the FindingType model - FindingType findingTypeModel = new FindingType.Builder() - .severity("LOW") - .nextSteps(new java.util.ArrayList(java.util.Arrays.asList(remediationStepModel))) - .build(); - - // Construct an instance of the KpiType model - KpiType kpiTypeModel = new KpiType.Builder() - .severity("MEDIUM") - .aggregationType("SUM") - .build(); - - // Construct an instance of the ValueTypeFindingCountValueType model - ValueTypeFindingCountValueType valueTypeModel = new ValueTypeFindingCountValueType.Builder() - .kind("FINDING_COUNT") - .findingNoteNames(new java.util.ArrayList(java.util.Arrays.asList("testString"))) - .text("label") - .build(); - - // Construct an instance of the CardElementTimeSeriesCardElement model - CardElementTimeSeriesCardElement cardElementModel = new CardElementTimeSeriesCardElement.Builder() - .text("testString") - .defaultInterval("d") - .kind("TIME_SERIES") - .defaultTimeRange("4d") - .valueTypes(new java.util.ArrayList(java.util.Arrays.asList(valueTypeModel))) - .build(); - - // Construct an instance of the Card model - Card cardModel = new Card.Builder() - .section("testString") - .title("testString") - .subtitle("testString") - .order(Long.valueOf("1")) - .findingNoteNames(new java.util.ArrayList(java.util.Arrays.asList("testString"))) - .requiresConfiguration(false) - .badgeText("testString") - .badgeImage("testString") - .elements(new java.util.ArrayList(java.util.Arrays.asList(cardElementModel))) - .build(); - - // Construct an instance of the Section model - Section sectionModel = new Section.Builder() - .title("testString") - .image("testString") - .build(); - - // Construct an instance of the CreateNoteOptions model - CreateNoteOptions createNoteOptionsModel = new CreateNoteOptions.Builder() - .providerId("testString") - .shortDescription("testString") - .longDescription("testString") - .kind("FINDING") - .id("testString") - .reportedBy(reporterModel) - .relatedUrl(new java.util.ArrayList(java.util.Arrays.asList(apiNoteRelatedUrlModel))) - .createTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .updateTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .shared(true) - .finding(findingTypeModel) - .kpi(kpiTypeModel) - .card(cardModel) - .section(sectionModel) - .transactionId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.createNote(createNoteOptionsModel).execute(); - assertNotNull(response); - ApiNote responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createNotePath); - } - - public void testCreateNoteWOptionsWRetries() throws Throwable { - // Enable retries and run testCreateNoteWOptions. - findingsService.enableRetries(4, 30); - testCreateNoteWOptions(); - - // Disable retries and run testCreateNoteWOptions. - findingsService.disableRetries(); - testCreateNoteWOptions(); - } - - // Test the createNote operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateNoteNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.createNote(null).execute(); - } - - @Test - public void testListNotesWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"notes\": [{\"short_description\": \"shortDescription\", \"long_description\": \"longDescription\", \"kind\": \"FINDING\", \"related_url\": [{\"label\": \"label\", \"url\": \"url\"}], \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"shared\": true, \"reported_by\": {\"id\": \"id\", \"title\": \"title\", \"url\": \"url\"}, \"finding\": {\"severity\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}]}, \"kpi\": {\"Severity\": \"MEDIUM\", \"aggregation_type\": \"SUM\"}, \"card\": {\"section\": \"section\", \"title\": \"title\", \"subtitle\": \"subtitle\", \"order\": 1, \"finding_note_names\": [\"findingNoteNames\"], \"requires_configuration\": false, \"badge_text\": \"badgeText\", \"badge_image\": \"badgeImage\", \"elements\": [{\"text\": \"text\", \"default_interval\": \"d\", \"kind\": \"TIME_SERIES\", \"default_time_range\": \"4d\", \"value_types\": [{\"kind\": \"FINDING_COUNT\", \"finding_note_names\": [\"findingNoteNames\"], \"text\": \"label\"}]}]}, \"section\": {\"title\": \"title\", \"image\": \"image\"}}], \"next_page_token\": \"nextPageToken\"}"; - String listNotesPath = "/v1/testString/providers/testString/notes"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the ListNotesOptions model - ListNotesOptions listNotesOptionsModel = new ListNotesOptions.Builder() - .providerId("testString") - .transactionId("testString") - .pageSize(Long.valueOf("2")) - .pageToken("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.listNotes(listNotesOptionsModel).execute(); - assertNotNull(response); - ApiListNotesResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - // Get query params - assertEquals(Long.valueOf(query.get("page_size")), Long.valueOf("2")); - assertEquals(query.get("page_token"), "testString"); - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listNotesPath); - } - - public void testListNotesWOptionsWRetries() throws Throwable { - // Enable retries and run testListNotesWOptions. - findingsService.enableRetries(4, 30); - testListNotesWOptions(); - - // Disable retries and run testListNotesWOptions. - findingsService.disableRetries(); - testListNotesWOptions(); - } - - // Test the listNotes operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListNotesNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.listNotes(null).execute(); - } - - @Test - public void testGetNoteWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"short_description\": \"shortDescription\", \"long_description\": \"longDescription\", \"kind\": \"FINDING\", \"related_url\": [{\"label\": \"label\", \"url\": \"url\"}], \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"shared\": true, \"reported_by\": {\"id\": \"id\", \"title\": \"title\", \"url\": \"url\"}, \"finding\": {\"severity\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}]}, \"kpi\": {\"Severity\": \"MEDIUM\", \"aggregation_type\": \"SUM\"}, \"card\": {\"section\": \"section\", \"title\": \"title\", \"subtitle\": \"subtitle\", \"order\": 1, \"finding_note_names\": [\"findingNoteNames\"], \"requires_configuration\": false, \"badge_text\": \"badgeText\", \"badge_image\": \"badgeImage\", \"elements\": [{\"text\": \"text\", \"default_interval\": \"d\", \"kind\": \"TIME_SERIES\", \"default_time_range\": \"4d\", \"value_types\": [{\"kind\": \"FINDING_COUNT\", \"finding_note_names\": [\"findingNoteNames\"], \"text\": \"label\"}]}]}, \"section\": {\"title\": \"title\", \"image\": \"image\"}}"; - String getNotePath = "/v1/testString/providers/testString/notes/testString"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the GetNoteOptions model - GetNoteOptions getNoteOptionsModel = new GetNoteOptions.Builder() - .providerId("testString") - .noteId("testString") - .transactionId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.getNote(getNoteOptionsModel).execute(); - assertNotNull(response); - ApiNote responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getNotePath); - } - - public void testGetNoteWOptionsWRetries() throws Throwable { - // Enable retries and run testGetNoteWOptions. - findingsService.enableRetries(4, 30); - testGetNoteWOptions(); - - // Disable retries and run testGetNoteWOptions. - findingsService.disableRetries(); - testGetNoteWOptions(); - } - - // Test the getNote operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetNoteNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.getNote(null).execute(); - } - - @Test - public void testUpdateNoteWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"short_description\": \"shortDescription\", \"long_description\": \"longDescription\", \"kind\": \"FINDING\", \"related_url\": [{\"label\": \"label\", \"url\": \"url\"}], \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"shared\": true, \"reported_by\": {\"id\": \"id\", \"title\": \"title\", \"url\": \"url\"}, \"finding\": {\"severity\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}]}, \"kpi\": {\"Severity\": \"MEDIUM\", \"aggregation_type\": \"SUM\"}, \"card\": {\"section\": \"section\", \"title\": \"title\", \"subtitle\": \"subtitle\", \"order\": 1, \"finding_note_names\": [\"findingNoteNames\"], \"requires_configuration\": false, \"badge_text\": \"badgeText\", \"badge_image\": \"badgeImage\", \"elements\": [{\"text\": \"text\", \"default_interval\": \"d\", \"kind\": \"TIME_SERIES\", \"default_time_range\": \"4d\", \"value_types\": [{\"kind\": \"FINDING_COUNT\", \"finding_note_names\": [\"findingNoteNames\"], \"text\": \"label\"}]}]}, \"section\": {\"title\": \"title\", \"image\": \"image\"}}"; - String updateNotePath = "/v1/testString/providers/testString/notes/testString"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the Reporter model - Reporter reporterModel = new Reporter.Builder() - .id("testString") - .title("testString") - .url("testString") - .build(); - - // Construct an instance of the ApiNoteRelatedUrl model - ApiNoteRelatedUrl apiNoteRelatedUrlModel = new ApiNoteRelatedUrl.Builder() - .label("testString") - .url("testString") - .build(); - - // Construct an instance of the RemediationStep model - RemediationStep remediationStepModel = new RemediationStep.Builder() - .title("testString") - .url("testString") - .build(); - - // Construct an instance of the FindingType model - FindingType findingTypeModel = new FindingType.Builder() - .severity("LOW") - .nextSteps(new java.util.ArrayList(java.util.Arrays.asList(remediationStepModel))) - .build(); - - // Construct an instance of the KpiType model - KpiType kpiTypeModel = new KpiType.Builder() - .severity("MEDIUM") - .aggregationType("SUM") - .build(); - - // Construct an instance of the ValueTypeFindingCountValueType model - ValueTypeFindingCountValueType valueTypeModel = new ValueTypeFindingCountValueType.Builder() - .kind("FINDING_COUNT") - .findingNoteNames(new java.util.ArrayList(java.util.Arrays.asList("testString"))) - .text("label") - .build(); - - // Construct an instance of the CardElementTimeSeriesCardElement model - CardElementTimeSeriesCardElement cardElementModel = new CardElementTimeSeriesCardElement.Builder() - .text("testString") - .defaultInterval("d") - .kind("TIME_SERIES") - .defaultTimeRange("4d") - .valueTypes(new java.util.ArrayList(java.util.Arrays.asList(valueTypeModel))) - .build(); - - // Construct an instance of the Card model - Card cardModel = new Card.Builder() - .section("testString") - .title("testString") - .subtitle("testString") - .order(Long.valueOf("1")) - .findingNoteNames(new java.util.ArrayList(java.util.Arrays.asList("testString"))) - .requiresConfiguration(false) - .badgeText("testString") - .badgeImage("testString") - .elements(new java.util.ArrayList(java.util.Arrays.asList(cardElementModel))) - .build(); - - // Construct an instance of the Section model - Section sectionModel = new Section.Builder() - .title("testString") - .image("testString") - .build(); - - // Construct an instance of the UpdateNoteOptions model - UpdateNoteOptions updateNoteOptionsModel = new UpdateNoteOptions.Builder() - .providerId("testString") - .noteId("testString") - .shortDescription("testString") - .longDescription("testString") - .kind("FINDING") - .id("testString") - .reportedBy(reporterModel) - .relatedUrl(new java.util.ArrayList(java.util.Arrays.asList(apiNoteRelatedUrlModel))) - .createTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .updateTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .shared(true) - .finding(findingTypeModel) - .kpi(kpiTypeModel) - .card(cardModel) - .section(sectionModel) - .transactionId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.updateNote(updateNoteOptionsModel).execute(); - assertNotNull(response); - ApiNote responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateNotePath); - } - - public void testUpdateNoteWOptionsWRetries() throws Throwable { - // Enable retries and run testUpdateNoteWOptions. - findingsService.enableRetries(4, 30); - testUpdateNoteWOptions(); - - // Disable retries and run testUpdateNoteWOptions. - findingsService.disableRetries(); - testUpdateNoteWOptions(); - } - - // Test the updateNote operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateNoteNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.updateNote(null).execute(); - } - - @Test - public void testDeleteNoteWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = ""; - String deleteNotePath = "/v1/testString/providers/testString/notes/testString"; - - server.enqueue(new MockResponse() - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the DeleteNoteOptions model - DeleteNoteOptions deleteNoteOptionsModel = new DeleteNoteOptions.Builder() - .providerId("testString") - .noteId("testString") - .transactionId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.deleteNote(deleteNoteOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - // Response does not have a return type. Check that the result is null. - assertNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteNotePath); - } - - public void testDeleteNoteWOptionsWRetries() throws Throwable { - // Enable retries and run testDeleteNoteWOptions. - findingsService.enableRetries(4, 30); - testDeleteNoteWOptions(); - - // Disable retries and run testDeleteNoteWOptions. - findingsService.disableRetries(); - testDeleteNoteWOptions(); - } - - // Test the deleteNote operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteNoteNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.deleteNote(null).execute(); - } - - @Test - public void testGetOccurrenceNoteWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"short_description\": \"shortDescription\", \"long_description\": \"longDescription\", \"kind\": \"FINDING\", \"related_url\": [{\"label\": \"label\", \"url\": \"url\"}], \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"shared\": true, \"reported_by\": {\"id\": \"id\", \"title\": \"title\", \"url\": \"url\"}, \"finding\": {\"severity\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}]}, \"kpi\": {\"Severity\": \"MEDIUM\", \"aggregation_type\": \"SUM\"}, \"card\": {\"section\": \"section\", \"title\": \"title\", \"subtitle\": \"subtitle\", \"order\": 1, \"finding_note_names\": [\"findingNoteNames\"], \"requires_configuration\": false, \"badge_text\": \"badgeText\", \"badge_image\": \"badgeImage\", \"elements\": [{\"text\": \"text\", \"default_interval\": \"d\", \"kind\": \"TIME_SERIES\", \"default_time_range\": \"4d\", \"value_types\": [{\"kind\": \"FINDING_COUNT\", \"finding_note_names\": [\"findingNoteNames\"], \"text\": \"label\"}]}]}, \"section\": {\"title\": \"title\", \"image\": \"image\"}}"; - String getOccurrenceNotePath = "/v1/testString/providers/testString/occurrences/testString/note"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the GetOccurrenceNoteOptions model - GetOccurrenceNoteOptions getOccurrenceNoteOptionsModel = new GetOccurrenceNoteOptions.Builder() - .providerId("testString") - .occurrenceId("testString") - .transactionId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.getOccurrenceNote(getOccurrenceNoteOptionsModel).execute(); - assertNotNull(response); - ApiNote responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getOccurrenceNotePath); - } - - public void testGetOccurrenceNoteWOptionsWRetries() throws Throwable { - // Enable retries and run testGetOccurrenceNoteWOptions. - findingsService.enableRetries(4, 30); - testGetOccurrenceNoteWOptions(); - - // Disable retries and run testGetOccurrenceNoteWOptions. - findingsService.disableRetries(); - testGetOccurrenceNoteWOptions(); - } - - // Test the getOccurrenceNote operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetOccurrenceNoteNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.getOccurrenceNote(null).execute(); - } - - @Test - public void testCreateOccurrenceWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"resource_url\": \"resourceUrl\", \"note_name\": \"noteName\", \"kind\": \"FINDING\", \"remediation\": \"remediation\", \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"context\": {\"region\": \"region\", \"resource_crn\": \"resourceCrn\", \"resource_id\": \"resourceId\", \"resource_name\": \"resourceName\", \"resource_type\": \"resourceType\", \"service_crn\": \"serviceCrn\", \"service_name\": \"serviceName\", \"environment_name\": \"environmentName\", \"component_name\": \"componentName\", \"toolchain_id\": \"toolchainId\"}, \"finding\": {\"severity\": \"LOW\", \"certainty\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}], \"network_connection\": {\"direction\": \"direction\", \"protocol\": \"protocol\", \"client\": {\"address\": \"address\", \"port\": 4}, \"server\": {\"address\": \"address\", \"port\": 4}}, \"data_transferred\": {\"client_bytes\": 11, \"server_bytes\": 11, \"client_packets\": 13, \"server_packets\": 13}}, \"kpi\": {\"value\": 5, \"total\": 5}, \"reference_data\": {\"mapKey\": \"anyValue\"}}"; - String createOccurrencePath = "/v1/testString/providers/testString/occurrences"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the Context model - Context contextModel = new Context.Builder() - .region("testString") - .resourceCrn("testString") - .resourceId("testString") - .resourceName("testString") - .resourceType("testString") - .serviceCrn("testString") - .serviceName("testString") - .environmentName("testString") - .componentName("testString") - .toolchainId("testString") - .build(); - - // Construct an instance of the RemediationStep model - RemediationStep remediationStepModel = new RemediationStep.Builder() - .title("testString") - .url("testString") - .build(); - - // Construct an instance of the SocketAddress model - SocketAddress socketAddressModel = new SocketAddress.Builder() - .address("testString") - .port(Long.valueOf("26")) - .build(); - - // Construct an instance of the NetworkConnection model - NetworkConnection networkConnectionModel = new NetworkConnection.Builder() - .direction("testString") - .protocol("testString") - .client(socketAddressModel) - .server(socketAddressModel) - .build(); - - // Construct an instance of the DataTransferred model - DataTransferred dataTransferredModel = new DataTransferred.Builder() - .clientBytes(Long.valueOf("26")) - .serverBytes(Long.valueOf("26")) - .clientPackets(Long.valueOf("26")) - .serverPackets(Long.valueOf("26")) - .build(); - - // Construct an instance of the Finding model - Finding findingModel = new Finding.Builder() - .severity("LOW") - .certainty("LOW") - .nextSteps(new java.util.ArrayList(java.util.Arrays.asList(remediationStepModel))) - .networkConnection(networkConnectionModel) - .dataTransferred(dataTransferredModel) - .build(); - - // Construct an instance of the Kpi model - Kpi kpiModel = new Kpi.Builder() - .value(Double.valueOf("72.5")) - .total(Double.valueOf("72.5")) - .build(); - - // Construct an instance of the CreateOccurrenceOptions model - CreateOccurrenceOptions createOccurrenceOptionsModel = new CreateOccurrenceOptions.Builder() - .providerId("testString") - .noteName("testString") - .kind("FINDING") - .id("testString") - .resourceUrl("testString") - .remediation("testString") - .context(contextModel) - .finding(findingModel) - .kpi(kpiModel) - .referenceData(new java.util.HashMap() { { put("foo", "testString"); } }) - .transactionId("testString") - .replaceIfExists(true) - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.createOccurrence(createOccurrenceOptionsModel).execute(); - assertNotNull(response); - ApiOccurrence responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createOccurrencePath); - } - - public void testCreateOccurrenceWOptionsWRetries() throws Throwable { - // Enable retries and run testCreateOccurrenceWOptions. - findingsService.enableRetries(4, 30); - testCreateOccurrenceWOptions(); - - // Disable retries and run testCreateOccurrenceWOptions. - findingsService.disableRetries(); - testCreateOccurrenceWOptions(); - } - - // Test the createOccurrence operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateOccurrenceNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.createOccurrence(null).execute(); - } - - @Test - public void testListOccurrencesWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"occurrences\": [{\"resource_url\": \"resourceUrl\", \"note_name\": \"noteName\", \"kind\": \"FINDING\", \"remediation\": \"remediation\", \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"context\": {\"region\": \"region\", \"resource_crn\": \"resourceCrn\", \"resource_id\": \"resourceId\", \"resource_name\": \"resourceName\", \"resource_type\": \"resourceType\", \"service_crn\": \"serviceCrn\", \"service_name\": \"serviceName\", \"environment_name\": \"environmentName\", \"component_name\": \"componentName\", \"toolchain_id\": \"toolchainId\"}, \"finding\": {\"severity\": \"LOW\", \"certainty\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}], \"network_connection\": {\"direction\": \"direction\", \"protocol\": \"protocol\", \"client\": {\"address\": \"address\", \"port\": 4}, \"server\": {\"address\": \"address\", \"port\": 4}}, \"data_transferred\": {\"client_bytes\": 11, \"server_bytes\": 11, \"client_packets\": 13, \"server_packets\": 13}}, \"kpi\": {\"value\": 5, \"total\": 5}, \"reference_data\": {\"mapKey\": \"anyValue\"}}], \"next_page_token\": \"nextPageToken\"}"; - String listOccurrencesPath = "/v1/testString/providers/testString/occurrences"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the ListOccurrencesOptions model - ListOccurrencesOptions listOccurrencesOptionsModel = new ListOccurrencesOptions.Builder() - .providerId("testString") - .transactionId("testString") - .pageSize(Long.valueOf("2")) - .pageToken("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.listOccurrences(listOccurrencesOptionsModel).execute(); - assertNotNull(response); - ApiListOccurrencesResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - // Get query params - assertEquals(Long.valueOf(query.get("page_size")), Long.valueOf("2")); - assertEquals(query.get("page_token"), "testString"); - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listOccurrencesPath); - } - - public void testListOccurrencesWOptionsWRetries() throws Throwable { - // Enable retries and run testListOccurrencesWOptions. - findingsService.enableRetries(4, 30); - testListOccurrencesWOptions(); - - // Disable retries and run testListOccurrencesWOptions. - findingsService.disableRetries(); - testListOccurrencesWOptions(); - } - - // Test the listOccurrences operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListOccurrencesNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.listOccurrences(null).execute(); - } - - @Test - public void testListNoteOccurrencesWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"occurrences\": [{\"resource_url\": \"resourceUrl\", \"note_name\": \"noteName\", \"kind\": \"FINDING\", \"remediation\": \"remediation\", \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"context\": {\"region\": \"region\", \"resource_crn\": \"resourceCrn\", \"resource_id\": \"resourceId\", \"resource_name\": \"resourceName\", \"resource_type\": \"resourceType\", \"service_crn\": \"serviceCrn\", \"service_name\": \"serviceName\", \"environment_name\": \"environmentName\", \"component_name\": \"componentName\", \"toolchain_id\": \"toolchainId\"}, \"finding\": {\"severity\": \"LOW\", \"certainty\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}], \"network_connection\": {\"direction\": \"direction\", \"protocol\": \"protocol\", \"client\": {\"address\": \"address\", \"port\": 4}, \"server\": {\"address\": \"address\", \"port\": 4}}, \"data_transferred\": {\"client_bytes\": 11, \"server_bytes\": 11, \"client_packets\": 13, \"server_packets\": 13}}, \"kpi\": {\"value\": 5, \"total\": 5}, \"reference_data\": {\"mapKey\": \"anyValue\"}}], \"next_page_token\": \"nextPageToken\"}"; - String listNoteOccurrencesPath = "/v1/testString/providers/testString/notes/testString/occurrences"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the ListNoteOccurrencesOptions model - ListNoteOccurrencesOptions listNoteOccurrencesOptionsModel = new ListNoteOccurrencesOptions.Builder() - .providerId("testString") - .noteId("testString") - .transactionId("testString") - .pageSize(Long.valueOf("2")) - .pageToken("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.listNoteOccurrences(listNoteOccurrencesOptionsModel).execute(); - assertNotNull(response); - ApiListNoteOccurrencesResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - // Get query params - assertEquals(Long.valueOf(query.get("page_size")), Long.valueOf("2")); - assertEquals(query.get("page_token"), "testString"); - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listNoteOccurrencesPath); - } - - public void testListNoteOccurrencesWOptionsWRetries() throws Throwable { - // Enable retries and run testListNoteOccurrencesWOptions. - findingsService.enableRetries(4, 30); - testListNoteOccurrencesWOptions(); - - // Disable retries and run testListNoteOccurrencesWOptions. - findingsService.disableRetries(); - testListNoteOccurrencesWOptions(); - } - - // Test the listNoteOccurrences operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListNoteOccurrencesNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.listNoteOccurrences(null).execute(); - } - - @Test - public void testGetOccurrenceWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"resource_url\": \"resourceUrl\", \"note_name\": \"noteName\", \"kind\": \"FINDING\", \"remediation\": \"remediation\", \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"context\": {\"region\": \"region\", \"resource_crn\": \"resourceCrn\", \"resource_id\": \"resourceId\", \"resource_name\": \"resourceName\", \"resource_type\": \"resourceType\", \"service_crn\": \"serviceCrn\", \"service_name\": \"serviceName\", \"environment_name\": \"environmentName\", \"component_name\": \"componentName\", \"toolchain_id\": \"toolchainId\"}, \"finding\": {\"severity\": \"LOW\", \"certainty\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}], \"network_connection\": {\"direction\": \"direction\", \"protocol\": \"protocol\", \"client\": {\"address\": \"address\", \"port\": 4}, \"server\": {\"address\": \"address\", \"port\": 4}}, \"data_transferred\": {\"client_bytes\": 11, \"server_bytes\": 11, \"client_packets\": 13, \"server_packets\": 13}}, \"kpi\": {\"value\": 5, \"total\": 5}, \"reference_data\": {\"mapKey\": \"anyValue\"}}"; - String getOccurrencePath = "/v1/testString/providers/testString/occurrences/testString"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the GetOccurrenceOptions model - GetOccurrenceOptions getOccurrenceOptionsModel = new GetOccurrenceOptions.Builder() - .providerId("testString") - .occurrenceId("testString") - .transactionId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.getOccurrence(getOccurrenceOptionsModel).execute(); - assertNotNull(response); - ApiOccurrence responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getOccurrencePath); - } - - public void testGetOccurrenceWOptionsWRetries() throws Throwable { - // Enable retries and run testGetOccurrenceWOptions. - findingsService.enableRetries(4, 30); - testGetOccurrenceWOptions(); - - // Disable retries and run testGetOccurrenceWOptions. - findingsService.disableRetries(); - testGetOccurrenceWOptions(); - } - - // Test the getOccurrence operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetOccurrenceNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.getOccurrence(null).execute(); - } - - @Test - public void testUpdateOccurrenceWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"resource_url\": \"resourceUrl\", \"note_name\": \"noteName\", \"kind\": \"FINDING\", \"remediation\": \"remediation\", \"create_time\": \"2019-01-01T12:00:00.000Z\", \"update_time\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"context\": {\"region\": \"region\", \"resource_crn\": \"resourceCrn\", \"resource_id\": \"resourceId\", \"resource_name\": \"resourceName\", \"resource_type\": \"resourceType\", \"service_crn\": \"serviceCrn\", \"service_name\": \"serviceName\", \"environment_name\": \"environmentName\", \"component_name\": \"componentName\", \"toolchain_id\": \"toolchainId\"}, \"finding\": {\"severity\": \"LOW\", \"certainty\": \"LOW\", \"next_steps\": [{\"title\": \"title\", \"url\": \"url\"}], \"network_connection\": {\"direction\": \"direction\", \"protocol\": \"protocol\", \"client\": {\"address\": \"address\", \"port\": 4}, \"server\": {\"address\": \"address\", \"port\": 4}}, \"data_transferred\": {\"client_bytes\": 11, \"server_bytes\": 11, \"client_packets\": 13, \"server_packets\": 13}}, \"kpi\": {\"value\": 5, \"total\": 5}, \"reference_data\": {\"mapKey\": \"anyValue\"}}"; - String updateOccurrencePath = "/v1/testString/providers/testString/occurrences/testString"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the Context model - Context contextModel = new Context.Builder() - .region("testString") - .resourceCrn("testString") - .resourceId("testString") - .resourceName("testString") - .resourceType("testString") - .serviceCrn("testString") - .serviceName("testString") - .environmentName("testString") - .componentName("testString") - .toolchainId("testString") - .build(); - - // Construct an instance of the RemediationStep model - RemediationStep remediationStepModel = new RemediationStep.Builder() - .title("testString") - .url("testString") - .build(); - - // Construct an instance of the SocketAddress model - SocketAddress socketAddressModel = new SocketAddress.Builder() - .address("testString") - .port(Long.valueOf("26")) - .build(); - - // Construct an instance of the NetworkConnection model - NetworkConnection networkConnectionModel = new NetworkConnection.Builder() - .direction("testString") - .protocol("testString") - .client(socketAddressModel) - .server(socketAddressModel) - .build(); - - // Construct an instance of the DataTransferred model - DataTransferred dataTransferredModel = new DataTransferred.Builder() - .clientBytes(Long.valueOf("26")) - .serverBytes(Long.valueOf("26")) - .clientPackets(Long.valueOf("26")) - .serverPackets(Long.valueOf("26")) - .build(); - - // Construct an instance of the Finding model - Finding findingModel = new Finding.Builder() - .severity("LOW") - .certainty("LOW") - .nextSteps(new java.util.ArrayList(java.util.Arrays.asList(remediationStepModel))) - .networkConnection(networkConnectionModel) - .dataTransferred(dataTransferredModel) - .build(); - - // Construct an instance of the Kpi model - Kpi kpiModel = new Kpi.Builder() - .value(Double.valueOf("72.5")) - .total(Double.valueOf("72.5")) - .build(); - - // Construct an instance of the UpdateOccurrenceOptions model - UpdateOccurrenceOptions updateOccurrenceOptionsModel = new UpdateOccurrenceOptions.Builder() - .providerId("testString") - .occurrenceId("testString") - .noteName("testString") - .kind("FINDING") - .id("testString") - .resourceUrl("testString") - .remediation("testString") - .context(contextModel) - .finding(findingModel) - .kpi(kpiModel) - .referenceData(new java.util.HashMap() { { put("foo", "testString"); } }) - .transactionId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.updateOccurrence(updateOccurrenceOptionsModel).execute(); - assertNotNull(response); - ApiOccurrence responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateOccurrencePath); - } - - public void testUpdateOccurrenceWOptionsWRetries() throws Throwable { - // Enable retries and run testUpdateOccurrenceWOptions. - findingsService.enableRetries(4, 30); - testUpdateOccurrenceWOptions(); - - // Disable retries and run testUpdateOccurrenceWOptions. - findingsService.disableRetries(); - testUpdateOccurrenceWOptions(); - } - - // Test the updateOccurrence operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateOccurrenceNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.updateOccurrence(null).execute(); - } - - @Test - public void testDeleteOccurrenceWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = ""; - String deleteOccurrencePath = "/v1/testString/providers/testString/occurrences/testString"; - - server.enqueue(new MockResponse() - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the DeleteOccurrenceOptions model - DeleteOccurrenceOptions deleteOccurrenceOptionsModel = new DeleteOccurrenceOptions.Builder() - .providerId("testString") - .occurrenceId("testString") - .transactionId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.deleteOccurrence(deleteOccurrenceOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - // Response does not have a return type. Check that the result is null. - assertNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteOccurrencePath); - } - - public void testDeleteOccurrenceWOptionsWRetries() throws Throwable { - // Enable retries and run testDeleteOccurrenceWOptions. - findingsService.enableRetries(4, 30); - testDeleteOccurrenceWOptions(); - - // Disable retries and run testDeleteOccurrenceWOptions. - findingsService.disableRetries(); - testDeleteOccurrenceWOptions(); - } - - // Test the deleteOccurrence operation with null options model parameter - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteOccurrenceNoOptions() throws Throwable { - // construct the service - constructClientService(); - - server.enqueue(new MockResponse()); - - // Invoke operation with null options model (negative test) - findingsService.deleteOccurrence(null).execute(); - } - - /** Initialize the server */ - @BeforeMethod - public void setUpMockServer() { - try { - server = new MockWebServer(); - // register handler - server.start(); - } - catch (IOException err) { - fail("Failed to instantiate mock web server"); - } - } - - @AfterMethod - public void tearDownMockServer() throws IOException { - server.shutdown(); - findingsService = null; - } -} \ No newline at end of file diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListNoteOccurrencesResponse.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListNoteOccurrencesResponse.java deleted file mode 100644 index fbf4881d..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListNoteOccurrencesResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Response including listed occurrences for a note. - */ -public class ApiListNoteOccurrencesResponse extends GenericModel { - - protected List occurrences; - @SerializedName("next_page_token") - protected String nextPageToken; - - /** - * Gets the occurrences. - * - * The occurrences attached to the specified note. - * - * @return the occurrences - */ - public List getOccurrences() { - return occurrences; - } - - /** - * Gets the nextPageToken. - * - * Token to receive the next page of notes. - * - * @return the nextPageToken - */ - public String getNextPageToken() { - return nextPageToken; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListNotesResponse.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListNotesResponse.java deleted file mode 100644 index 50935aee..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListNotesResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Response including listed notes. - */ -public class ApiListNotesResponse extends GenericModel { - - protected List notes; - @SerializedName("next_page_token") - protected String nextPageToken; - - /** - * Gets the notes. - * - * The occurrences requested. - * - * @return the notes - */ - public List getNotes() { - return notes; - } - - /** - * Gets the nextPageToken. - * - * The next pagination token in the list response. It should be used as page_token for the following request. An empty - * value means no more result. - * - * @return the nextPageToken - */ - public String getNextPageToken() { - return nextPageToken; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListOccurrencesResponse.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListOccurrencesResponse.java deleted file mode 100644 index b01defc3..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListOccurrencesResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Response including listed active occurrences. - */ -public class ApiListOccurrencesResponse extends GenericModel { - - protected List occurrences; - @SerializedName("next_page_token") - protected String nextPageToken; - - /** - * Gets the occurrences. - * - * The occurrences requested. - * - * @return the occurrences - */ - public List getOccurrences() { - return occurrences; - } - - /** - * Gets the nextPageToken. - * - * The next pagination token in the list response. It should be used as - * `page_token` for the following request. An empty value means no more results. - * - * @return the nextPageToken - */ - public String getNextPageToken() { - return nextPageToken; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java deleted file mode 100644 index 9d06f845..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A list of providers is returned. - */ -public class ApiListProvidersResponse extends GenericModel { - - protected List providers; - protected Long limit; - protected Long skip; - @SerializedName("total_count") - protected Long totalCount; - - /** - * Gets the providers. - * - * The providers requested. - * - * @return the providers - */ - public List getProviders() { - return providers; - } - - /** - * Gets the limit. - * - * The number of elements returned in the current instance. The default is 200. - * - * @return the limit - */ - public Long getLimit() { - return limit; - } - - /** - * Gets the skip. - * - * The offset is the index of the item from which you want to start returning data from. The default is 0. - * - * @return the skip - */ - public Long getSkip() { - return skip; - } - - /** - * Gets the totalCount. - * - * The total number of providers available. - * - * @return the totalCount - */ - public Long getTotalCount() { - return totalCount; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java deleted file mode 100644 index ce282f20..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java +++ /dev/null @@ -1,475 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Provides a detailed description of a note. - */ -public class ApiNote extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - @SerializedName("short_description") - protected String shortDescription; - @SerializedName("long_description") - protected String longDescription; - protected String kind; - @SerializedName("related_url") - protected List relatedUrl; - @SerializedName("expiration_time") - protected Date expirationTime; - @SerializedName("create_time") - protected Date createTime; - @SerializedName("update_time") - protected Date updateTime; - protected String id; - protected Boolean shared; - @SerializedName("reported_by") - protected Reporter reportedBy; - protected FindingType finding; - protected KpiType kpi; - protected Card card; - protected Section section; - - /** - * Builder. - */ - public static class Builder { - private String shortDescription; - private String longDescription; - private String kind; - private List relatedUrl; - private Date expirationTime; - private String id; - private Boolean shared; - private Reporter reportedBy; - private FindingType finding; - private KpiType kpi; - private Card card; - private Section section; - - private Builder(ApiNote apiNote) { - this.shortDescription = apiNote.shortDescription; - this.longDescription = apiNote.longDescription; - this.kind = apiNote.kind; - this.relatedUrl = apiNote.relatedUrl; - this.expirationTime = apiNote.expirationTime; - this.id = apiNote.id; - this.shared = apiNote.shared; - this.reportedBy = apiNote.reportedBy; - this.finding = apiNote.finding; - this.kpi = apiNote.kpi; - this.card = apiNote.card; - this.section = apiNote.section; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param shortDescription the shortDescription - * @param longDescription the longDescription - * @param kind the kind - * @param id the id - * @param reportedBy the reportedBy - */ - public Builder(String shortDescription, String longDescription, String kind, String id, Reporter reportedBy) { - this.shortDescription = shortDescription; - this.longDescription = longDescription; - this.kind = kind; - this.id = id; - this.reportedBy = reportedBy; - } - - /** - * Builds a ApiNote. - * - * @return the new ApiNote instance - */ - public ApiNote build() { - return new ApiNote(this); - } - - /** - * Adds an relatedUrl to relatedUrl. - * - * @param relatedUrl the new relatedUrl - * @return the ApiNote builder - */ - public Builder addRelatedUrl(ApiNoteRelatedUrl relatedUrl) { - com.ibm.cloud.sdk.core.util.Validator.notNull(relatedUrl, - "relatedUrl cannot be null"); - if (this.relatedUrl == null) { - this.relatedUrl = new ArrayList(); - } - this.relatedUrl.add(relatedUrl); - return this; - } - - /** - * Set the shortDescription. - * - * @param shortDescription the shortDescription - * @return the ApiNote builder - */ - public Builder shortDescription(String shortDescription) { - this.shortDescription = shortDescription; - return this; - } - - /** - * Set the longDescription. - * - * @param longDescription the longDescription - * @return the ApiNote builder - */ - public Builder longDescription(String longDescription) { - this.longDescription = longDescription; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the ApiNote builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the relatedUrl. - * Existing relatedUrl will be replaced. - * - * @param relatedUrl the relatedUrl - * @return the ApiNote builder - */ - public Builder relatedUrl(List relatedUrl) { - this.relatedUrl = relatedUrl; - return this; - } - - /** - * Set the expirationTime. - * - * @param expirationTime the expirationTime - * @return the ApiNote builder - */ - public Builder expirationTime(Date expirationTime) { - this.expirationTime = expirationTime; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the ApiNote builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the shared. - * - * @param shared the shared - * @return the ApiNote builder - */ - public Builder shared(Boolean shared) { - this.shared = shared; - return this; - } - - /** - * Set the reportedBy. - * - * @param reportedBy the reportedBy - * @return the ApiNote builder - */ - public Builder reportedBy(Reporter reportedBy) { - this.reportedBy = reportedBy; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the ApiNote builder - */ - public Builder finding(FindingType finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the ApiNote builder - */ - public Builder kpi(KpiType kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the card. - * - * @param card the card - * @return the ApiNote builder - */ - public Builder card(Card card) { - this.card = card; - return this; - } - - /** - * Set the section. - * - * @param section the section - * @return the ApiNote builder - */ - public Builder section(Section section) { - this.section = section; - return this; - } - } - - protected ApiNote(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.shortDescription, - "shortDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.longDescription, - "longDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.reportedBy, - "reportedBy cannot be null"); - shortDescription = builder.shortDescription; - longDescription = builder.longDescription; - kind = builder.kind; - relatedUrl = builder.relatedUrl; - expirationTime = builder.expirationTime; - id = builder.id; - shared = builder.shared; - reportedBy = builder.reportedBy; - finding = builder.finding; - kpi = builder.kpi; - card = builder.card; - section = builder.section; - } - - /** - * New builder. - * - * @return a ApiNote builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the shortDescription. - * - * A one sentence description of your note. - * - * @return the shortDescription - */ - public String shortDescription() { - return shortDescription; - } - - /** - * Gets the longDescription. - * - * A more detailed description of your note. - * - * @return the longDescription - */ - public String longDescription() { - return longDescription; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the relatedUrl. - * - * @return the relatedUrl - */ - public List relatedUrl() { - return relatedUrl; - } - - /** - * Gets the expirationTime. - * - * Time of expiration for this note, null if note does not expire. - * - * @return the expirationTime - */ - public Date expirationTime() { - return expirationTime; - } - - /** - * Gets the createTime. - * - * Output only. The time this note was created. This field can be used as a filter in list requests. - * - * @return the createTime - */ - public Date createTime() { - return createTime; - } - - /** - * Gets the updateTime. - * - * Output only. The time this note was last updated. This field can be used as a filter in list requests. - * - * @return the updateTime - */ - public Date updateTime() { - return updateTime; - } - - /** - * Gets the id. - * - * The ID of the note. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the shared. - * - * True if this note can be shared by multiple accounts. - * - * @return the shared - */ - public Boolean shared() { - return shared; - } - - /** - * Gets the reportedBy. - * - * The entity reporting a note. - * - * @return the reportedBy - */ - public Reporter reportedBy() { - return reportedBy; - } - - /** - * Gets the finding. - * - * FindingType provides details about a finding note. - * - * @return the finding - */ - public FindingType finding() { - return finding; - } - - /** - * Gets the kpi. - * - * KpiType provides details about a KPI note. - * - * @return the kpi - */ - public KpiType kpi() { - return kpi; - } - - /** - * Gets the card. - * - * Card provides details about a card kind of note. - * - * @return the card - */ - public Card card() { - return card; - } - - /** - * Gets the section. - * - * Card provides details about a card kind of note. - * - * @return the section - */ - public Section section() { - return section; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java deleted file mode 100644 index 3a888794..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Metadata for any related URL information. - */ -public class ApiNoteRelatedUrl extends GenericModel { - - protected String label; - protected String url; - - /** - * Builder. - */ - public static class Builder { - private String label; - private String url; - - private Builder(ApiNoteRelatedUrl apiNoteRelatedUrl) { - this.label = apiNoteRelatedUrl.label; - this.url = apiNoteRelatedUrl.url; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param label the label - * @param url the url - */ - public Builder(String label, String url) { - this.label = label; - this.url = url; - } - - /** - * Builds a ApiNoteRelatedUrl. - * - * @return the new ApiNoteRelatedUrl instance - */ - public ApiNoteRelatedUrl build() { - return new ApiNoteRelatedUrl(this); - } - - /** - * Set the label. - * - * @param label the label - * @return the ApiNoteRelatedUrl builder - */ - public Builder label(String label) { - this.label = label; - return this; - } - - /** - * Set the url. - * - * @param url the url - * @return the ApiNoteRelatedUrl builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - } - - protected ApiNoteRelatedUrl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.label, - "label cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.url, - "url cannot be null"); - label = builder.label; - url = builder.url; - } - - /** - * New builder. - * - * @return a ApiNoteRelatedUrl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the label. - * - * Label to describe usage of the URL. - * - * @return the label - */ - public String label() { - return label; - } - - /** - * Gets the url. - * - * The URL that you want to associate with the note. - * - * @return the url - */ - public String url() { - return url; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java deleted file mode 100644 index 5573504e..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java +++ /dev/null @@ -1,371 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.Date; -import java.util.Map; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * `Occurrence` includes information about analysis occurrences for an image. - */ -public class ApiOccurrence extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - @SerializedName("resource_url") - protected String resourceUrl; - @SerializedName("note_name") - protected String noteName; - protected String kind; - protected String remediation; - @SerializedName("create_time") - protected Date createTime; - @SerializedName("update_time") - protected Date updateTime; - protected String id; - protected Context context; - protected Finding finding; - protected Kpi kpi; - @SerializedName("reference_data") - protected Map referenceData; - - /** - * Builder. - */ - public static class Builder { - private String resourceUrl; - private String noteName; - private String kind; - private String remediation; - private String id; - private Context context; - private Finding finding; - private Kpi kpi; - private Map referenceData; - - private Builder(ApiOccurrence apiOccurrence) { - this.resourceUrl = apiOccurrence.resourceUrl; - this.noteName = apiOccurrence.noteName; - this.kind = apiOccurrence.kind; - this.remediation = apiOccurrence.remediation; - this.id = apiOccurrence.id; - this.context = apiOccurrence.context; - this.finding = apiOccurrence.finding; - this.kpi = apiOccurrence.kpi; - this.referenceData = apiOccurrence.referenceData; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param noteName the noteName - * @param kind the kind - * @param id the id - */ - public Builder(String noteName, String kind, String id) { - this.noteName = noteName; - this.kind = kind; - this.id = id; - } - - /** - * Builds a ApiOccurrence. - * - * @return the new ApiOccurrence instance - */ - public ApiOccurrence build() { - return new ApiOccurrence(this); - } - - /** - * Set the resourceUrl. - * - * @param resourceUrl the resourceUrl - * @return the ApiOccurrence builder - */ - public Builder resourceUrl(String resourceUrl) { - this.resourceUrl = resourceUrl; - return this; - } - - /** - * Set the noteName. - * - * @param noteName the noteName - * @return the ApiOccurrence builder - */ - public Builder noteName(String noteName) { - this.noteName = noteName; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the ApiOccurrence builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the remediation. - * - * @param remediation the remediation - * @return the ApiOccurrence builder - */ - public Builder remediation(String remediation) { - this.remediation = remediation; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the ApiOccurrence builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the context. - * - * @param context the context - * @return the ApiOccurrence builder - */ - public Builder context(Context context) { - this.context = context; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the ApiOccurrence builder - */ - public Builder finding(Finding finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the ApiOccurrence builder - */ - public Builder kpi(Kpi kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the referenceData. - * - * @param referenceData the referenceData - * @return the ApiOccurrence builder - */ - public Builder referenceData(Map referenceData) { - this.referenceData = referenceData; - return this; - } - } - - protected ApiOccurrence(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.noteName, - "noteName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - resourceUrl = builder.resourceUrl; - noteName = builder.noteName; - kind = builder.kind; - remediation = builder.remediation; - id = builder.id; - context = builder.context; - finding = builder.finding; - kpi = builder.kpi; - referenceData = builder.referenceData; - } - - /** - * New builder. - * - * @return a ApiOccurrence builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the resourceUrl. - * - * The unique URL of the resource, image or the container, for which the `Occurrence` applies. For example, - * https://gcr.io/provider/image@sha256:foo. This field can be used as a filter in list requests. - * - * @return the resourceUrl - */ - public String resourceUrl() { - return resourceUrl; - } - - /** - * Gets the noteName. - * - * An analysis note associated with this image, in the form "{account_id}/providers/{provider_id}/notes/{note_id}" - * This field can be used as a filter in list requests. - * - * @return the noteName - */ - public String noteName() { - return noteName; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the remediation. - * - * A description of actions that can be taken to remedy the `Note`. - * - * @return the remediation - */ - public String remediation() { - return remediation; - } - - /** - * Gets the createTime. - * - * Output only. The time this `Occurrence` was created. - * - * @return the createTime - */ - public Date createTime() { - return createTime; - } - - /** - * Gets the updateTime. - * - * Output only. The time this `Occurrence` was last updated. - * - * @return the updateTime - */ - public Date updateTime() { - return updateTime; - } - - /** - * Gets the id. - * - * The id of the occurrence. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the context. - * - * @return the context - */ - public Context context() { - return context; - } - - /** - * Gets the finding. - * - * Finding provides details about a finding occurrence. - * - * @return the finding - */ - public Finding finding() { - return finding; - } - - /** - * Gets the kpi. - * - * Kpi provides details about a KPI occurrence. - * - * @return the kpi - */ - public Kpi kpi() { - return kpi; - } - - /** - * Gets the referenceData. - * - * Additional data for the finding, like AT event etc. - * - * @return the referenceData - */ - public Map referenceData() { - return referenceData; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java deleted file mode 100644 index 40f74d79..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Provides a detailed description of a provider. - */ -public class ApiProvider extends GenericModel { - - protected String name; - protected String id; - - /** - * Gets the name. - * - * The name of the provider in the form '{account_id}/providers/{provider_id}'. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the id. - * - * The ID of the provider. - * - * @return the id - */ - public String getId() { - return id; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Card.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Card.java deleted file mode 100644 index 4d62635f..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Card.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Card provides details about a card kind of note. - */ -public class Card extends GenericModel { - - protected String section; - protected String title; - protected String subtitle; - protected Long order; - @SerializedName("finding_note_names") - protected List findingNoteNames; - @SerializedName("requires_configuration") - protected Boolean requiresConfiguration; - @SerializedName("badge_text") - protected String badgeText; - @SerializedName("badge_image") - protected String badgeImage; - protected List elements; - - /** - * Builder. - */ - public static class Builder { - private String section; - private String title; - private String subtitle; - private Long order; - private List findingNoteNames; - private Boolean requiresConfiguration; - private String badgeText; - private String badgeImage; - private List elements; - - private Builder(Card card) { - this.section = card.section; - this.title = card.title; - this.subtitle = card.subtitle; - this.order = card.order; - this.findingNoteNames = card.findingNoteNames; - this.requiresConfiguration = card.requiresConfiguration; - this.badgeText = card.badgeText; - this.badgeImage = card.badgeImage; - this.elements = card.elements; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param section the section - * @param title the title - * @param subtitle the subtitle - * @param findingNoteNames the findingNoteNames - * @param elements the elements - */ - public Builder(String section, String title, String subtitle, List findingNoteNames, List elements) { - this.section = section; - this.title = title; - this.subtitle = subtitle; - this.findingNoteNames = findingNoteNames; - this.elements = elements; - } - - /** - * Builds a Card. - * - * @return the new Card instance - */ - public Card build() { - return new Card(this); - } - - /** - * Adds an findingNoteNames to findingNoteNames. - * - * @param findingNoteNames the new findingNoteNames - * @return the Card builder - */ - public Builder addFindingNoteNames(String findingNoteNames) { - com.ibm.cloud.sdk.core.util.Validator.notNull(findingNoteNames, - "findingNoteNames cannot be null"); - if (this.findingNoteNames == null) { - this.findingNoteNames = new ArrayList(); - } - this.findingNoteNames.add(findingNoteNames); - return this; - } - - /** - * Adds an elements to elements. - * - * @param elements the new elements - * @return the Card builder - */ - public Builder addElements(CardElement elements) { - com.ibm.cloud.sdk.core.util.Validator.notNull(elements, - "elements cannot be null"); - if (this.elements == null) { - this.elements = new ArrayList(); - } - this.elements.add(elements); - return this; - } - - /** - * Set the section. - * - * @param section the section - * @return the Card builder - */ - public Builder section(String section) { - this.section = section; - return this; - } - - /** - * Set the title. - * - * @param title the title - * @return the Card builder - */ - public Builder title(String title) { - this.title = title; - return this; - } - - /** - * Set the subtitle. - * - * @param subtitle the subtitle - * @return the Card builder - */ - public Builder subtitle(String subtitle) { - this.subtitle = subtitle; - return this; - } - - /** - * Set the order. - * - * @param order the order - * @return the Card builder - */ - public Builder order(long order) { - this.order = order; - return this; - } - - /** - * Set the findingNoteNames. - * Existing findingNoteNames will be replaced. - * - * @param findingNoteNames the findingNoteNames - * @return the Card builder - */ - public Builder findingNoteNames(List findingNoteNames) { - this.findingNoteNames = findingNoteNames; - return this; - } - - /** - * Set the requiresConfiguration. - * - * @param requiresConfiguration the requiresConfiguration - * @return the Card builder - */ - public Builder requiresConfiguration(Boolean requiresConfiguration) { - this.requiresConfiguration = requiresConfiguration; - return this; - } - - /** - * Set the badgeText. - * - * @param badgeText the badgeText - * @return the Card builder - */ - public Builder badgeText(String badgeText) { - this.badgeText = badgeText; - return this; - } - - /** - * Set the badgeImage. - * - * @param badgeImage the badgeImage - * @return the Card builder - */ - public Builder badgeImage(String badgeImage) { - this.badgeImage = badgeImage; - return this; - } - - /** - * Set the elements. - * Existing elements will be replaced. - * - * @param elements the elements - * @return the Card builder - */ - public Builder elements(List elements) { - this.elements = elements; - return this; - } - } - - protected Card(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.section, - "section cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.title, - "title cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subtitle, - "subtitle cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.findingNoteNames, - "findingNoteNames cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.elements, - "elements cannot be null"); - section = builder.section; - title = builder.title; - subtitle = builder.subtitle; - order = builder.order; - findingNoteNames = builder.findingNoteNames; - requiresConfiguration = builder.requiresConfiguration; - badgeText = builder.badgeText; - badgeImage = builder.badgeImage; - elements = builder.elements; - } - - /** - * New builder. - * - * @return a Card builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the section. - * - * The section this card belongs to. - * - * @return the section - */ - public String section() { - return section; - } - - /** - * Gets the title. - * - * The title of this card. - * - * @return the title - */ - public String title() { - return title; - } - - /** - * Gets the subtitle. - * - * The subtitle of this card. - * - * @return the subtitle - */ - public String subtitle() { - return subtitle; - } - - /** - * Gets the order. - * - * The order of the card in which it will appear on SA dashboard in the mentioned section. - * - * @return the order - */ - public Long order() { - return order; - } - - /** - * Gets the findingNoteNames. - * - * The finding note names associated to this card. - * - * @return the findingNoteNames - */ - public List findingNoteNames() { - return findingNoteNames; - } - - /** - * Gets the requiresConfiguration. - * - * @return the requiresConfiguration - */ - public Boolean requiresConfiguration() { - return requiresConfiguration; - } - - /** - * Gets the badgeText. - * - * The text associated to the card's badge. - * - * @return the badgeText - */ - public String badgeText() { - return badgeText; - } - - /** - * Gets the badgeImage. - * - * The base64 content of the image associated to the card's badge. - * - * @return the badgeImage - */ - public String badgeImage() { - return badgeImage; - } - - /** - * Gets the elements. - * - * The elements of this card. - * - * @return the elements - */ - public List elements() { - return elements; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElement.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElement.java deleted file mode 100644 index 9050869f..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElement.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * CardElement provides details about the elements of a Card. - * - * Classes which extend this class: - * - CardElementNumericCardElement - * - CardElementBreakdownCardElement - * - CardElementTimeSeriesCardElement - */ -public class CardElement extends GenericModel { - @SuppressWarnings("unused") - protected static String discriminatorPropertyName = "kind"; - protected static java.util.Map> discriminatorMapping; - static { - discriminatorMapping = new java.util.HashMap<>(); - discriminatorMapping.put("NUMERIC", CardElementNumericCardElement.class); - discriminatorMapping.put("BREAKDOWN", CardElementBreakdownCardElement.class); - discriminatorMapping.put("TIME_SERIES", CardElementTimeSeriesCardElement.class); - } - - /** - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - */ - public interface Kind { - /** NUMERIC. */ - String NUMERIC = "NUMERIC"; - /** BREAKDOWN. */ - String BREAKDOWN = "BREAKDOWN"; - /** TIME_SERIES. */ - String TIME_SERIES = "TIME_SERIES"; - } - - protected String text; - protected String kind; - @SerializedName("default_time_range") - protected String defaultTimeRange; - @SerializedName("value_type") - protected NumericCardElementValueType valueType; - @SerializedName("value_types") - protected List valueTypes; - @SerializedName("default_interval") - protected String defaultInterval; - - protected CardElement() { - } - - /** - * Gets the text. - * - * The text of this card element. - * - * @return the text - */ - public String text() { - return text; - } - - /** - * Gets the kind. - * - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the defaultTimeRange. - * - * The default time range of this card element. - * - * @return the defaultTimeRange - */ - public String defaultTimeRange() { - return defaultTimeRange; - } - - /** - * Gets the valueType. - * - * @return the valueType - */ - public NumericCardElementValueType valueType() { - return valueType; - } - - /** - * Gets the valueTypes. - * - * the value types associated to this card element. - * - * @return the valueTypes - */ - public List valueTypes() { - return valueTypes; - } - - /** - * Gets the defaultInterval. - * - * The default interval of the time series. - * - * @return the defaultInterval - */ - public String defaultInterval() { - return defaultInterval; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementBreakdownCardElement.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementBreakdownCardElement.java deleted file mode 100644 index a691588a..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementBreakdownCardElement.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * A card element with a breakdown of values. - */ -public class CardElementBreakdownCardElement extends CardElement { - - /** - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - */ - public interface Kind { - /** NUMERIC. */ - String NUMERIC = "NUMERIC"; - /** BREAKDOWN. */ - String BREAKDOWN = "BREAKDOWN"; - /** TIME_SERIES. */ - String TIME_SERIES = "TIME_SERIES"; - } - - - /** - * Builder. - */ - public static class Builder { - private String text; - private String kind; - private String defaultTimeRange; - private List valueTypes; - - public Builder(CardElement cardElementBreakdownCardElement) { - this.text = cardElementBreakdownCardElement.text; - this.kind = cardElementBreakdownCardElement.kind; - this.defaultTimeRange = cardElementBreakdownCardElement.defaultTimeRange; - this.valueTypes = cardElementBreakdownCardElement.valueTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param text the text - * @param kind the kind - * @param valueTypes the valueTypes - */ - public Builder(String text, String kind, List valueTypes) { - this.text = text; - this.kind = kind; - this.valueTypes = valueTypes; - } - - /** - * Builds a CardElementBreakdownCardElement. - * - * @return the new CardElementBreakdownCardElement instance - */ - public CardElementBreakdownCardElement build() { - return new CardElementBreakdownCardElement(this); - } - - /** - * Adds an valueTypes to valueTypes. - * - * @param valueTypes the new valueTypes - * @return the CardElementBreakdownCardElement builder - */ - public Builder addValueTypes(ValueType valueTypes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(valueTypes, - "valueTypes cannot be null"); - if (this.valueTypes == null) { - this.valueTypes = new ArrayList(); - } - this.valueTypes.add(valueTypes); - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the CardElementBreakdownCardElement builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CardElementBreakdownCardElement builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the defaultTimeRange. - * - * @param defaultTimeRange the defaultTimeRange - * @return the CardElementBreakdownCardElement builder - */ - public Builder defaultTimeRange(String defaultTimeRange) { - this.defaultTimeRange = defaultTimeRange; - return this; - } - - /** - * Set the valueTypes. - * Existing valueTypes will be replaced. - * - * @param valueTypes the valueTypes - * @return the CardElementBreakdownCardElement builder - */ - public Builder valueTypes(List valueTypes) { - this.valueTypes = valueTypes; - return this; - } - } - - protected CardElementBreakdownCardElement(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.valueTypes, - "valueTypes cannot be null"); - text = builder.text; - kind = builder.kind; - defaultTimeRange = builder.defaultTimeRange; - valueTypes = builder.valueTypes; - } - - /** - * New builder. - * - * @return a CardElementBreakdownCardElement builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementNumericCardElement.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementNumericCardElement.java deleted file mode 100644 index f49a9014..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementNumericCardElement.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -/** - * A card element with a single numeric value". - */ -public class CardElementNumericCardElement extends CardElement { - - /** - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - */ - public interface Kind { - /** NUMERIC. */ - String NUMERIC = "NUMERIC"; - /** BREAKDOWN. */ - String BREAKDOWN = "BREAKDOWN"; - /** TIME_SERIES. */ - String TIME_SERIES = "TIME_SERIES"; - } - - - /** - * Builder. - */ - public static class Builder { - private String text; - private String kind; - private String defaultTimeRange; - private NumericCardElementValueType valueType; - - public Builder(CardElement cardElementNumericCardElement) { - this.text = cardElementNumericCardElement.text; - this.kind = cardElementNumericCardElement.kind; - this.defaultTimeRange = cardElementNumericCardElement.defaultTimeRange; - this.valueType = cardElementNumericCardElement.valueType; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param text the text - * @param kind the kind - * @param valueType the valueType - */ - public Builder(String text, String kind, NumericCardElementValueType valueType) { - this.text = text; - this.kind = kind; - this.valueType = valueType; - } - - /** - * Builds a CardElementNumericCardElement. - * - * @return the new CardElementNumericCardElement instance - */ - public CardElementNumericCardElement build() { - return new CardElementNumericCardElement(this); - } - - /** - * Set the text. - * - * @param text the text - * @return the CardElementNumericCardElement builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CardElementNumericCardElement builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the defaultTimeRange. - * - * @param defaultTimeRange the defaultTimeRange - * @return the CardElementNumericCardElement builder - */ - public Builder defaultTimeRange(String defaultTimeRange) { - this.defaultTimeRange = defaultTimeRange; - return this; - } - - /** - * Set the valueType. - * - * @param valueType the valueType - * @return the CardElementNumericCardElement builder - */ - public Builder valueType(NumericCardElementValueType valueType) { - this.valueType = valueType; - return this; - } - } - - protected CardElementNumericCardElement(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.valueType, - "valueType cannot be null"); - text = builder.text; - kind = builder.kind; - defaultTimeRange = builder.defaultTimeRange; - valueType = builder.valueType; - } - - /** - * New builder. - * - * @return a CardElementNumericCardElement builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementTimeSeriesCardElement.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementTimeSeriesCardElement.java deleted file mode 100644 index 64e4bb35..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CardElementTimeSeriesCardElement.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * A card element with a time series chart. - */ -public class CardElementTimeSeriesCardElement extends CardElement { - - /** - * Kind of element - * - NUMERIC&#58; Single numeric value - * - BREAKDOWN&#58; Breakdown of numeric values - * - TIME_SERIES&#58; Time-series of numeric values. - */ - public interface Kind { - /** NUMERIC. */ - String NUMERIC = "NUMERIC"; - /** BREAKDOWN. */ - String BREAKDOWN = "BREAKDOWN"; - /** TIME_SERIES. */ - String TIME_SERIES = "TIME_SERIES"; - } - - - /** - * Builder. - */ - public static class Builder { - private String text; - private String defaultInterval; - private String kind; - private String defaultTimeRange; - private List valueTypes; - - public Builder(CardElement cardElementTimeSeriesCardElement) { - this.text = cardElementTimeSeriesCardElement.text; - this.defaultInterval = cardElementTimeSeriesCardElement.defaultInterval; - this.kind = cardElementTimeSeriesCardElement.kind; - this.defaultTimeRange = cardElementTimeSeriesCardElement.defaultTimeRange; - this.valueTypes = cardElementTimeSeriesCardElement.valueTypes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param text the text - * @param kind the kind - * @param valueTypes the valueTypes - */ - public Builder(String text, String kind, List valueTypes) { - this.text = text; - this.kind = kind; - this.valueTypes = valueTypes; - } - - /** - * Builds a CardElementTimeSeriesCardElement. - * - * @return the new CardElementTimeSeriesCardElement instance - */ - public CardElementTimeSeriesCardElement build() { - return new CardElementTimeSeriesCardElement(this); - } - - /** - * Adds an valueTypes to valueTypes. - * - * @param valueTypes the new valueTypes - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder addValueTypes(ValueType valueTypes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(valueTypes, - "valueTypes cannot be null"); - if (this.valueTypes == null) { - this.valueTypes = new ArrayList(); - } - this.valueTypes.add(valueTypes); - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Set the defaultInterval. - * - * @param defaultInterval the defaultInterval - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder defaultInterval(String defaultInterval) { - this.defaultInterval = defaultInterval; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the defaultTimeRange. - * - * @param defaultTimeRange the defaultTimeRange - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder defaultTimeRange(String defaultTimeRange) { - this.defaultTimeRange = defaultTimeRange; - return this; - } - - /** - * Set the valueTypes. - * Existing valueTypes will be replaced. - * - * @param valueTypes the valueTypes - * @return the CardElementTimeSeriesCardElement builder - */ - public Builder valueTypes(List valueTypes) { - this.valueTypes = valueTypes; - return this; - } - } - - protected CardElementTimeSeriesCardElement(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.valueTypes, - "valueTypes cannot be null"); - text = builder.text; - defaultInterval = builder.defaultInterval; - kind = builder.kind; - defaultTimeRange = builder.defaultTimeRange; - valueTypes = builder.valueTypes; - } - - /** - * New builder. - * - * @return a CardElementTimeSeriesCardElement builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Context.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Context.java deleted file mode 100644 index af5dadcc..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Context.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Context. - */ -public class Context extends GenericModel { - - protected String region; - @SerializedName("resource_crn") - protected String resourceCrn; - @SerializedName("resource_id") - protected String resourceId; - @SerializedName("resource_name") - protected String resourceName; - @SerializedName("resource_type") - protected String resourceType; - @SerializedName("service_crn") - protected String serviceCrn; - @SerializedName("service_name") - protected String serviceName; - @SerializedName("environment_name") - protected String environmentName; - @SerializedName("component_name") - protected String componentName; - @SerializedName("toolchain_id") - protected String toolchainId; - - /** - * Builder. - */ - public static class Builder { - private String region; - private String resourceCrn; - private String resourceId; - private String resourceName; - private String resourceType; - private String serviceCrn; - private String serviceName; - private String environmentName; - private String componentName; - private String toolchainId; - - private Builder(Context context) { - this.region = context.region; - this.resourceCrn = context.resourceCrn; - this.resourceId = context.resourceId; - this.resourceName = context.resourceName; - this.resourceType = context.resourceType; - this.serviceCrn = context.serviceCrn; - this.serviceName = context.serviceName; - this.environmentName = context.environmentName; - this.componentName = context.componentName; - this.toolchainId = context.toolchainId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a Context. - * - * @return the new Context instance - */ - public Context build() { - return new Context(this); - } - - /** - * Set the region. - * - * @param region the region - * @return the Context builder - */ - public Builder region(String region) { - this.region = region; - return this; - } - - /** - * Set the resourceCrn. - * - * @param resourceCrn the resourceCrn - * @return the Context builder - */ - public Builder resourceCrn(String resourceCrn) { - this.resourceCrn = resourceCrn; - return this; - } - - /** - * Set the resourceId. - * - * @param resourceId the resourceId - * @return the Context builder - */ - public Builder resourceId(String resourceId) { - this.resourceId = resourceId; - return this; - } - - /** - * Set the resourceName. - * - * @param resourceName the resourceName - * @return the Context builder - */ - public Builder resourceName(String resourceName) { - this.resourceName = resourceName; - return this; - } - - /** - * Set the resourceType. - * - * @param resourceType the resourceType - * @return the Context builder - */ - public Builder resourceType(String resourceType) { - this.resourceType = resourceType; - return this; - } - - /** - * Set the serviceCrn. - * - * @param serviceCrn the serviceCrn - * @return the Context builder - */ - public Builder serviceCrn(String serviceCrn) { - this.serviceCrn = serviceCrn; - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the Context builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the environmentName. - * - * @param environmentName the environmentName - * @return the Context builder - */ - public Builder environmentName(String environmentName) { - this.environmentName = environmentName; - return this; - } - - /** - * Set the componentName. - * - * @param componentName the componentName - * @return the Context builder - */ - public Builder componentName(String componentName) { - this.componentName = componentName; - return this; - } - - /** - * Set the toolchainId. - * - * @param toolchainId the toolchainId - * @return the Context builder - */ - public Builder toolchainId(String toolchainId) { - this.toolchainId = toolchainId; - return this; - } - } - - protected Context(Builder builder) { - region = builder.region; - resourceCrn = builder.resourceCrn; - resourceId = builder.resourceId; - resourceName = builder.resourceName; - resourceType = builder.resourceType; - serviceCrn = builder.serviceCrn; - serviceName = builder.serviceName; - environmentName = builder.environmentName; - componentName = builder.componentName; - toolchainId = builder.toolchainId; - } - - /** - * New builder. - * - * @return a Context builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the region. - * - * The IBM Cloud region. - * - * @return the region - */ - public String region() { - return region; - } - - /** - * Gets the resourceCrn. - * - * The resource CRN (e.g. certificate CRN, image CRN). - * - * @return the resourceCrn - */ - public String resourceCrn() { - return resourceCrn; - } - - /** - * Gets the resourceId. - * - * The resource ID, in case the CRN is not available. - * - * @return the resourceId - */ - public String resourceId() { - return resourceId; - } - - /** - * Gets the resourceName. - * - * The user-friendly resource name. - * - * @return the resourceName - */ - public String resourceName() { - return resourceName; - } - - /** - * Gets the resourceType. - * - * The resource type name (e.g. Pod, Cluster, Certificate, Image). - * - * @return the resourceType - */ - public String resourceType() { - return resourceType; - } - - /** - * Gets the serviceCrn. - * - * The service CRN (e.g. CertMgr Instance CRN). - * - * @return the serviceCrn - */ - public String serviceCrn() { - return serviceCrn; - } - - /** - * Gets the serviceName. - * - * The service name (e.g. CertMgr). - * - * @return the serviceName - */ - public String serviceName() { - return serviceName; - } - - /** - * Gets the environmentName. - * - * The name of the environment the occurrence applies to. - * - * @return the environmentName - */ - public String environmentName() { - return environmentName; - } - - /** - * Gets the componentName. - * - * The name of the component the occurrence applies to. - * - * @return the componentName - */ - public String componentName() { - return componentName; - } - - /** - * Gets the toolchainId. - * - * The id of the toolchain the occurrence applies to. - * - * @return the toolchainId - */ - public String toolchainId() { - return toolchainId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java deleted file mode 100644 index 8cd0bed8..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java +++ /dev/null @@ -1,548 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createNote options. - */ -public class CreateNoteOptions extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - protected String providerId; - protected String shortDescription; - protected String longDescription; - protected String kind; - protected String id; - protected Reporter reportedBy; - protected List relatedUrl; - protected Date createTime; - protected Date updateTime; - protected Boolean shared; - protected FindingType finding; - protected KpiType kpi; - protected Card card; - protected Section section; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String shortDescription; - private String longDescription; - private String kind; - private String id; - private Reporter reportedBy; - private List relatedUrl; - private Date createTime; - private Date updateTime; - private Boolean shared; - private FindingType finding; - private KpiType kpi; - private Card card; - private Section section; - private String transactionId; - - private Builder(CreateNoteOptions createNoteOptions) { - this.providerId = createNoteOptions.providerId; - this.shortDescription = createNoteOptions.shortDescription; - this.longDescription = createNoteOptions.longDescription; - this.kind = createNoteOptions.kind; - this.id = createNoteOptions.id; - this.reportedBy = createNoteOptions.reportedBy; - this.relatedUrl = createNoteOptions.relatedUrl; - this.createTime = createNoteOptions.createTime; - this.updateTime = createNoteOptions.updateTime; - this.shared = createNoteOptions.shared; - this.finding = createNoteOptions.finding; - this.kpi = createNoteOptions.kpi; - this.card = createNoteOptions.card; - this.section = createNoteOptions.section; - this.transactionId = createNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param shortDescription the shortDescription - * @param longDescription the longDescription - * @param kind the kind - * @param id the id - * @param reportedBy the reportedBy - */ - public Builder(String providerId, String shortDescription, String longDescription, String kind, String id, Reporter reportedBy) { - this.providerId = providerId; - this.shortDescription = shortDescription; - this.longDescription = longDescription; - this.kind = kind; - this.id = id; - this.reportedBy = reportedBy; - } - - /** - * Builds a CreateNoteOptions. - * - * @return the new CreateNoteOptions instance - */ - public CreateNoteOptions build() { - return new CreateNoteOptions(this); - } - - /** - * Adds an relatedUrl to relatedUrl. - * - * @param relatedUrl the new relatedUrl - * @return the CreateNoteOptions builder - */ - public Builder addRelatedUrl(ApiNoteRelatedUrl relatedUrl) { - com.ibm.cloud.sdk.core.util.Validator.notNull(relatedUrl, - "relatedUrl cannot be null"); - if (this.relatedUrl == null) { - this.relatedUrl = new ArrayList(); - } - this.relatedUrl.add(relatedUrl); - return this; - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the CreateNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the shortDescription. - * - * @param shortDescription the shortDescription - * @return the CreateNoteOptions builder - */ - public Builder shortDescription(String shortDescription) { - this.shortDescription = shortDescription; - return this; - } - - /** - * Set the longDescription. - * - * @param longDescription the longDescription - * @return the CreateNoteOptions builder - */ - public Builder longDescription(String longDescription) { - this.longDescription = longDescription; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CreateNoteOptions builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the CreateNoteOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the reportedBy. - * - * @param reportedBy the reportedBy - * @return the CreateNoteOptions builder - */ - public Builder reportedBy(Reporter reportedBy) { - this.reportedBy = reportedBy; - return this; - } - - /** - * Set the relatedUrl. - * Existing relatedUrl will be replaced. - * - * @param relatedUrl the relatedUrl - * @return the CreateNoteOptions builder - */ - public Builder relatedUrl(List relatedUrl) { - this.relatedUrl = relatedUrl; - return this; - } - - /** - * Set the createTime. - * - * @param createTime the createTime - * @return the CreateNoteOptions builder - */ - public Builder createTime(Date createTime) { - this.createTime = createTime; - return this; - } - - /** - * Set the updateTime. - * - * @param updateTime the updateTime - * @return the CreateNoteOptions builder - */ - public Builder updateTime(Date updateTime) { - this.updateTime = updateTime; - return this; - } - - /** - * Set the shared. - * - * @param shared the shared - * @return the CreateNoteOptions builder - */ - public Builder shared(Boolean shared) { - this.shared = shared; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the CreateNoteOptions builder - */ - public Builder finding(FindingType finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the CreateNoteOptions builder - */ - public Builder kpi(KpiType kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the card. - * - * @param card the card - * @return the CreateNoteOptions builder - */ - public Builder card(Card card) { - this.card = card; - return this; - } - - /** - * Set the section. - * - * @param section the section - * @return the CreateNoteOptions builder - */ - public Builder section(Section section) { - this.section = section; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the CreateNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the apiNote. - * - * @param apiNote the apiNote - * @return the CreateNoteOptions builder - */ - public Builder apiNote(ApiNote apiNote) { - this.shortDescription = apiNote.shortDescription(); - this.longDescription = apiNote.longDescription(); - this.kind = apiNote.kind(); - this.id = apiNote.id(); - this.reportedBy = apiNote.reportedBy(); - this.relatedUrl = apiNote.relatedUrl(); - this.createTime = apiNote.createTime(); - this.updateTime = apiNote.updateTime(); - this.shared = apiNote.shared(); - this.finding = apiNote.finding(); - this.kpi = apiNote.kpi(); - this.card = apiNote.card(); - this.section = apiNote.section(); - return this; - } - } - - protected CreateNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.shortDescription, - "shortDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.longDescription, - "longDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.reportedBy, - "reportedBy cannot be null"); - providerId = builder.providerId; - shortDescription = builder.shortDescription; - longDescription = builder.longDescription; - kind = builder.kind; - id = builder.id; - reportedBy = builder.reportedBy; - relatedUrl = builder.relatedUrl; - createTime = builder.createTime; - updateTime = builder.updateTime; - shared = builder.shared; - finding = builder.finding; - kpi = builder.kpi; - card = builder.card; - section = builder.section; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a CreateNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the shortDescription. - * - * A one sentence description of your note. - * - * @return the shortDescription - */ - public String shortDescription() { - return shortDescription; - } - - /** - * Gets the longDescription. - * - * A more detailed description of your note. - * - * @return the longDescription - */ - public String longDescription() { - return longDescription; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the id. - * - * The ID of the note. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the reportedBy. - * - * The entity reporting a note. - * - * @return the reportedBy - */ - public Reporter reportedBy() { - return reportedBy; - } - - /** - * Gets the relatedUrl. - * - * @return the relatedUrl - */ - public List relatedUrl() { - return relatedUrl; - } - - /** - * Gets the createTime. - * - * Output only. The time this note was created. This field can be used as a filter in list requests. - * - * @return the createTime - */ - public Date createTime() { - return createTime; - } - - /** - * Gets the updateTime. - * - * Output only. The time this note was last updated. This field can be used as a filter in list requests. - * - * @return the updateTime - */ - public Date updateTime() { - return updateTime; - } - - /** - * Gets the shared. - * - * True if this note can be shared by multiple accounts. - * - * @return the shared - */ - public Boolean shared() { - return shared; - } - - /** - * Gets the finding. - * - * FindingType provides details about a finding note. - * - * @return the finding - */ - public FindingType finding() { - return finding; - } - - /** - * Gets the kpi. - * - * KpiType provides details about a KPI note. - * - * @return the kpi - */ - public KpiType kpi() { - return kpi; - } - - /** - * Gets the card. - * - * Card provides details about a card kind of note. - * - * @return the card - */ - public Card card() { - return card; - } - - /** - * Gets the section. - * - * Card provides details about a card kind of note. - * - * @return the section - */ - public Section section() { - return section; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java deleted file mode 100644 index d5b6c6b8..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java +++ /dev/null @@ -1,441 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.Map; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The createOccurrence options. - */ -public class CreateOccurrenceOptions extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - protected String providerId; - protected String noteName; - protected String kind; - protected String id; - protected String resourceUrl; - protected String remediation; - protected Context context; - protected Finding finding; - protected Kpi kpi; - protected Map referenceData; - protected String transactionId; - protected Boolean replaceIfExists; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteName; - private String kind; - private String id; - private String resourceUrl; - private String remediation; - private Context context; - private Finding finding; - private Kpi kpi; - private Map referenceData; - private String transactionId; - private Boolean replaceIfExists; - - private Builder(CreateOccurrenceOptions createOccurrenceOptions) { - this.providerId = createOccurrenceOptions.providerId; - this.noteName = createOccurrenceOptions.noteName; - this.kind = createOccurrenceOptions.kind; - this.id = createOccurrenceOptions.id; - this.resourceUrl = createOccurrenceOptions.resourceUrl; - this.remediation = createOccurrenceOptions.remediation; - this.context = createOccurrenceOptions.context; - this.finding = createOccurrenceOptions.finding; - this.kpi = createOccurrenceOptions.kpi; - this.referenceData = createOccurrenceOptions.referenceData; - this.transactionId = createOccurrenceOptions.transactionId; - this.replaceIfExists = createOccurrenceOptions.replaceIfExists; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteName the noteName - * @param kind the kind - * @param id the id - */ - public Builder(String providerId, String noteName, String kind, String id) { - this.providerId = providerId; - this.noteName = noteName; - this.kind = kind; - this.id = id; - } - - /** - * Builds a CreateOccurrenceOptions. - * - * @return the new CreateOccurrenceOptions instance - */ - public CreateOccurrenceOptions build() { - return new CreateOccurrenceOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the CreateOccurrenceOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteName. - * - * @param noteName the noteName - * @return the CreateOccurrenceOptions builder - */ - public Builder noteName(String noteName) { - this.noteName = noteName; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the CreateOccurrenceOptions builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the CreateOccurrenceOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the resourceUrl. - * - * @param resourceUrl the resourceUrl - * @return the CreateOccurrenceOptions builder - */ - public Builder resourceUrl(String resourceUrl) { - this.resourceUrl = resourceUrl; - return this; - } - - /** - * Set the remediation. - * - * @param remediation the remediation - * @return the CreateOccurrenceOptions builder - */ - public Builder remediation(String remediation) { - this.remediation = remediation; - return this; - } - - /** - * Set the context. - * - * @param context the context - * @return the CreateOccurrenceOptions builder - */ - public Builder context(Context context) { - this.context = context; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the CreateOccurrenceOptions builder - */ - public Builder finding(Finding finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the CreateOccurrenceOptions builder - */ - public Builder kpi(Kpi kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the referenceData. - * - * @param referenceData the referenceData - * @return the CreateOccurrenceOptions builder - */ - public Builder referenceData(Map referenceData) { - this.referenceData = referenceData; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the CreateOccurrenceOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the replaceIfExists. - * - * @param replaceIfExists the replaceIfExists - * @return the CreateOccurrenceOptions builder - */ - public Builder replaceIfExists(Boolean replaceIfExists) { - this.replaceIfExists = replaceIfExists; - return this; - } - - /** - * Set the apiOccurrence. - * - * @param apiOccurrence the apiOccurrence - * @return the CreateOccurrenceOptions builder - */ - public Builder apiOccurrence(ApiOccurrence apiOccurrence) { - this.noteName = apiOccurrence.noteName(); - this.kind = apiOccurrence.kind(); - this.id = apiOccurrence.id(); - this.resourceUrl = apiOccurrence.resourceUrl(); - this.remediation = apiOccurrence.remediation(); - this.context = apiOccurrence.context(); - this.finding = apiOccurrence.finding(); - this.kpi = apiOccurrence.kpi(); - this.referenceData = apiOccurrence.referenceData(); - return this; - } - } - - protected CreateOccurrenceOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.noteName, - "noteName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - providerId = builder.providerId; - noteName = builder.noteName; - kind = builder.kind; - id = builder.id; - resourceUrl = builder.resourceUrl; - remediation = builder.remediation; - context = builder.context; - finding = builder.finding; - kpi = builder.kpi; - referenceData = builder.referenceData; - transactionId = builder.transactionId; - replaceIfExists = builder.replaceIfExists; - } - - /** - * New builder. - * - * @return a CreateOccurrenceOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteName. - * - * An analysis note associated with this image, in the form "{account_id}/providers/{provider_id}/notes/{note_id}" - * This field can be used as a filter in list requests. - * - * @return the noteName - */ - public String noteName() { - return noteName; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the id. - * - * The id of the occurrence. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the resourceUrl. - * - * The unique URL of the resource, image or the container, for which the `Occurrence` applies. For example, - * https://gcr.io/provider/image@sha256:foo. This field can be used as a filter in list requests. - * - * @return the resourceUrl - */ - public String resourceUrl() { - return resourceUrl; - } - - /** - * Gets the remediation. - * - * A description of actions that can be taken to remedy the `Note`. - * - * @return the remediation - */ - public String remediation() { - return remediation; - } - - /** - * Gets the context. - * - * @return the context - */ - public Context context() { - return context; - } - - /** - * Gets the finding. - * - * Finding provides details about a finding occurrence. - * - * @return the finding - */ - public Finding finding() { - return finding; - } - - /** - * Gets the kpi. - * - * Kpi provides details about a KPI occurrence. - * - * @return the kpi - */ - public Kpi kpi() { - return kpi; - } - - /** - * Gets the referenceData. - * - * Additional data for the finding, like AT event etc. - * - * @return the referenceData - */ - public Map referenceData() { - return referenceData; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the replaceIfExists. - * - * When set to true, an existing occurrence is replaced rather than duplicated. - * - * @return the replaceIfExists - */ - public Boolean replaceIfExists() { - return replaceIfExists; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DataTransferred.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DataTransferred.java deleted file mode 100644 index c30ac442..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DataTransferred.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * It provides details about data transferred between clients and servers. - */ -public class DataTransferred extends GenericModel { - - @SerializedName("client_bytes") - protected Long clientBytes; - @SerializedName("server_bytes") - protected Long serverBytes; - @SerializedName("client_packets") - protected Long clientPackets; - @SerializedName("server_packets") - protected Long serverPackets; - - /** - * Builder. - */ - public static class Builder { - private Long clientBytes; - private Long serverBytes; - private Long clientPackets; - private Long serverPackets; - - private Builder(DataTransferred dataTransferred) { - this.clientBytes = dataTransferred.clientBytes; - this.serverBytes = dataTransferred.serverBytes; - this.clientPackets = dataTransferred.clientPackets; - this.serverPackets = dataTransferred.serverPackets; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a DataTransferred. - * - * @return the new DataTransferred instance - */ - public DataTransferred build() { - return new DataTransferred(this); - } - - /** - * Set the clientBytes. - * - * @param clientBytes the clientBytes - * @return the DataTransferred builder - */ - public Builder clientBytes(long clientBytes) { - this.clientBytes = clientBytes; - return this; - } - - /** - * Set the serverBytes. - * - * @param serverBytes the serverBytes - * @return the DataTransferred builder - */ - public Builder serverBytes(long serverBytes) { - this.serverBytes = serverBytes; - return this; - } - - /** - * Set the clientPackets. - * - * @param clientPackets the clientPackets - * @return the DataTransferred builder - */ - public Builder clientPackets(long clientPackets) { - this.clientPackets = clientPackets; - return this; - } - - /** - * Set the serverPackets. - * - * @param serverPackets the serverPackets - * @return the DataTransferred builder - */ - public Builder serverPackets(long serverPackets) { - this.serverPackets = serverPackets; - return this; - } - } - - protected DataTransferred(Builder builder) { - clientBytes = builder.clientBytes; - serverBytes = builder.serverBytes; - clientPackets = builder.clientPackets; - serverPackets = builder.serverPackets; - } - - /** - * New builder. - * - * @return a DataTransferred builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the clientBytes. - * - * The number of client bytes transferred. - * - * @return the clientBytes - */ - public Long clientBytes() { - return clientBytes; - } - - /** - * Gets the serverBytes. - * - * The number of server bytes transferred. - * - * @return the serverBytes - */ - public Long serverBytes() { - return serverBytes; - } - - /** - * Gets the clientPackets. - * - * The number of client packets transferred. - * - * @return the clientPackets - */ - public Long clientPackets() { - return clientPackets; - } - - /** - * Gets the serverPackets. - * - * The number of server packets transferred. - * - * @return the serverPackets - */ - public Long serverPackets() { - return serverPackets; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java deleted file mode 100644 index 93d46f53..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteNote options. - */ -public class DeleteNoteOptions extends GenericModel { - - protected String providerId; - protected String noteId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteId; - private String transactionId; - - private Builder(DeleteNoteOptions deleteNoteOptions) { - this.providerId = deleteNoteOptions.providerId; - this.noteId = deleteNoteOptions.noteId; - this.transactionId = deleteNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteId the noteId - */ - public Builder(String providerId, String noteId) { - this.providerId = providerId; - this.noteId = noteId; - } - - /** - * Builds a DeleteNoteOptions. - * - * @return the new DeleteNoteOptions instance - */ - public DeleteNoteOptions build() { - return new DeleteNoteOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the DeleteNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteId. - * - * @param noteId the noteId - * @return the DeleteNoteOptions builder - */ - public Builder noteId(String noteId) { - this.noteId = noteId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the DeleteNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected DeleteNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.noteId, - "noteId cannot be empty"); - providerId = builder.providerId; - noteId = builder.noteId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a DeleteNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteId. - * - * Second part of note `name`: providers/{provider_id}/notes/{note_id}. - * - * @return the noteId - */ - public String noteId() { - return noteId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java deleted file mode 100644 index 4a15c573..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The deleteOccurrence options. - */ -public class DeleteOccurrenceOptions extends GenericModel { - - protected String providerId; - protected String occurrenceId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String occurrenceId; - private String transactionId; - - private Builder(DeleteOccurrenceOptions deleteOccurrenceOptions) { - this.providerId = deleteOccurrenceOptions.providerId; - this.occurrenceId = deleteOccurrenceOptions.occurrenceId; - this.transactionId = deleteOccurrenceOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param occurrenceId the occurrenceId - */ - public Builder(String providerId, String occurrenceId) { - this.providerId = providerId; - this.occurrenceId = occurrenceId; - } - - /** - * Builds a DeleteOccurrenceOptions. - * - * @return the new DeleteOccurrenceOptions instance - */ - public DeleteOccurrenceOptions build() { - return new DeleteOccurrenceOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the DeleteOccurrenceOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the occurrenceId. - * - * @param occurrenceId the occurrenceId - * @return the DeleteOccurrenceOptions builder - */ - public Builder occurrenceId(String occurrenceId) { - this.occurrenceId = occurrenceId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the DeleteOccurrenceOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected DeleteOccurrenceOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.occurrenceId, - "occurrenceId cannot be empty"); - providerId = builder.providerId; - occurrenceId = builder.occurrenceId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a DeleteOccurrenceOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the occurrenceId. - * - * Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. - * - * @return the occurrenceId - */ - public String occurrenceId() { - return occurrenceId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Finding.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Finding.java deleted file mode 100644 index e40094ef..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Finding.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Finding provides details about a finding occurrence. - */ -public class Finding extends GenericModel { - - /** - * Note provider-assigned severity/impact ranking - * - LOW&#58; Low Impact - * - MEDIUM&#58; Medium Impact - * - HIGH&#58; High Impact - * - CRITICAL&#58; Critical Impact. - */ - public interface Severity { - /** LOW. */ - String LOW = "LOW"; - /** MEDIUM. */ - String MEDIUM = "MEDIUM"; - /** HIGH. */ - String HIGH = "HIGH"; - /** CRITICAL. */ - String CRITICAL = "CRITICAL"; - } - - /** - * Note provider-assigned confidence on the validity of an occurrence - * - LOW&#58; Low Certainty - * - MEDIUM&#58; Medium Certainty - * - HIGH&#58; High Certainty. - */ - public interface Certainty { - /** LOW. */ - String LOW = "LOW"; - /** MEDIUM. */ - String MEDIUM = "MEDIUM"; - /** HIGH. */ - String HIGH = "HIGH"; - } - - protected String severity; - protected String certainty; - @SerializedName("next_steps") - protected List nextSteps; - @SerializedName("network_connection") - protected NetworkConnection networkConnection; - @SerializedName("data_transferred") - protected DataTransferred dataTransferred; - - /** - * Builder. - */ - public static class Builder { - private String severity; - private String certainty; - private List nextSteps; - private NetworkConnection networkConnection; - private DataTransferred dataTransferred; - - private Builder(Finding finding) { - this.severity = finding.severity; - this.certainty = finding.certainty; - this.nextSteps = finding.nextSteps; - this.networkConnection = finding.networkConnection; - this.dataTransferred = finding.dataTransferred; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a Finding. - * - * @return the new Finding instance - */ - public Finding build() { - return new Finding(this); - } - - /** - * Adds an nextSteps to nextSteps. - * - * @param nextSteps the new nextSteps - * @return the Finding builder - */ - public Builder addNextSteps(RemediationStep nextSteps) { - com.ibm.cloud.sdk.core.util.Validator.notNull(nextSteps, - "nextSteps cannot be null"); - if (this.nextSteps == null) { - this.nextSteps = new ArrayList(); - } - this.nextSteps.add(nextSteps); - return this; - } - - /** - * Set the severity. - * - * @param severity the severity - * @return the Finding builder - */ - public Builder severity(String severity) { - this.severity = severity; - return this; - } - - /** - * Set the certainty. - * - * @param certainty the certainty - * @return the Finding builder - */ - public Builder certainty(String certainty) { - this.certainty = certainty; - return this; - } - - /** - * Set the nextSteps. - * Existing nextSteps will be replaced. - * - * @param nextSteps the nextSteps - * @return the Finding builder - */ - public Builder nextSteps(List nextSteps) { - this.nextSteps = nextSteps; - return this; - } - - /** - * Set the networkConnection. - * - * @param networkConnection the networkConnection - * @return the Finding builder - */ - public Builder networkConnection(NetworkConnection networkConnection) { - this.networkConnection = networkConnection; - return this; - } - - /** - * Set the dataTransferred. - * - * @param dataTransferred the dataTransferred - * @return the Finding builder - */ - public Builder dataTransferred(DataTransferred dataTransferred) { - this.dataTransferred = dataTransferred; - return this; - } - } - - protected Finding(Builder builder) { - severity = builder.severity; - certainty = builder.certainty; - nextSteps = builder.nextSteps; - networkConnection = builder.networkConnection; - dataTransferred = builder.dataTransferred; - } - - /** - * New builder. - * - * @return a Finding builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the severity. - * - * Note provider-assigned severity/impact ranking - * - LOW&#58; Low Impact - * - MEDIUM&#58; Medium Impact - * - HIGH&#58; High Impact - * - CRITICAL&#58; Critical Impact. - * - * @return the severity - */ - public String severity() { - return severity; - } - - /** - * Gets the certainty. - * - * Note provider-assigned confidence on the validity of an occurrence - * - LOW&#58; Low Certainty - * - MEDIUM&#58; Medium Certainty - * - HIGH&#58; High Certainty. - * - * @return the certainty - */ - public String certainty() { - return certainty; - } - - /** - * Gets the nextSteps. - * - * Remediation steps for the issues reported in this finding. They override the note's next steps. - * - * @return the nextSteps - */ - public List nextSteps() { - return nextSteps; - } - - /** - * Gets the networkConnection. - * - * It provides details about a network connection. - * - * @return the networkConnection - */ - public NetworkConnection networkConnection() { - return networkConnection; - } - - /** - * Gets the dataTransferred. - * - * It provides details about data transferred between clients and servers. - * - * @return the dataTransferred - */ - public DataTransferred dataTransferred() { - return dataTransferred; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/FindingType.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/FindingType.java deleted file mode 100644 index 6686251f..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/FindingType.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * FindingType provides details about a finding note. - */ -public class FindingType extends GenericModel { - - /** - * Note provider-assigned severity/impact ranking - * - LOW&#58; Low Impact - * - MEDIUM&#58; Medium Impact - * - HIGH&#58; High Impact - * - CRITICAL&#58; Critical Impact. - */ - public interface Severity { - /** LOW. */ - String LOW = "LOW"; - /** MEDIUM. */ - String MEDIUM = "MEDIUM"; - /** HIGH. */ - String HIGH = "HIGH"; - /** CRITICAL. */ - String CRITICAL = "CRITICAL"; - } - - protected String severity; - @SerializedName("next_steps") - protected List nextSteps; - - /** - * Builder. - */ - public static class Builder { - private String severity; - private List nextSteps; - - private Builder(FindingType findingType) { - this.severity = findingType.severity; - this.nextSteps = findingType.nextSteps; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param severity the severity - */ - public Builder(String severity) { - this.severity = severity; - } - - /** - * Builds a FindingType. - * - * @return the new FindingType instance - */ - public FindingType build() { - return new FindingType(this); - } - - /** - * Adds an nextSteps to nextSteps. - * - * @param nextSteps the new nextSteps - * @return the FindingType builder - */ - public Builder addNextSteps(RemediationStep nextSteps) { - com.ibm.cloud.sdk.core.util.Validator.notNull(nextSteps, - "nextSteps cannot be null"); - if (this.nextSteps == null) { - this.nextSteps = new ArrayList(); - } - this.nextSteps.add(nextSteps); - return this; - } - - /** - * Set the severity. - * - * @param severity the severity - * @return the FindingType builder - */ - public Builder severity(String severity) { - this.severity = severity; - return this; - } - - /** - * Set the nextSteps. - * Existing nextSteps will be replaced. - * - * @param nextSteps the nextSteps - * @return the FindingType builder - */ - public Builder nextSteps(List nextSteps) { - this.nextSteps = nextSteps; - return this; - } - } - - protected FindingType(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.severity, - "severity cannot be null"); - severity = builder.severity; - nextSteps = builder.nextSteps; - } - - /** - * New builder. - * - * @return a FindingType builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the severity. - * - * Note provider-assigned severity/impact ranking - * - LOW&#58; Low Impact - * - MEDIUM&#58; Medium Impact - * - HIGH&#58; High Impact - * - CRITICAL&#58; Critical Impact. - * - * @return the severity - */ - public String severity() { - return severity; - } - - /** - * Gets the nextSteps. - * - * Common remediation steps for the finding of this type. - * - * @return the nextSteps - */ - public List nextSteps() { - return nextSteps; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java deleted file mode 100644 index e00408a3..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getNote options. - */ -public class GetNoteOptions extends GenericModel { - - protected String providerId; - protected String noteId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteId; - private String transactionId; - - private Builder(GetNoteOptions getNoteOptions) { - this.providerId = getNoteOptions.providerId; - this.noteId = getNoteOptions.noteId; - this.transactionId = getNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteId the noteId - */ - public Builder(String providerId, String noteId) { - this.providerId = providerId; - this.noteId = noteId; - } - - /** - * Builds a GetNoteOptions. - * - * @return the new GetNoteOptions instance - */ - public GetNoteOptions build() { - return new GetNoteOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the GetNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteId. - * - * @param noteId the noteId - * @return the GetNoteOptions builder - */ - public Builder noteId(String noteId) { - this.noteId = noteId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the GetNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected GetNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.noteId, - "noteId cannot be empty"); - providerId = builder.providerId; - noteId = builder.noteId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a GetNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteId. - * - * Second part of note `name`: providers/{provider_id}/notes/{note_id}. - * - * @return the noteId - */ - public String noteId() { - return noteId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java deleted file mode 100644 index 549c87fd..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getOccurrenceNote options. - */ -public class GetOccurrenceNoteOptions extends GenericModel { - - protected String providerId; - protected String occurrenceId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String occurrenceId; - private String transactionId; - - private Builder(GetOccurrenceNoteOptions getOccurrenceNoteOptions) { - this.providerId = getOccurrenceNoteOptions.providerId; - this.occurrenceId = getOccurrenceNoteOptions.occurrenceId; - this.transactionId = getOccurrenceNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param occurrenceId the occurrenceId - */ - public Builder(String providerId, String occurrenceId) { - this.providerId = providerId; - this.occurrenceId = occurrenceId; - } - - /** - * Builds a GetOccurrenceNoteOptions. - * - * @return the new GetOccurrenceNoteOptions instance - */ - public GetOccurrenceNoteOptions build() { - return new GetOccurrenceNoteOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the GetOccurrenceNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the occurrenceId. - * - * @param occurrenceId the occurrenceId - * @return the GetOccurrenceNoteOptions builder - */ - public Builder occurrenceId(String occurrenceId) { - this.occurrenceId = occurrenceId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the GetOccurrenceNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected GetOccurrenceNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.occurrenceId, - "occurrenceId cannot be empty"); - providerId = builder.providerId; - occurrenceId = builder.occurrenceId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a GetOccurrenceNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the occurrenceId. - * - * Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. - * - * @return the occurrenceId - */ - public String occurrenceId() { - return occurrenceId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java deleted file mode 100644 index 37c395b2..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The getOccurrence options. - */ -public class GetOccurrenceOptions extends GenericModel { - - protected String providerId; - protected String occurrenceId; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String occurrenceId; - private String transactionId; - - private Builder(GetOccurrenceOptions getOccurrenceOptions) { - this.providerId = getOccurrenceOptions.providerId; - this.occurrenceId = getOccurrenceOptions.occurrenceId; - this.transactionId = getOccurrenceOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param occurrenceId the occurrenceId - */ - public Builder(String providerId, String occurrenceId) { - this.providerId = providerId; - this.occurrenceId = occurrenceId; - } - - /** - * Builds a GetOccurrenceOptions. - * - * @return the new GetOccurrenceOptions instance - */ - public GetOccurrenceOptions build() { - return new GetOccurrenceOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the GetOccurrenceOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the occurrenceId. - * - * @param occurrenceId the occurrenceId - * @return the GetOccurrenceOptions builder - */ - public Builder occurrenceId(String occurrenceId) { - this.occurrenceId = occurrenceId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the GetOccurrenceOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - } - - protected GetOccurrenceOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.occurrenceId, - "occurrenceId cannot be empty"); - providerId = builder.providerId; - occurrenceId = builder.occurrenceId; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a GetOccurrenceOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the occurrenceId. - * - * Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. - * - * @return the occurrenceId - */ - public String occurrenceId() { - return occurrenceId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Kpi.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Kpi.java deleted file mode 100644 index f06b2e33..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Kpi.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Kpi provides details about a KPI occurrence. - */ -public class Kpi extends GenericModel { - - protected Double value; - protected Double total; - - /** - * Builder. - */ - public static class Builder { - private Double value; - private Double total; - - private Builder(Kpi kpi) { - this.value = kpi.value; - this.total = kpi.total; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param value the value - */ - public Builder(Double value) { - this.value = value; - } - - /** - * Builds a Kpi. - * - * @return the new Kpi instance - */ - public Kpi build() { - return new Kpi(this); - } - - /** - * Set the value. - * - * @param value the value - * @return the Kpi builder - */ - public Builder value(Double value) { - this.value = value; - return this; - } - - /** - * Set the total. - * - * @param total the total - * @return the Kpi builder - */ - public Builder total(Double total) { - this.total = total; - return this; - } - } - - protected Kpi(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); - value = builder.value; - total = builder.total; - } - - /** - * New builder. - * - * @return a Kpi builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the value. - * - * The value of this KPI. - * - * @return the value - */ - public Double value() { - return value; - } - - /** - * Gets the total. - * - * The total value of this KPI. - * - * @return the total - */ - public Double total() { - return total; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/KpiType.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/KpiType.java deleted file mode 100644 index 8432dc6f..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/KpiType.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * KpiType provides details about a KPI note. - */ -public class KpiType extends GenericModel { - - public interface Severity { - /** LOW. */ - String LOW = "LOW"; - /** MEDIUM. */ - String MEDIUM = "MEDIUM"; - /** HIGH. */ - String HIGH = "HIGH"; - /** CRITICAL. */ - String CRITICAL = "CRITICAL"; - } - - /** - * The aggregation type of the KPI values. - SUM&#58; A single-value metrics aggregation type that sums up numeric - * values - * that are extracted from KPI occurrences. - */ - public interface AggregationType { - /** SUM. */ - String SUM = "SUM"; - } - - @SerializedName("Severity") - protected String severity; - @SerializedName("aggregation_type") - protected String aggregationType; - - /** - * Builder. - */ - public static class Builder { - private String severity; - private String aggregationType; - - private Builder(KpiType kpiType) { - this.severity = kpiType.severity; - this.aggregationType = kpiType.aggregationType; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param aggregationType the aggregationType - */ - public Builder(String aggregationType) { - this.aggregationType = aggregationType; - } - - /** - * Builds a KpiType. - * - * @return the new KpiType instance - */ - public KpiType build() { - return new KpiType(this); - } - - /** - * Set the severity. - * - * @param severity the severity - * @return the KpiType builder - */ - public Builder severity(String severity) { - this.severity = severity; - return this; - } - - /** - * Set the aggregationType. - * - * @param aggregationType the aggregationType - * @return the KpiType builder - */ - public Builder aggregationType(String aggregationType) { - this.aggregationType = aggregationType; - return this; - } - } - - protected KpiType(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.aggregationType, - "aggregationType cannot be null"); - severity = builder.severity; - aggregationType = builder.aggregationType; - } - - /** - * New builder. - * - * @return a KpiType builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the severity. - * - * @return the severity - */ - public String severity() { - return severity; - } - - /** - * Gets the aggregationType. - * - * The aggregation type of the KPI values. - SUM&#58; A single-value metrics aggregation type that sums up numeric - * values - * that are extracted from KPI occurrences. - * - * @return the aggregationType - */ - public String aggregationType() { - return aggregationType; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java deleted file mode 100644 index e05463ad..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listNoteOccurrences options. - */ -public class ListNoteOccurrencesOptions extends GenericModel { - - protected String providerId; - protected String noteId; - protected String transactionId; - protected Long pageSize; - protected String pageToken; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteId; - private String transactionId; - private Long pageSize; - private String pageToken; - - private Builder(ListNoteOccurrencesOptions listNoteOccurrencesOptions) { - this.providerId = listNoteOccurrencesOptions.providerId; - this.noteId = listNoteOccurrencesOptions.noteId; - this.transactionId = listNoteOccurrencesOptions.transactionId; - this.pageSize = listNoteOccurrencesOptions.pageSize; - this.pageToken = listNoteOccurrencesOptions.pageToken; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteId the noteId - */ - public Builder(String providerId, String noteId) { - this.providerId = providerId; - this.noteId = noteId; - } - - /** - * Builds a ListNoteOccurrencesOptions. - * - * @return the new ListNoteOccurrencesOptions instance - */ - public ListNoteOccurrencesOptions build() { - return new ListNoteOccurrencesOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the ListNoteOccurrencesOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteId. - * - * @param noteId the noteId - * @return the ListNoteOccurrencesOptions builder - */ - public Builder noteId(String noteId) { - this.noteId = noteId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the ListNoteOccurrencesOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the pageSize. - * - * @param pageSize the pageSize - * @return the ListNoteOccurrencesOptions builder - */ - public Builder pageSize(long pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Set the pageToken. - * - * @param pageToken the pageToken - * @return the ListNoteOccurrencesOptions builder - */ - public Builder pageToken(String pageToken) { - this.pageToken = pageToken; - return this; - } - } - - protected ListNoteOccurrencesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.noteId, - "noteId cannot be empty"); - providerId = builder.providerId; - noteId = builder.noteId; - transactionId = builder.transactionId; - pageSize = builder.pageSize; - pageToken = builder.pageToken; - } - - /** - * New builder. - * - * @return a ListNoteOccurrencesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteId. - * - * Second part of note `name`: providers/{provider_id}/notes/{note_id}. - * - * @return the noteId - */ - public String noteId() { - return noteId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the pageSize. - * - * Number of notes to return in the list. - * - * @return the pageSize - */ - public Long pageSize() { - return pageSize; - } - - /** - * Gets the pageToken. - * - * Token to provide to skip to a particular spot in the list. - * - * @return the pageToken - */ - public String pageToken() { - return pageToken; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java deleted file mode 100644 index 795125c9..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listNotes options. - */ -public class ListNotesOptions extends GenericModel { - - protected String providerId; - protected String transactionId; - protected Long pageSize; - protected String pageToken; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String transactionId; - private Long pageSize; - private String pageToken; - - private Builder(ListNotesOptions listNotesOptions) { - this.providerId = listNotesOptions.providerId; - this.transactionId = listNotesOptions.transactionId; - this.pageSize = listNotesOptions.pageSize; - this.pageToken = listNotesOptions.pageToken; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - */ - public Builder(String providerId) { - this.providerId = providerId; - } - - /** - * Builds a ListNotesOptions. - * - * @return the new ListNotesOptions instance - */ - public ListNotesOptions build() { - return new ListNotesOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the ListNotesOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the ListNotesOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the pageSize. - * - * @param pageSize the pageSize - * @return the ListNotesOptions builder - */ - public Builder pageSize(long pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Set the pageToken. - * - * @param pageToken the pageToken - * @return the ListNotesOptions builder - */ - public Builder pageToken(String pageToken) { - this.pageToken = pageToken; - return this; - } - } - - protected ListNotesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - providerId = builder.providerId; - transactionId = builder.transactionId; - pageSize = builder.pageSize; - pageToken = builder.pageToken; - } - - /** - * New builder. - * - * @return a ListNotesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the pageSize. - * - * Number of notes to return in the list. - * - * @return the pageSize - */ - public Long pageSize() { - return pageSize; - } - - /** - * Gets the pageToken. - * - * Token to provide to skip to a particular spot in the list. - * - * @return the pageToken - */ - public String pageToken() { - return pageToken; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java deleted file mode 100644 index 1fe4fe7e..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listOccurrences options. - */ -public class ListOccurrencesOptions extends GenericModel { - - protected String providerId; - protected String transactionId; - protected Long pageSize; - protected String pageToken; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String transactionId; - private Long pageSize; - private String pageToken; - - private Builder(ListOccurrencesOptions listOccurrencesOptions) { - this.providerId = listOccurrencesOptions.providerId; - this.transactionId = listOccurrencesOptions.transactionId; - this.pageSize = listOccurrencesOptions.pageSize; - this.pageToken = listOccurrencesOptions.pageToken; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - */ - public Builder(String providerId) { - this.providerId = providerId; - } - - /** - * Builds a ListOccurrencesOptions. - * - * @return the new ListOccurrencesOptions instance - */ - public ListOccurrencesOptions build() { - return new ListOccurrencesOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the ListOccurrencesOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the ListOccurrencesOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the pageSize. - * - * @param pageSize the pageSize - * @return the ListOccurrencesOptions builder - */ - public Builder pageSize(long pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Set the pageToken. - * - * @param pageToken the pageToken - * @return the ListOccurrencesOptions builder - */ - public Builder pageToken(String pageToken) { - this.pageToken = pageToken; - return this; - } - } - - protected ListOccurrencesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - providerId = builder.providerId; - transactionId = builder.transactionId; - pageSize = builder.pageSize; - pageToken = builder.pageToken; - } - - /** - * New builder. - * - * @return a ListOccurrencesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the pageSize. - * - * Number of notes to return in the list. - * - * @return the pageSize - */ - public Long pageSize() { - return pageSize; - } - - /** - * Gets the pageToken. - * - * Token to provide to skip to a particular spot in the list. - * - * @return the pageToken - */ - public String pageToken() { - return pageToken; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java deleted file mode 100644 index 5403bde8..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The listProviders options. - */ -public class ListProvidersOptions extends GenericModel { - - protected String transactionId; - protected Long limit; - protected Long skip; - protected String startProviderId; - protected String endProviderId; - - /** - * Builder. - */ - public static class Builder { - private String transactionId; - private Long limit; - private Long skip; - private String startProviderId; - private String endProviderId; - - private Builder(ListProvidersOptions listProvidersOptions) { - this.transactionId = listProvidersOptions.transactionId; - this.limit = listProvidersOptions.limit; - this.skip = listProvidersOptions.skip; - this.startProviderId = listProvidersOptions.startProviderId; - this.endProviderId = listProvidersOptions.endProviderId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ListProvidersOptions. - * - * @return the new ListProvidersOptions instance - */ - public ListProvidersOptions build() { - return new ListProvidersOptions(this); - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the ListProvidersOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the ListProvidersOptions builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the skip. - * - * @param skip the skip - * @return the ListProvidersOptions builder - */ - public Builder skip(long skip) { - this.skip = skip; - return this; - } - - /** - * Set the startProviderId. - * - * @param startProviderId the startProviderId - * @return the ListProvidersOptions builder - */ - public Builder startProviderId(String startProviderId) { - this.startProviderId = startProviderId; - return this; - } - - /** - * Set the endProviderId. - * - * @param endProviderId the endProviderId - * @return the ListProvidersOptions builder - */ - public Builder endProviderId(String endProviderId) { - this.endProviderId = endProviderId; - return this; - } - } - - protected ListProvidersOptions(Builder builder) { - transactionId = builder.transactionId; - limit = builder.limit; - skip = builder.skip; - startProviderId = builder.startProviderId; - endProviderId = builder.endProviderId; - } - - /** - * New builder. - * - * @return a ListProvidersOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } - - /** - * Gets the limit. - * - * The number of documents that you want to return. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the skip. - * - * The offset is the index of the item from which you want to start returning data from. Default is 0. - * - * @return the skip - */ - public Long skip() { - return skip; - } - - /** - * Gets the startProviderId. - * - * The first provider ID included in the result, sorted in ascending order. If not provided, this parameter is - * ignored. - * - * @return the startProviderId - */ - public String startProviderId() { - return startProviderId; - } - - /** - * Gets the endProviderId. - * - * The last provider ID included in the result, sorted in ascending order. If not provided, this parameter is ignored. - * - * @return the endProviderId - */ - public String endProviderId() { - return endProviderId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/NetworkConnection.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/NetworkConnection.java deleted file mode 100644 index 22664a00..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/NetworkConnection.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * It provides details about a network connection. - */ -public class NetworkConnection extends GenericModel { - - protected String direction; - protected String protocol; - protected SocketAddress client; - protected SocketAddress server; - - /** - * Builder. - */ - public static class Builder { - private String direction; - private String protocol; - private SocketAddress client; - private SocketAddress server; - - private Builder(NetworkConnection networkConnection) { - this.direction = networkConnection.direction; - this.protocol = networkConnection.protocol; - this.client = networkConnection.client; - this.server = networkConnection.server; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a NetworkConnection. - * - * @return the new NetworkConnection instance - */ - public NetworkConnection build() { - return new NetworkConnection(this); - } - - /** - * Set the direction. - * - * @param direction the direction - * @return the NetworkConnection builder - */ - public Builder direction(String direction) { - this.direction = direction; - return this; - } - - /** - * Set the protocol. - * - * @param protocol the protocol - * @return the NetworkConnection builder - */ - public Builder protocol(String protocol) { - this.protocol = protocol; - return this; - } - - /** - * Set the client. - * - * @param client the client - * @return the NetworkConnection builder - */ - public Builder client(SocketAddress client) { - this.client = client; - return this; - } - - /** - * Set the server. - * - * @param server the server - * @return the NetworkConnection builder - */ - public Builder server(SocketAddress server) { - this.server = server; - return this; - } - } - - protected NetworkConnection(Builder builder) { - direction = builder.direction; - protocol = builder.protocol; - client = builder.client; - server = builder.server; - } - - /** - * New builder. - * - * @return a NetworkConnection builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the direction. - * - * The direction of this network connection. - * - * @return the direction - */ - public String direction() { - return direction; - } - - /** - * Gets the protocol. - * - * The protocol of this network connection. - * - * @return the protocol - */ - public String protocol() { - return protocol; - } - - /** - * Gets the client. - * - * It provides details about a socket address. - * - * @return the client - */ - public SocketAddress client() { - return client; - } - - /** - * Gets the server. - * - * It provides details about a socket address. - * - * @return the server - */ - public SocketAddress server() { - return server; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/NumericCardElementValueType.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/NumericCardElementValueType.java deleted file mode 100644 index 97c4cf4a..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/NumericCardElementValueType.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * NumericCardElementValueType. - */ -public class NumericCardElementValueType extends ValueType { - - /** - * Kind of element - * - KPI&#58; Kind of value derived from a KPI occurrence. - */ - public interface Kind { - /** KPI. */ - String KPI = "KPI"; - } - - - /** - * Builder. - */ - public static class Builder { - private String kind; - private String kpiNoteName; - private String text; - private List findingNoteNames; - - public Builder(ValueType numericCardElementValueType) { - this.kind = numericCardElementValueType.kind; - this.kpiNoteName = numericCardElementValueType.kpiNoteName; - this.text = numericCardElementValueType.text; - this.findingNoteNames = numericCardElementValueType.findingNoteNames; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a NumericCardElementValueType. - * - * @return the new NumericCardElementValueType instance - */ - public NumericCardElementValueType build() { - return new NumericCardElementValueType(this); - } - - /** - * Adds an findingNoteNames to findingNoteNames. - * - * @param findingNoteNames the new findingNoteNames - * @return the NumericCardElementValueType builder - */ - public Builder addFindingNoteNames(String findingNoteNames) { - com.ibm.cloud.sdk.core.util.Validator.notNull(findingNoteNames, - "findingNoteNames cannot be null"); - if (this.findingNoteNames == null) { - this.findingNoteNames = new ArrayList(); - } - this.findingNoteNames.add(findingNoteNames); - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the NumericCardElementValueType builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the kpiNoteName. - * - * @param kpiNoteName the kpiNoteName - * @return the NumericCardElementValueType builder - */ - public Builder kpiNoteName(String kpiNoteName) { - this.kpiNoteName = kpiNoteName; - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the NumericCardElementValueType builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Set the findingNoteNames. - * Existing findingNoteNames will be replaced. - * - * @param findingNoteNames the findingNoteNames - * @return the NumericCardElementValueType builder - */ - public Builder findingNoteNames(List findingNoteNames) { - this.findingNoteNames = findingNoteNames; - return this; - } - } - - protected NumericCardElementValueType(Builder builder) { - kind = builder.kind; - kpiNoteName = builder.kpiNoteName; - text = builder.text; - findingNoteNames = builder.findingNoteNames; - } - - /** - * New builder. - * - * @return a NumericCardElementValueType builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java deleted file mode 100644 index aaf9a9ff..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The postGraph options. - */ -public class PostGraphOptions extends GenericModel { - - protected InputStream body; - protected String contentType; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private InputStream body; - private String contentType; - private String transactionId; - - private Builder(PostGraphOptions postGraphOptions) { - this.body = postGraphOptions.body; - this.contentType = postGraphOptions.contentType; - this.transactionId = postGraphOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a PostGraphOptions. - * - * @return the new PostGraphOptions instance - */ - public PostGraphOptions build() { - return new PostGraphOptions(this); - } - - /** - * Set the body. - * - * @param body the body - * @return the PostGraphOptions builder - */ - public Builder body(InputStream body) { - this.body = body; - return this; - } - - /** - * Set the contentType. - * - * @param contentType the contentType - * @return the PostGraphOptions builder - */ - public Builder contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the PostGraphOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the body. - * - * @param body the body - * @return the PostGraphOptions builder - * - * @throws FileNotFoundException if the file could not be found - */ - public Builder body(File body) throws FileNotFoundException { - this.body = new FileInputStream(body); - return this; - } - } - - protected PostGraphOptions(Builder builder) { - body = builder.body; - contentType = builder.contentType; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a PostGraphOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the body. - * - * Body for query findings. - * - * @return the body - */ - public InputStream body() { - return body; - } - - /** - * Gets the contentType. - * - * The type of the input. - * - * @return the contentType - */ - public String contentType() { - return contentType; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/RemediationStep.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/RemediationStep.java deleted file mode 100644 index c12e47d1..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/RemediationStep.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * A remediation step description and associated URL. - */ -public class RemediationStep extends GenericModel { - - protected String title; - protected String url; - - /** - * Builder. - */ - public static class Builder { - private String title; - private String url; - - private Builder(RemediationStep remediationStep) { - this.title = remediationStep.title; - this.url = remediationStep.url; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a RemediationStep. - * - * @return the new RemediationStep instance - */ - public RemediationStep build() { - return new RemediationStep(this); - } - - /** - * Set the title. - * - * @param title the title - * @return the RemediationStep builder - */ - public Builder title(String title) { - this.title = title; - return this; - } - - /** - * Set the url. - * - * @param url the url - * @return the RemediationStep builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - } - - protected RemediationStep(Builder builder) { - title = builder.title; - url = builder.url; - } - - /** - * New builder. - * - * @return a RemediationStep builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the title. - * - * Title of this next step. - * - * @return the title - */ - public String title() { - return title; - } - - /** - * Gets the url. - * - * The URL associated to this next steps. - * - * @return the url - */ - public String url() { - return url; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Reporter.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Reporter.java deleted file mode 100644 index d3d79fac..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Reporter.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The entity reporting a note. - */ -public class Reporter extends GenericModel { - - protected String id; - protected String title; - protected String url; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String title; - private String url; - - private Builder(Reporter reporter) { - this.id = reporter.id; - this.title = reporter.title; - this.url = reporter.url; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param id the id - * @param title the title - */ - public Builder(String id, String title) { - this.id = id; - this.title = title; - } - - /** - * Builds a Reporter. - * - * @return the new Reporter instance - */ - public Reporter build() { - return new Reporter(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the Reporter builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the title. - * - * @param title the title - * @return the Reporter builder - */ - public Builder title(String title) { - this.title = title; - return this; - } - - /** - * Set the url. - * - * @param url the url - * @return the Reporter builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - } - - protected Reporter(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.title, - "title cannot be null"); - id = builder.id; - title = builder.title; - url = builder.url; - } - - /** - * New builder. - * - * @return a Reporter builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the id. - * - * The id of this reporter. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the title. - * - * The title of this reporter. - * - * @return the title - */ - public String title() { - return title; - } - - /** - * Gets the url. - * - * The url of this reporter. - * - * @return the url - */ - public String url() { - return url; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Section.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Section.java deleted file mode 100644 index ee29c62d..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/Section.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Card provides details about a card kind of note. - */ -public class Section extends GenericModel { - - protected String title; - protected String image; - - /** - * Builder. - */ - public static class Builder { - private String title; - private String image; - - private Builder(Section section) { - this.title = section.title; - this.image = section.image; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param title the title - * @param image the image - */ - public Builder(String title, String image) { - this.title = title; - this.image = image; - } - - /** - * Builds a Section. - * - * @return the new Section instance - */ - public Section build() { - return new Section(this); - } - - /** - * Set the title. - * - * @param title the title - * @return the Section builder - */ - public Builder title(String title) { - this.title = title; - return this; - } - - /** - * Set the image. - * - * @param image the image - * @return the Section builder - */ - public Builder image(String image) { - this.image = image; - return this; - } - } - - protected Section(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.title, - "title cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.image, - "image cannot be null"); - title = builder.title; - image = builder.image; - } - - /** - * New builder. - * - * @return a Section builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the title. - * - * The title of this section. - * - * @return the title - */ - public String title() { - return title; - } - - /** - * Gets the image. - * - * The image of this section. - * - * @return the image - */ - public String image() { - return image; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/SocketAddress.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/SocketAddress.java deleted file mode 100644 index 83df521a..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/SocketAddress.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * It provides details about a socket address. - */ -public class SocketAddress extends GenericModel { - - protected String address; - protected Long port; - - /** - * Builder. - */ - public static class Builder { - private String address; - private Long port; - - private Builder(SocketAddress socketAddress) { - this.address = socketAddress.address; - this.port = socketAddress.port; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param address the address - */ - public Builder(String address) { - this.address = address; - } - - /** - * Builds a SocketAddress. - * - * @return the new SocketAddress instance - */ - public SocketAddress build() { - return new SocketAddress(this); - } - - /** - * Set the address. - * - * @param address the address - * @return the SocketAddress builder - */ - public Builder address(String address) { - this.address = address; - return this; - } - - /** - * Set the port. - * - * @param port the port - * @return the SocketAddress builder - */ - public Builder port(long port) { - this.port = port; - return this; - } - } - - protected SocketAddress(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.address, - "address cannot be null"); - address = builder.address; - port = builder.port; - } - - /** - * New builder. - * - * @return a SocketAddress builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the address. - * - * The IP address of this socket address. - * - * @return the address - */ - public String address() { - return address; - } - - /** - * Gets the port. - * - * The port number of this socket address. - * - * @return the port - */ - public Long port() { - return port; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java deleted file mode 100644 index 68fd78cd..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java +++ /dev/null @@ -1,578 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateNote options. - */ -public class UpdateNoteOptions extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - protected String providerId; - protected String noteId; - protected String shortDescription; - protected String longDescription; - protected String kind; - protected String id; - protected Reporter reportedBy; - protected List relatedUrl; - protected Date createTime; - protected Date updateTime; - protected Boolean shared; - protected FindingType finding; - protected KpiType kpi; - protected Card card; - protected Section section; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String noteId; - private String shortDescription; - private String longDescription; - private String kind; - private String id; - private Reporter reportedBy; - private List relatedUrl; - private Date createTime; - private Date updateTime; - private Boolean shared; - private FindingType finding; - private KpiType kpi; - private Card card; - private Section section; - private String transactionId; - - private Builder(UpdateNoteOptions updateNoteOptions) { - this.providerId = updateNoteOptions.providerId; - this.noteId = updateNoteOptions.noteId; - this.shortDescription = updateNoteOptions.shortDescription; - this.longDescription = updateNoteOptions.longDescription; - this.kind = updateNoteOptions.kind; - this.id = updateNoteOptions.id; - this.reportedBy = updateNoteOptions.reportedBy; - this.relatedUrl = updateNoteOptions.relatedUrl; - this.createTime = updateNoteOptions.createTime; - this.updateTime = updateNoteOptions.updateTime; - this.shared = updateNoteOptions.shared; - this.finding = updateNoteOptions.finding; - this.kpi = updateNoteOptions.kpi; - this.card = updateNoteOptions.card; - this.section = updateNoteOptions.section; - this.transactionId = updateNoteOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param noteId the noteId - * @param shortDescription the shortDescription - * @param longDescription the longDescription - * @param kind the kind - * @param id the id - * @param reportedBy the reportedBy - */ - public Builder(String providerId, String noteId, String shortDescription, String longDescription, String kind, String id, Reporter reportedBy) { - this.providerId = providerId; - this.noteId = noteId; - this.shortDescription = shortDescription; - this.longDescription = longDescription; - this.kind = kind; - this.id = id; - this.reportedBy = reportedBy; - } - - /** - * Builds a UpdateNoteOptions. - * - * @return the new UpdateNoteOptions instance - */ - public UpdateNoteOptions build() { - return new UpdateNoteOptions(this); - } - - /** - * Adds an relatedUrl to relatedUrl. - * - * @param relatedUrl the new relatedUrl - * @return the UpdateNoteOptions builder - */ - public Builder addRelatedUrl(ApiNoteRelatedUrl relatedUrl) { - com.ibm.cloud.sdk.core.util.Validator.notNull(relatedUrl, - "relatedUrl cannot be null"); - if (this.relatedUrl == null) { - this.relatedUrl = new ArrayList(); - } - this.relatedUrl.add(relatedUrl); - return this; - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the UpdateNoteOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the noteId. - * - * @param noteId the noteId - * @return the UpdateNoteOptions builder - */ - public Builder noteId(String noteId) { - this.noteId = noteId; - return this; - } - - /** - * Set the shortDescription. - * - * @param shortDescription the shortDescription - * @return the UpdateNoteOptions builder - */ - public Builder shortDescription(String shortDescription) { - this.shortDescription = shortDescription; - return this; - } - - /** - * Set the longDescription. - * - * @param longDescription the longDescription - * @return the UpdateNoteOptions builder - */ - public Builder longDescription(String longDescription) { - this.longDescription = longDescription; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the UpdateNoteOptions builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the UpdateNoteOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the reportedBy. - * - * @param reportedBy the reportedBy - * @return the UpdateNoteOptions builder - */ - public Builder reportedBy(Reporter reportedBy) { - this.reportedBy = reportedBy; - return this; - } - - /** - * Set the relatedUrl. - * Existing relatedUrl will be replaced. - * - * @param relatedUrl the relatedUrl - * @return the UpdateNoteOptions builder - */ - public Builder relatedUrl(List relatedUrl) { - this.relatedUrl = relatedUrl; - return this; - } - - /** - * Set the createTime. - * - * @param createTime the createTime - * @return the UpdateNoteOptions builder - */ - public Builder createTime(Date createTime) { - this.createTime = createTime; - return this; - } - - /** - * Set the updateTime. - * - * @param updateTime the updateTime - * @return the UpdateNoteOptions builder - */ - public Builder updateTime(Date updateTime) { - this.updateTime = updateTime; - return this; - } - - /** - * Set the shared. - * - * @param shared the shared - * @return the UpdateNoteOptions builder - */ - public Builder shared(Boolean shared) { - this.shared = shared; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the UpdateNoteOptions builder - */ - public Builder finding(FindingType finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the UpdateNoteOptions builder - */ - public Builder kpi(KpiType kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the card. - * - * @param card the card - * @return the UpdateNoteOptions builder - */ - public Builder card(Card card) { - this.card = card; - return this; - } - - /** - * Set the section. - * - * @param section the section - * @return the UpdateNoteOptions builder - */ - public Builder section(Section section) { - this.section = section; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the UpdateNoteOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the apiNote. - * - * @param apiNote the apiNote - * @return the UpdateNoteOptions builder - */ - public Builder apiNote(ApiNote apiNote) { - this.shortDescription = apiNote.shortDescription(); - this.longDescription = apiNote.longDescription(); - this.kind = apiNote.kind(); - this.id = apiNote.id(); - this.reportedBy = apiNote.reportedBy(); - this.relatedUrl = apiNote.relatedUrl(); - this.createTime = apiNote.createTime(); - this.updateTime = apiNote.updateTime(); - this.shared = apiNote.shared(); - this.finding = apiNote.finding(); - this.kpi = apiNote.kpi(); - this.card = apiNote.card(); - this.section = apiNote.section(); - return this; - } - } - - protected UpdateNoteOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.noteId, - "noteId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.shortDescription, - "shortDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.longDescription, - "longDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.reportedBy, - "reportedBy cannot be null"); - providerId = builder.providerId; - noteId = builder.noteId; - shortDescription = builder.shortDescription; - longDescription = builder.longDescription; - kind = builder.kind; - id = builder.id; - reportedBy = builder.reportedBy; - relatedUrl = builder.relatedUrl; - createTime = builder.createTime; - updateTime = builder.updateTime; - shared = builder.shared; - finding = builder.finding; - kpi = builder.kpi; - card = builder.card; - section = builder.section; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a UpdateNoteOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the noteId. - * - * Second part of note `name`: providers/{provider_id}/notes/{note_id}. - * - * @return the noteId - */ - public String noteId() { - return noteId; - } - - /** - * Gets the shortDescription. - * - * A one sentence description of your note. - * - * @return the shortDescription - */ - public String shortDescription() { - return shortDescription; - } - - /** - * Gets the longDescription. - * - * A more detailed description of your note. - * - * @return the longDescription - */ - public String longDescription() { - return longDescription; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the id. - * - * The ID of the note. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the reportedBy. - * - * The entity reporting a note. - * - * @return the reportedBy - */ - public Reporter reportedBy() { - return reportedBy; - } - - /** - * Gets the relatedUrl. - * - * @return the relatedUrl - */ - public List relatedUrl() { - return relatedUrl; - } - - /** - * Gets the createTime. - * - * Output only. The time this note was created. This field can be used as a filter in list requests. - * - * @return the createTime - */ - public Date createTime() { - return createTime; - } - - /** - * Gets the updateTime. - * - * Output only. The time this note was last updated. This field can be used as a filter in list requests. - * - * @return the updateTime - */ - public Date updateTime() { - return updateTime; - } - - /** - * Gets the shared. - * - * True if this note can be shared by multiple accounts. - * - * @return the shared - */ - public Boolean shared() { - return shared; - } - - /** - * Gets the finding. - * - * FindingType provides details about a finding note. - * - * @return the finding - */ - public FindingType finding() { - return finding; - } - - /** - * Gets the kpi. - * - * KpiType provides details about a KPI note. - * - * @return the kpi - */ - public KpiType kpi() { - return kpi; - } - - /** - * Gets the card. - * - * Card provides details about a card kind of note. - * - * @return the card - */ - public Card card() { - return card; - } - - /** - * Gets the section. - * - * Card provides details about a card kind of note. - * - * @return the section - */ - public Section section() { - return section; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java deleted file mode 100644 index 53c73e3a..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java +++ /dev/null @@ -1,445 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.Map; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * The updateOccurrence options. - */ -public class UpdateOccurrenceOptions extends GenericModel { - - /** - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - */ - public interface Kind { - /** FINDING. */ - String FINDING = "FINDING"; - /** KPI. */ - String KPI = "KPI"; - /** CARD. */ - String CARD = "CARD"; - /** CARD_CONFIGURED. */ - String CARD_CONFIGURED = "CARD_CONFIGURED"; - /** SECTION. */ - String SECTION = "SECTION"; - } - - protected String providerId; - protected String occurrenceId; - protected String noteName; - protected String kind; - protected String id; - protected String resourceUrl; - protected String remediation; - protected Context context; - protected Finding finding; - protected Kpi kpi; - protected Map referenceData; - protected String transactionId; - - /** - * Builder. - */ - public static class Builder { - private String providerId; - private String occurrenceId; - private String noteName; - private String kind; - private String id; - private String resourceUrl; - private String remediation; - private Context context; - private Finding finding; - private Kpi kpi; - private Map referenceData; - private String transactionId; - - private Builder(UpdateOccurrenceOptions updateOccurrenceOptions) { - this.providerId = updateOccurrenceOptions.providerId; - this.occurrenceId = updateOccurrenceOptions.occurrenceId; - this.noteName = updateOccurrenceOptions.noteName; - this.kind = updateOccurrenceOptions.kind; - this.id = updateOccurrenceOptions.id; - this.resourceUrl = updateOccurrenceOptions.resourceUrl; - this.remediation = updateOccurrenceOptions.remediation; - this.context = updateOccurrenceOptions.context; - this.finding = updateOccurrenceOptions.finding; - this.kpi = updateOccurrenceOptions.kpi; - this.referenceData = updateOccurrenceOptions.referenceData; - this.transactionId = updateOccurrenceOptions.transactionId; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param providerId the providerId - * @param occurrenceId the occurrenceId - * @param noteName the noteName - * @param kind the kind - * @param id the id - */ - public Builder(String providerId, String occurrenceId, String noteName, String kind, String id) { - this.providerId = providerId; - this.occurrenceId = occurrenceId; - this.noteName = noteName; - this.kind = kind; - this.id = id; - } - - /** - * Builds a UpdateOccurrenceOptions. - * - * @return the new UpdateOccurrenceOptions instance - */ - public UpdateOccurrenceOptions build() { - return new UpdateOccurrenceOptions(this); - } - - /** - * Set the providerId. - * - * @param providerId the providerId - * @return the UpdateOccurrenceOptions builder - */ - public Builder providerId(String providerId) { - this.providerId = providerId; - return this; - } - - /** - * Set the occurrenceId. - * - * @param occurrenceId the occurrenceId - * @return the UpdateOccurrenceOptions builder - */ - public Builder occurrenceId(String occurrenceId) { - this.occurrenceId = occurrenceId; - return this; - } - - /** - * Set the noteName. - * - * @param noteName the noteName - * @return the UpdateOccurrenceOptions builder - */ - public Builder noteName(String noteName) { - this.noteName = noteName; - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the UpdateOccurrenceOptions builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the UpdateOccurrenceOptions builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the resourceUrl. - * - * @param resourceUrl the resourceUrl - * @return the UpdateOccurrenceOptions builder - */ - public Builder resourceUrl(String resourceUrl) { - this.resourceUrl = resourceUrl; - return this; - } - - /** - * Set the remediation. - * - * @param remediation the remediation - * @return the UpdateOccurrenceOptions builder - */ - public Builder remediation(String remediation) { - this.remediation = remediation; - return this; - } - - /** - * Set the context. - * - * @param context the context - * @return the UpdateOccurrenceOptions builder - */ - public Builder context(Context context) { - this.context = context; - return this; - } - - /** - * Set the finding. - * - * @param finding the finding - * @return the UpdateOccurrenceOptions builder - */ - public Builder finding(Finding finding) { - this.finding = finding; - return this; - } - - /** - * Set the kpi. - * - * @param kpi the kpi - * @return the UpdateOccurrenceOptions builder - */ - public Builder kpi(Kpi kpi) { - this.kpi = kpi; - return this; - } - - /** - * Set the referenceData. - * - * @param referenceData the referenceData - * @return the UpdateOccurrenceOptions builder - */ - public Builder referenceData(Map referenceData) { - this.referenceData = referenceData; - return this; - } - - /** - * Set the transactionId. - * - * @param transactionId the transactionId - * @return the UpdateOccurrenceOptions builder - */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; - return this; - } - - /** - * Set the apiOccurrence. - * - * @param apiOccurrence the apiOccurrence - * @return the UpdateOccurrenceOptions builder - */ - public Builder apiOccurrence(ApiOccurrence apiOccurrence) { - this.noteName = apiOccurrence.noteName(); - this.kind = apiOccurrence.kind(); - this.id = apiOccurrence.id(); - this.resourceUrl = apiOccurrence.resourceUrl(); - this.remediation = apiOccurrence.remediation(); - this.context = apiOccurrence.context(); - this.finding = apiOccurrence.finding(); - this.kpi = apiOccurrence.kpi(); - this.referenceData = apiOccurrence.referenceData(); - return this; - } - } - - protected UpdateOccurrenceOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerId, - "providerId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.occurrenceId, - "occurrenceId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.noteName, - "noteName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.id, - "id cannot be null"); - providerId = builder.providerId; - occurrenceId = builder.occurrenceId; - noteName = builder.noteName; - kind = builder.kind; - id = builder.id; - resourceUrl = builder.resourceUrl; - remediation = builder.remediation; - context = builder.context; - finding = builder.finding; - kpi = builder.kpi; - referenceData = builder.referenceData; - transactionId = builder.transactionId; - } - - /** - * New builder. - * - * @return a UpdateOccurrenceOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the providerId. - * - * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. - * - * @return the providerId - */ - public String providerId() { - return providerId; - } - - /** - * Gets the occurrenceId. - * - * Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. - * - * @return the occurrenceId - */ - public String occurrenceId() { - return occurrenceId; - } - - /** - * Gets the noteName. - * - * An analysis note associated with this image, in the form "{account_id}/providers/{provider_id}/notes/{note_id}" - * This field can be used as a filter in list requests. - * - * @return the noteName - */ - public String noteName() { - return noteName; - } - - /** - * Gets the kind. - * - * The type of note. Use this field to filter notes and occurences by kind. - * - FINDING&#58; The note and occurrence represent a finding. - * - KPI&#58; The note and occurrence represent a KPI value. - * - CARD&#58; The note represents a card showing findings and related metric values. - * - CARD_CONFIGURED&#58; The note represents a card configured for a user account. - * - SECTION&#58; The note represents a section in a dashboard. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the id. - * - * The id of the occurrence. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the resourceUrl. - * - * The unique URL of the resource, image or the container, for which the `Occurrence` applies. For example, - * https://gcr.io/provider/image@sha256:foo. This field can be used as a filter in list requests. - * - * @return the resourceUrl - */ - public String resourceUrl() { - return resourceUrl; - } - - /** - * Gets the remediation. - * - * A description of actions that can be taken to remedy the `Note`. - * - * @return the remediation - */ - public String remediation() { - return remediation; - } - - /** - * Gets the context. - * - * @return the context - */ - public Context context() { - return context; - } - - /** - * Gets the finding. - * - * Finding provides details about a finding occurrence. - * - * @return the finding - */ - public Finding finding() { - return finding; - } - - /** - * Gets the kpi. - * - * Kpi provides details about a KPI occurrence. - * - * @return the kpi - */ - public Kpi kpi() { - return kpi; - } - - /** - * Gets the referenceData. - * - * Additional data for the finding, like AT event etc. - * - * @return the referenceData - */ - public Map referenceData() { - return referenceData; - } - - /** - * Gets the transactionId. - * - * The transaction ID for the request in UUID v4 format. - * - * @return the transactionId - */ - public String transactionId() { - return transactionId; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueType.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueType.java deleted file mode 100644 index 7e2e2497..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueType.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.List; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * the value type of a card element. - * - * Classes which extend this class: - * - ValueTypeKpiValueType - * - ValueTypeFindingCountValueType - */ -public class ValueType extends GenericModel { - @SuppressWarnings("unused") - protected static String discriminatorPropertyName = "kind"; - protected static java.util.Map> discriminatorMapping; - static { - discriminatorMapping = new java.util.HashMap<>(); - discriminatorMapping.put("KPI", ValueTypeKpiValueType.class); - discriminatorMapping.put("FINDING_COUNT", ValueTypeFindingCountValueType.class); - } - - /** - * Kind of element - * - KPI&#58; Kind of value derived from a KPI occurrence. - */ - public interface Kind { - /** KPI. */ - String KPI = "KPI"; - } - - protected String kind; - @SerializedName("kpi_note_name") - protected String kpiNoteName; - protected String text; - @SerializedName("finding_note_names") - protected List findingNoteNames; - - protected ValueType() { - } - - /** - * Gets the kind. - * - * Kind of element - * - KPI&#58; Kind of value derived from a KPI occurrence. - * - * @return the kind - */ - public String kind() { - return kind; - } - - /** - * Gets the kpiNoteName. - * - * The name of the kpi note associated to the occurrence with the value for this card element value type. - * - * @return the kpiNoteName - */ - public String kpiNoteName() { - return kpiNoteName; - } - - /** - * Gets the text. - * - * The text of this element type. - * - * @return the text - */ - public String text() { - return text; - } - - /** - * Gets the findingNoteNames. - * - * the names of the finding note associated that act as filters for counting the occurrences. - * - * @return the findingNoteNames - */ - public List findingNoteNames() { - return findingNoteNames; - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeFindingCountValueType.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeFindingCountValueType.java deleted file mode 100644 index 1ba7ddf0..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeFindingCountValueType.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * ValueTypeFindingCountValueType. - */ -public class ValueTypeFindingCountValueType extends ValueType { - - /** - * Kind of element - FINDING_COUNT&#58; Kind of value derived from a count of finding occurrences. - */ - public interface Kind { - /** FINDING_COUNT. */ - String FINDING_COUNT = "FINDING_COUNT"; - } - - - /** - * Builder. - */ - public static class Builder { - private String kind; - private List findingNoteNames; - private String text; - - public Builder(ValueType valueTypeFindingCountValueType) { - this.kind = valueTypeFindingCountValueType.kind; - this.findingNoteNames = valueTypeFindingCountValueType.findingNoteNames; - this.text = valueTypeFindingCountValueType.text; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param kind the kind - * @param findingNoteNames the findingNoteNames - * @param text the text - */ - public Builder(String kind, List findingNoteNames, String text) { - this.kind = kind; - this.findingNoteNames = findingNoteNames; - this.text = text; - } - - /** - * Builds a ValueTypeFindingCountValueType. - * - * @return the new ValueTypeFindingCountValueType instance - */ - public ValueTypeFindingCountValueType build() { - return new ValueTypeFindingCountValueType(this); - } - - /** - * Adds an findingNoteNames to findingNoteNames. - * - * @param findingNoteNames the new findingNoteNames - * @return the ValueTypeFindingCountValueType builder - */ - public Builder addFindingNoteNames(String findingNoteNames) { - com.ibm.cloud.sdk.core.util.Validator.notNull(findingNoteNames, - "findingNoteNames cannot be null"); - if (this.findingNoteNames == null) { - this.findingNoteNames = new ArrayList(); - } - this.findingNoteNames.add(findingNoteNames); - return this; - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the ValueTypeFindingCountValueType builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the findingNoteNames. - * Existing findingNoteNames will be replaced. - * - * @param findingNoteNames the findingNoteNames - * @return the ValueTypeFindingCountValueType builder - */ - public Builder findingNoteNames(List findingNoteNames) { - this.findingNoteNames = findingNoteNames; - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the ValueTypeFindingCountValueType builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - } - - protected ValueTypeFindingCountValueType(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.findingNoteNames, - "findingNoteNames cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - kind = builder.kind; - findingNoteNames = builder.findingNoteNames; - text = builder.text; - } - - /** - * New builder. - * - * @return a ValueTypeFindingCountValueType builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeKpiValueType.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeKpiValueType.java deleted file mode 100644 index 3d44f00a..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/ValueTypeKpiValueType.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.model; - -/** - * ValueTypeKpiValueType. - */ -public class ValueTypeKpiValueType extends ValueType { - - /** - * Kind of element - * - KPI&#58; Kind of value derived from a KPI occurrence. - */ - public interface Kind { - /** KPI. */ - String KPI = "KPI"; - } - - - /** - * Builder. - */ - public static class Builder { - private String kind; - private String kpiNoteName; - private String text; - - public Builder(ValueType valueTypeKpiValueType) { - this.kind = valueTypeKpiValueType.kind; - this.kpiNoteName = valueTypeKpiValueType.kpiNoteName; - this.text = valueTypeKpiValueType.text; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param kind the kind - * @param kpiNoteName the kpiNoteName - * @param text the text - */ - public Builder(String kind, String kpiNoteName, String text) { - this.kind = kind; - this.kpiNoteName = kpiNoteName; - this.text = text; - } - - /** - * Builds a ValueTypeKpiValueType. - * - * @return the new ValueTypeKpiValueType instance - */ - public ValueTypeKpiValueType build() { - return new ValueTypeKpiValueType(this); - } - - /** - * Set the kind. - * - * @param kind the kind - * @return the ValueTypeKpiValueType builder - */ - public Builder kind(String kind) { - this.kind = kind; - return this; - } - - /** - * Set the kpiNoteName. - * - * @param kpiNoteName the kpiNoteName - * @return the ValueTypeKpiValueType builder - */ - public Builder kpiNoteName(String kpiNoteName) { - this.kpiNoteName = kpiNoteName; - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the ValueTypeKpiValueType builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - } - - protected ValueTypeKpiValueType(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kind, - "kind cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.kpiNoteName, - "kpiNoteName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, - "text cannot be null"); - kind = builder.kind; - kpiNoteName = builder.kpiNoteName; - text = builder.text; - } - - /** - * New builder. - * - * @return a ValueTypeKpiValueType builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} - diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/utils/TestUtilities.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/utils/TestUtilities.java deleted file mode 100644 index 68adcb70..00000000 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/utils/TestUtilities.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.cloud.scc.findings.v1.utils; - -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 bytes) { - return bytes.getBytes(); - } - - 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 4e889f04..512934a0 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,6 @@ modules/configuration-governance - modules/findings modules/coverage-reports