From a80ecca703a5efc039c1ca996261f57280970948 Mon Sep 17 00:00:00 2001 From: Pavan K Manda Date: Tue, 29 Aug 2023 10:16:21 +0530 Subject: [PATCH] commit_3: modify generated code Signed-off-by: Pavan K Manda --- .bumpversion.cfg | 10 +- .github/workflows/main.yaml | 37 +- README.md | 6 +- build/publishCodeCoverage.sh | 4 +- build/testScript.sh | 4 +- ...ecurityAndComplianceCenterApiExamples.java | 1249 +++++++++-------- .../v3/SecurityAndComplianceCenterApi.java | 334 +++-- .../v3/model/ControlSpecifications.java | 26 +- .../v3/model/CreateAttachmentOptions.java | 57 +- .../CreateProviderTypeInstanceOptions.java | 10 +- .../v3/model/CreateRuleOptions.java | 46 +- .../v3/model/DeleteCustomProfileOptions.java | 34 +- .../model/DeleteProfileAttachmentOptions.java | 34 +- .../v3/model/GetProfileAttachmentOptions.java | 34 +- .../v3/model/GetProfileOptions.java | 34 +- .../v3/model/ListAttachmentsOptions.java | 34 +- .../model/ListReportEvaluationsOptions.java | 52 + .../v3/model/ProfileCollection.java | 2 +- .../model/ProviderTypeInstanceAttributes.java | 27 + .../v3/model/ProviderTypeInstanceItem.java | 5 +- .../ReplaceProfileAttachmentOptions.java | 58 +- .../v3/model/ReplaceProfileOptions.java | 34 +- .../v3/model/ReplaceRuleOptions.java | 46 +- .../v3/model/RequiredConfig.java | 4 +- ...dConfigAnd.java => RequiredConfigAnd.java} | 34 +- .../v3/model/RequiredConfigBase.java | 237 ++++ .../v3/model/RequiredConfigItems.java | 12 +- ...edConfigItemsRequiredConfigAndDepth1.java} | 42 +- ...redConfigItemsRequiredConfigOrDepth1.java} | 40 +- ...redConfigOr.java => RequiredConfigOr.java} | 32 +- .../v3/model/Target.java | 140 +- .../v3/model/TargetPrototype.java | 183 +++ .../UpdateProviderTypeInstanceOptions.java | 60 +- .../UpdateProviderTypeInstanceRequest.java | 55 + ...nstancePrototypeForPatchingAttributes.java | 91 ++ ...rTypeInstancePrototypeForPatchingName.java | 89 ++ .../v3/SecurityAndComplianceCenterApiIT.java | 264 ++-- .../SecurityAndComplianceCenterApiTest.java | 316 +++-- .../v3/model/ControlLibraryTest.java | 4 +- .../v3/model/ControlSpecificationsTest.java | 6 +- .../v3/model/ControlsInControlLibTest.java | 4 +- .../v3/model/CreateAttachmentOptionsTest.java | 2 - ...CreateCustomControlLibraryOptionsTest.java | 4 +- .../v3/model/CreateRuleOptionsTest.java | 40 +- .../model/DeleteCustomProfileOptionsTest.java | 4 +- .../DeleteProfileAttachmentOptionsTest.java | 4 +- .../v3/model/EventNotificationsTest.java | 12 +- .../GetProfileAttachmentOptionsTest.java | 4 +- .../v3/model/GetProfileOptionsTest.java | 4 +- .../v3/model/ListAttachmentsOptionsTest.java | 4 +- .../ListReportEvaluationsOptionsTest.java | 4 + ...> ProviderTypeInstanceAttributesTest.java} | 20 +- .../model/ProviderTypeInstanceItemTest.java | 1 + .../ProviderTypeInstancesResponseTest.java | 1 + .../ProviderTypesInstancesResponseTest.java | 1 + ...eplaceCustomControlLibraryOptionsTest.java | 4 +- .../ReplaceProfileAttachmentOptionsTest.java | 2 - .../v3/model/ReplaceProfileOptionsTest.java | 3 +- .../v3/model/ReplaceRuleOptionsTest.java | 40 +- .../v3/model/RequiredConfigAndTest.java | 67 + .../v3/model/RequiredConfigBaseTest.java | 60 + ...onfigItemsRequiredConfigAndDepth1Test.java | 59 + ...ConfigItemsRequiredConfigOrDepth1Test.java | 59 + .../v3/model/RequiredConfigItemsTest.java | 1 + .../v3/model/RequiredConfigOrTest.java | 67 + .../RequiredConfigRequiredConfigAndTest.java | 53 - .../RequiredConfigRequiredConfigOrTest.java | 53 - .../v3/model/RequiredConfigTest.java | 3 +- .../v3/model/RuleTest.java | 5 +- .../v3/model/RulesPageBaseTest.java | 5 +- .../v3/model/SettingsTest.java | 8 +- .../v3/model/TargetPrototypeTest.java | 66 + .../v3/model/TargetTest.java | 38 +- ...UpdateProviderTypeInstanceOptionsTest.java | 12 +- ...ncePrototypeForPatchingAttributesTest.java | 51 + ...eInstancePrototypeForPatchingNameTest.java | 51 + ...pdateProviderTypeInstanceRequestTest.java} | 21 +- .../v3/model/UpdateSettingsOptionsTest.java | 8 +- 78 files changed, 2739 insertions(+), 1892 deletions(-) create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributes.java rename modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{RequiredConfigRequiredConfigAnd.java => RequiredConfigAnd.java} (67%) create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigBase.java rename modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{RequiredConfigItemsRequiredConfigAnd.java => RequiredConfigItemsRequiredConfigAndDepth1.java} (58%) rename modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{RequiredConfigItemsRequiredConfigOr.java => RequiredConfigItemsRequiredConfigOrDepth1.java} (60%) rename modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{RequiredConfigRequiredConfigOr.java => RequiredConfigOr.java} (68%) create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototype.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequest.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.java rename modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{RequiredConfigItemsRequiredConfigOrTest.java => ProviderTypeInstanceAttributesTest.java} (56%) create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAndTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigBaseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndDepth1Test.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrDepth1Test.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOrTest.java delete mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigAndTest.java delete mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigOrTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototypeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameTest.java rename modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{RequiredConfigItemsRequiredConfigAndTest.java => UpdateProviderTypeInstanceRequestTest.java} (55%) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b34fb7ef..a8a3d7d0 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.0.0 +current_version = 4.0.0 commit = True message = Update version {current_version} -> {new_version} @@ -19,10 +19,6 @@ replace = {new_version} search = {current_version} replace = {new_version} -[bumpversion:file:modules/configuration-governance/pom.xml] +[bumpversion:file:modules/security-and-compliance-center-api/pom.xml] search = {current_version} -replace = {new_version} - -[bumpversion:file:modules/examples/pom.xml] -search = {current_version} -replace = {new_version} +replace = {new_version} \ No newline at end of file diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ccb1704a..a84c6ae3 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,5 +1,9 @@ name: CI/CD Pipeline -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: [main] + pull_request: + workflow_dispatch: jobs: verify: @@ -46,9 +50,8 @@ jobs: - name: running integration tests env: - ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }} - CONFIGURATION_GOVERNANCE_ENV: ${{ secrets.CONFIGURATION_GOVERNANCE_ENV }} - RESOURCE_GROUP_ID: ${{ secrets.RESOURCE_GROUP_ID }} + SCC_ENV: ${{ secrets.SCC_ENV }} + SECURITY_AND_COMPLIANCE_CENTER_API_IAM_PROFILE_ID: ${{ secrets.SCC_IAM_PROFILE_ID }} run: build/testScript.sh release: @@ -62,7 +65,12 @@ jobs: - name: setting up nodejs uses: actions/setup-node@v2 with: - node-version: '16' + node-version: '18' + + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 - name: releasing using semantic-release env: @@ -72,13 +80,13 @@ jobs: GIT_COMMITTER_NAME: sccdeveloper GIT_COMMITTER_EMAIL: scccomm@in.ibm.com run: | - sudo apt-get update - sudo apt-get install python pip install --user bumpversion npm install @semantic-release/changelog npm install @semantic-release/exec npm install @semantic-release/git npm install @semantic-release/github + rm -rf package.json + rm -rf package-lock.json npx semantic-release publish: @@ -134,10 +142,17 @@ jobs: run: build/prepareJavadoc.sh - name: deploying javadocs to gh-pages - uses: crazy-max/ghaction-github-pages@v1 - with: - target_branch: gh-pages - build_dir: javadocs + run: | + git config --global user.email "scccomm@in.ibm.com" + git config --global user.name "sccdeveloper" + git config --global user.password "${{ secrets.ADMIN_TOKEN }}" + cd v4/dist + git init + git add . + git commit -m "Deploy to GitHub pages" + git branch -m gh-pages + git remote add origin https://github.com/IBM/scc-java-sdk + git push -f origin gh-pages env: GITHUB_TOKEN: ${{ secrets.ADMIN_TOKEN }} GIT_AUTHOR_NAME: sccdeveloper diff --git a/README.md b/README.md index 80de59b8..bfac38f7 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Maven Central](https://img.shields.io/maven-central/v/com.ibm.cloud/scc.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.ibm.cloud%22%20AND%20a:%22scc%22) # IBM Cloud Security & Compliance Center Java SDK Version 3.0.0 -Java client library to interact with various [IBM Cloud Security & Compliance Center](https://cloud.ibm.com/docs?tab=api-docs&category=platform_services%2Csecurity). +Java client library to interact with various [IBM Cloud Security & Compliance Center](https://cloud.ibm.com/apidocs/security-compliance?code=java). Disclaimer: this SDK is being released initially as a **pre-release** version. Changes might occur which impact applications that use this SDK. @@ -46,7 +46,7 @@ The IBM Cloud Security & Compliance Center Java SDK allows developers to program Service Name | Imported Class Name --- | --- -[ConfigurationGovernanceApi](https://cloud.ibm.com/apidocs/security-compliance/config) | ConfigurationGovernanceApi:3.0.0 +[Security and Compliance Center](https://cloud.ibm.com/apidocs/security-compliance) | SecurityAndComplianceCenterApi:3.0.0 ## Prerequisites @@ -108,4 +108,4 @@ See [CONTRIBUTING](CONTRIBUTING.md). ## License The IBM Cloud MySDK Java SDK is released under the Apache 2.0 license. -The license's full text can be found in [LICENSE](LICENSE). +The license's full text can be found in [LICENSE](LICENSE). \ No newline at end of file diff --git a/build/publishCodeCoverage.sh b/build/publishCodeCoverage.sh index a04c28ee..c0ccfacf 100755 --- a/build/publishCodeCoverage.sh +++ b/build/publishCodeCoverage.sh @@ -6,8 +6,8 @@ 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/security-and-compliance-center-api/src/main/java ./cc-test-reporter format-coverage modules/security-and-compliance-center-api/target/site/jacoco/jacoco.xml -d -o security-and-compliance-center-api.json -t jacoco -./cc-test-reporter sum-coverage common.json configuration-governance.json -o coverage.json -d +./cc-test-reporter sum-coverage common.json security-and-compliance-center-api.json -o coverage.json -d ./cc-test-reporter upload-coverage --input coverage.json diff --git a/build/testScript.sh b/build/testScript.sh index 8c62e7b5..6c9a6221 100755 --- a/build/testScript.sh +++ b/build/testScript.sh @@ -1,7 +1,5 @@ #!/bin/bash set -euo pipefail - -curl https://us-south.functions.appdomain.cloud/api/v1/web/e6b54af6-ab44-4149-a8e4-e906dcc58136/default/secadvstg-location-shift.json -echo "${CONFIGURATION_GOVERNANCE_ENV}" | base64 -d >> configuration_governance_v1.env +echo "${SCC_ENV}" | base64 -d >> security_and_compliance_center_api_v3.env mvn clean verify diff --git a/examples/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiExamples.java b/examples/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiExamples.java index 7f74754d..38fe6e49 100644 --- a/examples/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiExamples.java +++ b/examples/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiExamples.java @@ -103,17 +103,18 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportTags; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportViolationsDrift; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportsPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigAnd; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigBase; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigAnd; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Resource; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Rule; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RulesPageBase; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Scan; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Settings; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Target; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.model.TestEvent; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSettingsOptions; import java.io.InputStream; import java.util.ArrayList; @@ -173,446 +174,252 @@ public static void main(String[] args) throws Exception { String reportIdForReportLink = null; String ruleIdLink = null; String typeForReportLink = null; + String xCorrelationIdLink = null; try { - System.out.println("getSettings() result:"); - // begin-get_settings - GetSettingsOptions getSettingsOptions = new GetSettingsOptions.Builder() - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") - .build(); - - Response response = securityAndComplianceCenterApiService.getSettings(getSettingsOptions).execute(); - Settings settings = response.getResult(); - - System.out.println(settings); - // end-get_settings - - eventNotificationsCrnForUpdateSettingsLink = settings.eventNotifications().instanceCrn(); - objectStorageCrnForUpdateSettingsLink = settings.objectStorage().instanceCrn(); - objectStorageBucketForUpdateSettingsLink = settings.objectStorage().bucket(); - objectStorageLocationForUpdateSettingsLink = settings.objectStorage().bucketLocation(); - } 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("createRule() result:"); - // begin-create_rule - AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() - .name("location") - .operator("string_equals") - .value("us-east") - .build(); - Target targetModel = new Target.Builder() - .serviceName("cloud-object-storage") - .resourceKind("bucket") - .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) - .build(); - RequiredConfigItemsRequiredConfigBase requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigBase.Builder() - .property("hard_quota") - .operator("num_equals") - .value("${hard_quota}") - .build(); - RequiredConfigRequiredConfigAnd requiredConfigModel = new RequiredConfigRequiredConfigAnd.Builder() - .description("The Cloud Object Storage rule.") - .and(java.util.Arrays.asList(requiredConfigItemsModel)) - .build(); - Parameter parameterModel = new Parameter.Builder() - .name("hard_quota") - .displayName("The Cloud Object Storage bucket quota.") - .description("The maximum bytes that are allocated to the Cloud Object Storage bucket.") - .type("numeric") - .build(); - Import importModel = new Import.Builder() - .parameters(java.util.Arrays.asList(parameterModel)) - .build(); - CreateRuleOptions createRuleOptions = new CreateRuleOptions.Builder() - .description("Example rule") - .target(targetModel) - .requiredConfig(requiredConfigModel) - .version("1.0.0") - .xImport(importModel) - .labels(java.util.Arrays.asList()) - .build(); - - Response response = securityAndComplianceCenterApiService.createRule(createRuleOptions).execute(); - Rule rule = response.getResult(); - - System.out.println(rule); - // end-create_rule - - ruleIdLink = rule.getId(); - } 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("getRule() result:"); - // begin-get_rule - GetRuleOptions getRuleOptions = new GetRuleOptions.Builder() - .ruleId(ruleIdLink) - .build(); - - Response response = securityAndComplianceCenterApiService.getRule(getRuleOptions).execute(); - Rule rule = response.getResult(); - - System.out.println(rule); - // end-get_rule - - eTagLink = response.getHeaders().values("ETag").get(0); - } 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("getLatestReports() result:"); - // begin-get_latest_reports - GetLatestReportsOptions getLatestReportsOptions = new GetLatestReportsOptions.Builder() - .sort("profile_name") + System.out.println("getReportViolationsDrift() result:"); + // begin-get_report_violations_drift + GetReportViolationsDriftOptions getReportViolationsDriftOptions = new GetReportViolationsDriftOptions.Builder() + .reportId(reportIdForReportLink) .build(); - Response response = securityAndComplianceCenterApiService.getLatestReports(getLatestReportsOptions).execute(); - ReportLatest reportLatest = response.getResult(); + Response response = securityAndComplianceCenterApiService.getReportViolationsDrift(getReportViolationsDriftOptions).execute(); + ReportViolationsDrift reportViolationsDrift = response.getResult(); - System.out.println(reportLatest); - // end-get_latest_reports + System.out.println(reportViolationsDrift); + // end-get_report_violations_drift - accountIdForReportLink = reportLatest.getReports().get(0).getAccount().getId(); - reportIdForReportLink = reportLatest.getReports().get(0).getId(); - attachmentIdForReportLink = reportLatest.getReports().get(0).getAttachment().getId(); - groupIdForReportLink = reportLatest.getReports().get(0).getGroupId(); - profileIdForReportLink = reportLatest.getReports().get(0).getProfile().getId(); - typeForReportLink = reportLatest.getReports().get(0).getType(); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } 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("updateSettings() result:"); - // begin-update_settings - EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .instanceCrn(eventNotificationsCrnForUpdateSettingsLink) - .sourceDescription("This source is used for integration with IBM Cloud Security and Compliance Center.") - .sourceName("compliance") - .build(); - ObjectStorage objectStorageModel = new ObjectStorage.Builder() - .instanceCrn(objectStorageCrnForUpdateSettingsLink) - .bucket(objectStorageBucketForUpdateSettingsLink) - .bucketLocation(objectStorageLocationForUpdateSettingsLink) - .build(); - UpdateSettingsOptions updateSettingsOptions = new UpdateSettingsOptions.Builder() - .eventNotifications(eventNotificationsModel) - .objectStorage(objectStorageModel) - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") + System.out.println("getReportTags() result:"); + // begin-get_report_tags + GetReportTagsOptions getReportTagsOptions = new GetReportTagsOptions.Builder() + .reportId(reportIdForReportLink) .build(); - Response response = securityAndComplianceCenterApiService.updateSettings(updateSettingsOptions).execute(); - Settings settings = response.getResult(); - - System.out.println(settings); - // end-update_settings - } 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("postTestEvent() result:"); - // begin-post_test_event - PostTestEventOptions postTestEventOptions = new PostTestEventOptions.Builder() - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") - .build(); + Response response = securityAndComplianceCenterApiService.getReportTags(getReportTagsOptions).execute(); + ReportTags reportTags = response.getResult(); - Response response = securityAndComplianceCenterApiService.postTestEvent(postTestEventOptions).execute(); - TestEvent testEvent = response.getResult(); + System.out.println(reportTags); + // end-get_report_tags - System.out.println(testEvent); - // end-post_test_event + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } 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("createCustomControlLibrary() result:"); - // begin-create_custom_control_library - ParameterInfo parameterInfoModel = new ParameterInfo.Builder() - .parameterName("session_invalidation_in_seconds") - .parameterDisplayName("Sign out due to inactivity in seconds") - .parameterType("numeric") - .build(); - Implementation implementationModel = new Implementation.Builder() - .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") - .assessmentMethod("ibm-cloud-rule") - .assessmentType("automated") - .assessmentDescription("Check that there is an Activity Tracker event route defined to collect global events generated by IBM Cloud services") - .parameters(java.util.Arrays.asList(parameterInfoModel)) - .build(); - ControlSpecifications controlSpecificationsModel = new ControlSpecifications.Builder() - .controlSpecificationId("5c7d6f88-a92f-4734-9b49-bd22b0900184") - .componentId("iam-identity") - .environment("ibm-cloud") - .controlSpecificationDescription("IBM cloud") - .assessments(java.util.Arrays.asList(implementationModel)) - .build(); - ControlDocs controlDocsModel = new ControlDocs.Builder() - .controlDocsId("sc-7") - .controlDocsType("ibm-cloud") - .build(); - ControlsInControlLib controlsInControlLibModel = new ControlsInControlLib.Builder() - .controlName("SC-7") - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") - .controlDescription("Boundary Protection") - .controlCategory("System and Communications Protection") - .controlTags(java.util.Arrays.asList("1fa45e17-9322-4e6c-bbd6-1c51db08e790")) - .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) - .controlDocs(controlDocsModel) - .controlRequirement(true) - .build(); - CreateCustomControlLibraryOptions createCustomControlLibraryOptions = new CreateCustomControlLibraryOptions.Builder() - .controlLibraryName("IBM Cloud for Financial Services") - .controlLibraryDescription("IBM Cloud for Financial Services") - .controlLibraryType("custom") - .controls(java.util.Arrays.asList(controlsInControlLibModel)) - .versionGroupLabel("33fc7b80-0fa5-4f16-bbba-1f293f660f0d") - .controlLibraryVersion("1.0.0") + System.out.println("listReportResources() result:"); + // begin-list_report_resources + ListReportResourcesOptions listReportResourcesOptions = new ListReportResourcesOptions.Builder() + .reportId(reportIdForReportLink) + .xCorrelationId(xCorrelationIdLink) + .xRequestId("testString") + .id("testString") + .resourceName("testString") + .accountId(accountIdForReportLink) + .componentId("testString") + .status("compliant") + .sort("account_id") + .limit(Long.valueOf("10")) .build(); - Response response = securityAndComplianceCenterApiService.createCustomControlLibrary(createCustomControlLibraryOptions).execute(); - ControlLibrary controlLibrary = response.getResult(); - - System.out.println(controlLibrary); - // end-create_custom_control_library + ReportResourcesPager pager = new ReportResourcesPager(securityAndComplianceCenterApiService, listReportResourcesOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } - controlLibraryIdLink = controlLibrary.id(); + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // end-list_report_resources } 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("listControlLibraries() result:"); - // begin-list_control_libraries - ListControlLibrariesOptions listControlLibrariesOptions = new ListControlLibrariesOptions.Builder() - .xCorrelationId("testString") + System.out.println("listReportEvaluations() result:"); + // begin-list_report_evaluations + ListReportEvaluationsOptions listReportEvaluationsOptions = new ListReportEvaluationsOptions.Builder() + .reportId(reportIdForReportLink) + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") - .limit(Long.valueOf("50")) - .controlLibraryType("custom") + .assessmentId("testString") + .assessmentMethod("testString") + .componentId("testString") + .targetId("testString") + .targetEnv("testString") + .targetName("testString") + .status("failure") + .limit(Long.valueOf("10")) .build(); - ControlLibrariesPager pager = new ControlLibrariesPager(securityAndComplianceCenterApiService, listControlLibrariesOptions); - List allResults = new ArrayList<>(); + ReportEvaluationsPager pager = new ReportEvaluationsPager(securityAndComplianceCenterApiService, listReportEvaluationsOptions); + List allResults = new ArrayList<>(); while (pager.hasNext()) { - List nextPage = pager.getNext(); + List nextPage = pager.getNext(); allResults.addAll(nextPage); } System.out.println(GsonSingleton.getGson().toJson(allResults)); - // end-list_control_libraries + // end-list_report_evaluations } 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("getControlLibrary() result:"); - // begin-get_control_library - GetControlLibraryOptions getControlLibraryOptions = new GetControlLibraryOptions.Builder() - .controlLibrariesId(controlLibraryIdLink) + System.out.println("getReportRule() result:"); + // begin-get_report_rule + GetReportRuleOptions getReportRuleOptions = new GetReportRuleOptions.Builder() + .reportId(reportIdForReportLink) + .ruleId("rule-8d444f8c-fd1d-48de-bcaa-f43732568761") .build(); - Response response = securityAndComplianceCenterApiService.getControlLibrary(getControlLibraryOptions).execute(); - ControlLibrary controlLibrary = response.getResult(); - - System.out.println(controlLibrary); - // end-get_control_library - } 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("replaceCustomControlLibrary() result:"); - // begin-replace_custom_control_library - ParameterInfo parameterInfoModel = new ParameterInfo.Builder() - .parameterName("session_invalidation_in_seconds") - .parameterDisplayName("Sign out due to inactivity in seconds") - .parameterType("numeric") - .build(); - Implementation implementationModel = new Implementation.Builder() - .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") - .assessmentMethod("ibm-cloud-rule") - .assessmentType("automated") - .assessmentDescription("Check that there is an Activity Tracker event route defined to collect global events generated by IBM Cloud services") - .parameters(java.util.Arrays.asList(parameterInfoModel)) - .build(); - ControlSpecifications controlSpecificationsModel = new ControlSpecifications.Builder() - .controlSpecificationId("5c7d6f88-a92f-4734-9b49-bd22b0900184") - .responsibility("user") - .componentId("iam-identity") - .environment("ibm-cloud") - .controlSpecificationDescription("IBM cloud") - .assessments(java.util.Arrays.asList(implementationModel)) - .build(); - ControlDocs controlDocsModel = new ControlDocs.Builder() - .controlDocsId("sc-7") - .controlDocsType("ibm-cloud") - .build(); - ControlsInControlLib controlsInControlLibModel = new ControlsInControlLib.Builder() - .controlName("SC-7") - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") - .controlDescription("Boundary Protection") - .controlCategory("System and Communications Protection") - .controlTags(java.util.Arrays.asList("1fa45e17-9322-4e6c-bbd6-1c51db08e790")) - .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) - .controlDocs(controlDocsModel) - .controlRequirement(true) - .build(); - ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptions = new ReplaceCustomControlLibraryOptions.Builder() - .controlLibrariesId(controlLibraryIdLink) - .controlLibraryName("IBM Cloud for Financial Services") - .controlLibraryDescription("IBM Cloud for Financial Services") - .controlLibraryType("custom") - .controlLibraryVersion("1.1.0") - .controls(java.util.Arrays.asList(controlsInControlLibModel)) - .build(); + Response response = securityAndComplianceCenterApiService.getReportRule(getReportRuleOptions).execute(); + RuleInfo ruleInfo = response.getResult(); - Response response = securityAndComplianceCenterApiService.replaceCustomControlLibrary(replaceCustomControlLibraryOptions).execute(); - ControlLibrary controlLibrary = response.getResult(); + System.out.println(ruleInfo); + // end-get_report_rule - System.out.println(controlLibrary); - // end-replace_custom_control_library + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } 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("createProfile() result:"); - // begin-create_profile - ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() - .controlLibraryId(controlLibraryIdLink) - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") - .build(); - DefaultParametersPrototype defaultParametersPrototypeModel = new DefaultParametersPrototype.Builder() - .assessmentType("Automated") - .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") - .parameterName("session_invalidation_in_seconds") - .parameterDefaultValue("120") - .parameterDisplayName("Sign out due to inactivity in seconds") - .parameterType("numeric") - .build(); - CreateProfileOptions createProfileOptions = new CreateProfileOptions.Builder() - .profileName("test_profile1") - .profileDescription("test_description1") - .profileType("custom") - .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) - .defaultParameters(java.util.Arrays.asList(defaultParametersPrototypeModel)) + System.out.println("getReportControls() result:"); + // begin-get_report_controls + GetReportControlsOptions getReportControlsOptions = new GetReportControlsOptions.Builder() + .reportId(reportIdForReportLink) + .status("compliant") .build(); - Response response = securityAndComplianceCenterApiService.createProfile(createProfileOptions).execute(); - Profile profile = response.getResult(); + Response response = securityAndComplianceCenterApiService.getReportControls(getReportControlsOptions).execute(); + ReportControls reportControls = response.getResult(); - System.out.println(profile); - // end-create_profile + System.out.println(reportControls); + // end-get_report_controls - profileIdLink = profile.getId(); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } 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("listProfiles() result:"); - // begin-list_profiles - ListProfilesOptions listProfilesOptions = new ListProfilesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) - .profileType("custom") + System.out.println("getReportEvaluation() result:"); + // begin-get_report_evaluation + GetReportEvaluationOptions getReportEvaluationOptions = new GetReportEvaluationOptions.Builder() + .reportId(reportIdForReportLink) .build(); - ProfilesPager pager = new ProfilesPager(securityAndComplianceCenterApiService, listProfilesOptions); - List allResults = new ArrayList<>(); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - allResults.addAll(nextPage); - } + Response response = securityAndComplianceCenterApiService.getReportEvaluation(getReportEvaluationOptions).execute(); + InputStream inputStream = response.getResult(); - System.out.println(GsonSingleton.getGson().toJson(allResults)); - // end-list_profiles + System.out.println(inputStream); + // end-get_report_evaluation + + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } 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("getProfile() result:"); - // begin-get_profile - GetProfileOptions getProfileOptions = new GetProfileOptions.Builder() - .profilesId(profileIdLink) + System.out.println("getReportSummary() result:"); + // begin-get_report_summary + GetReportSummaryOptions getReportSummaryOptions = new GetReportSummaryOptions.Builder() + .reportId(reportIdForReportLink) .build(); - Response response = securityAndComplianceCenterApiService.getProfile(getProfileOptions).execute(); - Profile profile = response.getResult(); + Response response = securityAndComplianceCenterApiService.getReportSummary(getReportSummaryOptions).execute(); + ReportSummary reportSummary = response.getResult(); - System.out.println(profile); - // end-get_profile + System.out.println(reportSummary); + // end-get_report_summary + + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } 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("replaceProfile() result:"); - // begin-replace_profile - ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() - .controlLibraryId(controlLibraryIdLink) - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") - .build(); - DefaultParametersPrototype defaultParametersPrototypeModel = new DefaultParametersPrototype.Builder() - .assessmentType("Automated") - .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") - .parameterName("session_invalidation_in_seconds") - .parameterDefaultValue("120") - .parameterDisplayName("Sign out due to inactivity in seconds") - .parameterType("numeric") + System.out.println("getReport() result:"); + // begin-get_report + GetReportOptions getReportOptions = new GetReportOptions.Builder() + .reportId(reportIdForReportLink) .build(); - ReplaceProfileOptions replaceProfileOptions = new ReplaceProfileOptions.Builder() - .profilesId(profileIdLink) - .profileName("test_profile1") - .profileDescription("test_description1") - .profileType("custom") - .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) - .defaultParameters(java.util.Arrays.asList(defaultParametersPrototypeModel)) + + Response response = securityAndComplianceCenterApiService.getReport(getReportOptions).execute(); + Report report = response.getResult(); + + System.out.println(report); + // end-get_report + + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); + } 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("listReports() result:"); + // begin-list_reports + ListReportsOptions listReportsOptions = new ListReportsOptions.Builder() + .xCorrelationId(xCorrelationIdLink) + .xRequestId("testString") + .attachmentId(attachmentIdForReportLink) + .groupId(groupIdForReportLink) + .profileId(profileIdForReportLink) + .type(typeForReportLink) + .limit(Long.valueOf("10")) + .sort("profile_name") .build(); - Response response = securityAndComplianceCenterApiService.replaceProfile(replaceProfileOptions).execute(); - Profile profile = response.getResult(); + ReportsPager pager = new ReportsPager(securityAndComplianceCenterApiService, listReportsOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } - System.out.println(profile); - // end-replace_profile + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // end-list_reports } 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("listRules() result:"); - // begin-list_rules - ListRulesOptions listRulesOptions = new ListRulesOptions.Builder() - .type("system_defined") + System.out.println("getLatestReports() result:"); + // begin-get_latest_reports + GetLatestReportsOptions getLatestReportsOptions = new GetLatestReportsOptions.Builder() + .sort("profile_name") .build(); - Response response = securityAndComplianceCenterApiService.listRules(listRulesOptions).execute(); - RulesPageBase rulesPageBase = response.getResult(); + Response response = securityAndComplianceCenterApiService.getLatestReports(getLatestReportsOptions).execute(); + ReportLatest reportLatest = response.getResult(); - System.out.println(rulesPageBase); - // end-list_rules + System.out.println(reportLatest); + // end-get_latest_reports + + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); + accountIdForReportLink = reportLatest.getReports().get(0).getAccount().getId(); + reportIdForReportLink = reportLatest.getReports().get(0).getId(); + attachmentIdForReportLink = reportLatest.getReports().get(0).getAttachment().getId(); + groupIdForReportLink = reportLatest.getReports().get(0).getGroupId(); + profileIdForReportLink = reportLatest.getReports().get(0).getProfile().getId(); + typeForReportLink = reportLatest.getReports().get(0).getType(); } catch (ServiceResponseException e) { logger.error(String.format("Service returned status code %s: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); @@ -626,9 +433,8 @@ public static void main(String[] args) throws Exception { .operator("string_equals") .value("us-south") .build(); - Target targetModel = new Target.Builder() + TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() .serviceName("cloud-object-storage") - .serviceDisplayName("Cloud Object Storage") .resourceKind("bucket") .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) .build(); @@ -637,7 +443,7 @@ public static void main(String[] args) throws Exception { .operator("num_equals") .value("${hard_quota}") .build(); - RequiredConfigRequiredConfigAnd requiredConfigModel = new RequiredConfigRequiredConfigAnd.Builder() + RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() .description("The Cloud Object Storage rule.") .and(java.util.Arrays.asList(requiredConfigItemsModel)) .build(); @@ -654,9 +460,8 @@ public static void main(String[] args) throws Exception { .ruleId(ruleIdLink) .ifMatch(eTagLink) .description("Example rule") - .target(targetModel) + .target(targetPrototypeModel) .requiredConfig(requiredConfigModel) - .type("user_defined") .version("1.0.1") .xImport(importModel) .labels(java.util.Arrays.asList()) @@ -667,433 +472,618 @@ public static void main(String[] args) throws Exception { System.out.println(rule); // end-replace_rule + + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); + eTagLink = response.getHeaders().values("ETag").get(0); } 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("createAttachment() result:"); - // begin-create_attachment - PropertyItem propertyItemModel = new PropertyItem.Builder() - .name("scope_id") - .value("cg3335893hh1428692d6747cf300yeb5") + System.out.println("createRule() result:"); + // begin-create_rule + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("location") + .operator("string_equals") + .value("us-east") .build(); - MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() - .environment("ibm-cloud") - .xProperties(java.util.Arrays.asList(propertyItemModel)) + TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() + .serviceName("cloud-object-storage") + .resourceKind("bucket") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) .build(); - FailedControls failedControlsModel = new FailedControls.Builder() - .thresholdLimit(Long.valueOf("15")) - .failedControlIds(java.util.Arrays.asList()) + RequiredConfigItemsRequiredConfigBase requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigBase.Builder() + .property("hard_quota") + .operator("num_equals") + .value("${hard_quota}") .build(); - AttachmentsNotificationsPrototype attachmentsNotificationsPrototypeModel = new AttachmentsNotificationsPrototype.Builder() - .enabled(false) - .controls(failedControlsModel) + RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() + .description("The Cloud Object Storage rule.") + .and(java.util.Arrays.asList(requiredConfigItemsModel)) .build(); - AttachmentParameterPrototype attachmentParameterPrototypeModel = new AttachmentParameterPrototype.Builder() - .assessmentType("Automated") - .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") + Parameter parameterModel = new Parameter.Builder() + .name("hard_quota") + .displayName("The Cloud Object Storage bucket quota.") + .description("The maximum bytes that are allocated to the Cloud Object Storage bucket.") + .type("numeric") + .build(); + Import importModel = new Import.Builder() + .parameters(java.util.Arrays.asList(parameterModel)) + .build(); + CreateRuleOptions createRuleOptions = new CreateRuleOptions.Builder() + .description("Example rule") + .target(targetPrototypeModel) + .requiredConfig(requiredConfigModel) + .version("1.0.0") + .xImport(importModel) + .labels(java.util.Arrays.asList()) + .build(); + + Response response = securityAndComplianceCenterApiService.createRule(createRuleOptions).execute(); + Rule rule = response.getResult(); + + System.out.println(rule); + // end-create_rule + + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); + eTagLink = response.getHeaders().values("ETag").get(0); + ruleIdLink = rule.getId(); + } 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("getSettings() result:"); + // begin-get_settings + GetSettingsOptions getSettingsOptions = new GetSettingsOptions.Builder() + .xCorrelationId(xCorrelationIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getSettings(getSettingsOptions).execute(); + Settings settings = response.getResult(); + + System.out.println(settings); + // end-get_settings + + eventNotificationsCrnForUpdateSettingsLink = settings.eventNotifications().instanceCrn(); + objectStorageCrnForUpdateSettingsLink = settings.objectStorage().instanceCrn(); + objectStorageBucketForUpdateSettingsLink = settings.objectStorage().bucket(); + objectStorageLocationForUpdateSettingsLink = settings.objectStorage().bucketLocation(); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); + } 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("getRule() result:"); + // begin-get_rule + GetRuleOptions getRuleOptions = new GetRuleOptions.Builder() + .ruleId(ruleIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getRule(getRuleOptions).execute(); + Rule rule = response.getResult(); + + System.out.println(rule); + // end-get_rule + + eTagLink = response.getHeaders().values("ETag").get(0); + } 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("updateSettings() result:"); + // begin-update_settings + EventNotifications eventNotificationsModel = new EventNotifications.Builder() + .instanceCrn(eventNotificationsCrnForUpdateSettingsLink) + .sourceDescription("This source is used for integration with IBM Cloud Security and Compliance Center.") + .sourceName("compliance") + .build(); + ObjectStorage objectStorageModel = new ObjectStorage.Builder() + .instanceCrn(objectStorageCrnForUpdateSettingsLink) + .bucket(objectStorageBucketForUpdateSettingsLink) + .bucketLocation(objectStorageLocationForUpdateSettingsLink) + .build(); + UpdateSettingsOptions updateSettingsOptions = new UpdateSettingsOptions.Builder() + .eventNotifications(eventNotificationsModel) + .objectStorage(objectStorageModel) + .xCorrelationId(xCorrelationIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.updateSettings(updateSettingsOptions).execute(); + Settings settings = response.getResult(); + + System.out.println(settings); + // end-update_settings + } 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("postTestEvent() result:"); + // begin-post_test_event + PostTestEventOptions postTestEventOptions = new PostTestEventOptions.Builder() + .xCorrelationId(xCorrelationIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.postTestEvent(postTestEventOptions).execute(); + TestEvent testEvent = response.getResult(); + + System.out.println(testEvent); + // end-post_test_event + } 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("createCustomControlLibrary() result:"); + // begin-create_custom_control_library + ParameterInfo parameterInfoModel = new ParameterInfo.Builder() .parameterName("session_invalidation_in_seconds") - .parameterValue("120") .parameterDisplayName("Sign out due to inactivity in seconds") .parameterType("numeric") .build(); - AttachmentsPrototype attachmentsPrototypeModel = new AttachmentsPrototype.Builder() - .name("account-0d8c3805dfea40aa8ad02265a18eb12b") - .description("Test description") - .scope(java.util.Arrays.asList(multiCloudScopeModel)) - .status("enabled") - .schedule("every_30_days") - .notifications(attachmentsNotificationsPrototypeModel) - .attachmentParameters(java.util.Arrays.asList(attachmentParameterPrototypeModel)) + Implementation implementationModel = new Implementation.Builder() + .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") + .assessmentMethod("ibm-cloud-rule") + .assessmentType("automated") + .assessmentDescription("Check that there is an Activity Tracker event route defined to collect global events generated by IBM Cloud services") + .parameters(java.util.Arrays.asList(parameterInfoModel)) .build(); - CreateAttachmentOptions createAttachmentOptions = new CreateAttachmentOptions.Builder() - .profilesId(profileIdLink) - .attachments(java.util.Arrays.asList(attachmentsPrototypeModel)) + ControlSpecifications controlSpecificationsModel = new ControlSpecifications.Builder() + .controlSpecificationId("5c7d6f88-a92f-4734-9b49-bd22b0900184") + .componentId("iam-identity") + .componentName("IAM Identity Service") + .environment("ibm-cloud") + .controlSpecificationDescription("IBM cloud") + .assessments(java.util.Arrays.asList(implementationModel)) + .build(); + ControlDocs controlDocsModel = new ControlDocs.Builder() + .controlDocsId("sc-7") + .controlDocsType("ibm-cloud") + .build(); + ControlsInControlLib controlsInControlLibModel = new ControlsInControlLib.Builder() + .controlName("SC-7") + .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") + .controlDescription("Boundary Protection") + .controlCategory("System and Communications Protection") + .controlTags(java.util.Arrays.asList("1fa45e17-9322-4e6c-bbd6-1c51db08e790")) + .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) + .controlDocs(controlDocsModel) + .controlRequirement(true) + .build(); + CreateCustomControlLibraryOptions createCustomControlLibraryOptions = new CreateCustomControlLibraryOptions.Builder() + .controlLibraryName("IBM Cloud for Financial Services") + .controlLibraryDescription("IBM Cloud for Financial Services") + .controlLibraryType("custom") + .controls(java.util.Arrays.asList(controlsInControlLibModel)) + .versionGroupLabel("33fc7b80-0fa5-4f16-bbba-1f293f660f0d") + .controlLibraryVersion("1.0.0") .build(); - Response response = securityAndComplianceCenterApiService.createAttachment(createAttachmentOptions).execute(); - AttachmentPrototype attachmentPrototype = response.getResult(); - - System.out.println(attachmentPrototype); - // end-create_attachment + Response response = securityAndComplianceCenterApiService.createCustomControlLibrary(createCustomControlLibraryOptions).execute(); + ControlLibrary controlLibrary = response.getResult(); - attachmentIdLink = attachmentPrototype.attachments().get(0).id(); + System.out.println(controlLibrary); + // end-create_custom_control_library + + controlLibraryIdLink = controlLibrary.id(); } 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("listAttachments() result:"); - // begin-list_attachments - ListAttachmentsOptions listAttachmentsOptions = new ListAttachmentsOptions.Builder() - .profilesId(profileIdLink) + System.out.println("listControlLibraries() result:"); + // begin-list_control_libraries + ListControlLibrariesOptions listControlLibrariesOptions = new ListControlLibrariesOptions.Builder() .xCorrelationId("testString") .xRequestId("testString") - .limit(Long.valueOf("10")) + .limit(Long.valueOf("50")) + .controlLibraryType("custom") .build(); - AttachmentsPager pager = new AttachmentsPager(securityAndComplianceCenterApiService, listAttachmentsOptions); - List allResults = new ArrayList<>(); + ControlLibrariesPager pager = new ControlLibrariesPager(securityAndComplianceCenterApiService, listControlLibrariesOptions); + List allResults = new ArrayList<>(); while (pager.hasNext()) { - List nextPage = pager.getNext(); + List nextPage = pager.getNext(); allResults.addAll(nextPage); } System.out.println(GsonSingleton.getGson().toJson(allResults)); - // end-list_attachments + // end-list_control_libraries } 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("getProfileAttachment() result:"); - // begin-get_profile_attachment - GetProfileAttachmentOptions getProfileAttachmentOptions = new GetProfileAttachmentOptions.Builder() - .attachmentId(attachmentIdLink) - .profilesId(profileIdLink) + System.out.println("getControlLibrary() result:"); + // begin-get_control_library + GetControlLibraryOptions getControlLibraryOptions = new GetControlLibraryOptions.Builder() + .controlLibrariesId(controlLibraryIdLink) .build(); - Response response = securityAndComplianceCenterApiService.getProfileAttachment(getProfileAttachmentOptions).execute(); - AttachmentItem attachmentItem = response.getResult(); + Response response = securityAndComplianceCenterApiService.getControlLibrary(getControlLibraryOptions).execute(); + ControlLibrary controlLibrary = response.getResult(); - System.out.println(attachmentItem); - // end-get_profile_attachment + System.out.println(controlLibrary); + // end-get_control_library } 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("replaceProfileAttachment() result:"); - // begin-replace_profile_attachment - PropertyItem propertyItemModel = new PropertyItem.Builder() - .name("scope_id") - .value("cg3335893hh1428692d6747cf300yeb5") + System.out.println("replaceCustomControlLibrary() result:"); + // begin-replace_custom_control_library + ParameterInfo parameterInfoModel = new ParameterInfo.Builder() + .parameterName("session_invalidation_in_seconds") + .parameterDisplayName("Sign out due to inactivity in seconds") + .parameterType("numeric") .build(); - MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() - .environment("ibm-cloud") - .xProperties(java.util.Arrays.asList(propertyItemModel)) + Implementation implementationModel = new Implementation.Builder() + .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") + .assessmentMethod("ibm-cloud-rule") + .assessmentType("automated") + .assessmentDescription("Check that there is an Activity Tracker event route defined to collect global events generated by IBM Cloud services") + .parameters(java.util.Arrays.asList(parameterInfoModel)) .build(); - FailedControls failedControlsModel = new FailedControls.Builder() - .thresholdLimit(Long.valueOf("15")) - .failedControlIds(java.util.Arrays.asList()) + ControlSpecifications controlSpecificationsModel = new ControlSpecifications.Builder() + .controlSpecificationId("5c7d6f88-a92f-4734-9b49-bd22b0900184") + .responsibility("user") + .componentId("iam-identity") + .componentName("IAM Identity Service") + .environment("ibm-cloud") + .controlSpecificationDescription("IBM cloud") + .assessments(java.util.Arrays.asList(implementationModel)) .build(); - AttachmentsNotificationsPrototype attachmentsNotificationsPrototypeModel = new AttachmentsNotificationsPrototype.Builder() - .enabled(false) - .controls(failedControlsModel) + ControlDocs controlDocsModel = new ControlDocs.Builder() + .controlDocsId("sc-7") + .controlDocsType("ibm-cloud") .build(); - AttachmentParameterPrototype attachmentParameterPrototypeModel = new AttachmentParameterPrototype.Builder() - .assessmentType("Automated") - .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") - .parameterName("session_invalidation_in_seconds") - .parameterValue("120") - .parameterDisplayName("Sign out due to inactivity in seconds") - .parameterType("numeric") + ControlsInControlLib controlsInControlLibModel = new ControlsInControlLib.Builder() + .controlName("SC-7") + .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") + .controlDescription("Boundary Protection") + .controlCategory("System and Communications Protection") + .controlTags(java.util.Arrays.asList("1fa45e17-9322-4e6c-bbd6-1c51db08e790")) + .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) + .controlDocs(controlDocsModel) + .controlRequirement(true) .build(); - ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions = new ReplaceProfileAttachmentOptions.Builder() - .attachmentId(attachmentIdLink) - .profilesId(profileIdLink) - .scope(java.util.Arrays.asList(multiCloudScopeModel)) - .status("enabled") - .schedule("every_30_days") - .notifications(attachmentsNotificationsPrototypeModel) - .attachmentParameters(java.util.Arrays.asList(attachmentParameterPrototypeModel)) - .name("account-0d8c3805dfea40aa8ad02265a18eb12b") - .description("Test description") + ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptions = new ReplaceCustomControlLibraryOptions.Builder() + .controlLibrariesId(controlLibraryIdLink) + .controlLibraryName("IBM Cloud for Financial Services") + .controlLibraryDescription("IBM Cloud for Financial Services") + .controlLibraryType("custom") + .controlLibraryVersion("1.1.0") + .controls(java.util.Arrays.asList(controlsInControlLibModel)) .build(); - Response response = securityAndComplianceCenterApiService.replaceProfileAttachment(replaceProfileAttachmentOptions).execute(); - AttachmentItem attachmentItem = response.getResult(); + Response response = securityAndComplianceCenterApiService.replaceCustomControlLibrary(replaceCustomControlLibraryOptions).execute(); + ControlLibrary controlLibrary = response.getResult(); - System.out.println(attachmentItem); - // end-replace_profile_attachment + System.out.println(controlLibrary); + // end-replace_custom_control_library } 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("createScan() result:"); - // begin-create_scan - CreateScanOptions createScanOptions = new CreateScanOptions.Builder() - .attachmentId(attachmentIdLink) + System.out.println("createProfile() result:"); + // begin-create_profile + ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() + .controlLibraryId(controlLibraryIdLink) + .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") .build(); - - Response response = securityAndComplianceCenterApiService.createScan(createScanOptions).execute(); - Scan scan = response.getResult(); - - System.out.println(scan); - // end-create_scan - } 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("listAttachmentsAccount() result:"); - // begin-list_attachments_account - ListAttachmentsAccountOptions listAttachmentsAccountOptions = new ListAttachmentsAccountOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) + DefaultParametersPrototype defaultParametersPrototypeModel = new DefaultParametersPrototype.Builder() + .assessmentType("Automated") + .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") + .parameterName("session_invalidation_in_seconds") + .parameterDefaultValue("120") + .parameterDisplayName("Sign out due to inactivity in seconds") + .parameterType("numeric") + .build(); + CreateProfileOptions createProfileOptions = new CreateProfileOptions.Builder() + .profileName("test_profile1") + .profileDescription("test_description1") + .profileType("custom") + .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) + .defaultParameters(java.util.Arrays.asList(defaultParametersPrototypeModel)) .build(); - AttachmentsAccountPager pager = new AttachmentsAccountPager(securityAndComplianceCenterApiService, listAttachmentsAccountOptions); - List allResults = new ArrayList<>(); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - allResults.addAll(nextPage); - } + Response response = securityAndComplianceCenterApiService.createProfile(createProfileOptions).execute(); + Profile profile = response.getResult(); - System.out.println(GsonSingleton.getGson().toJson(allResults)); - // end-list_attachments_account + System.out.println(profile); + // end-create_profile + + profileIdLink = profile.getId(); } 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("listReports() result:"); - // begin-list_reports - ListReportsOptions listReportsOptions = new ListReportsOptions.Builder() + System.out.println("listProfiles() result:"); + // begin-list_profiles + ListProfilesOptions listProfilesOptions = new ListProfilesOptions.Builder() .xCorrelationId("testString") .xRequestId("testString") - .attachmentId(attachmentIdForReportLink) - .groupId(groupIdForReportLink) - .profileId(profileIdForReportLink) - .type(typeForReportLink) .limit(Long.valueOf("10")) - .sort("profile_name") + .profileType("custom") .build(); - ReportsPager pager = new ReportsPager(securityAndComplianceCenterApiService, listReportsOptions); - List allResults = new ArrayList<>(); + ProfilesPager pager = new ProfilesPager(securityAndComplianceCenterApiService, listProfilesOptions); + List allResults = new ArrayList<>(); while (pager.hasNext()) { - List nextPage = pager.getNext(); + List nextPage = pager.getNext(); allResults.addAll(nextPage); } System.out.println(GsonSingleton.getGson().toJson(allResults)); - // end-list_reports - } 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("getReport() result:"); - // begin-get_report - GetReportOptions getReportOptions = new GetReportOptions.Builder() - .reportId(reportIdForReportLink) - .build(); - - Response response = securityAndComplianceCenterApiService.getReport(getReportOptions).execute(); - Report report = response.getResult(); - - System.out.println(report); - // end-get_report + // end-list_profiles } 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("getReportSummary() result:"); - // begin-get_report_summary - GetReportSummaryOptions getReportSummaryOptions = new GetReportSummaryOptions.Builder() - .reportId(reportIdForReportLink) + System.out.println("getProfile() result:"); + // begin-get_profile + GetProfileOptions getProfileOptions = new GetProfileOptions.Builder() + .profileId(profileIdLink) .build(); - Response response = securityAndComplianceCenterApiService.getReportSummary(getReportSummaryOptions).execute(); - ReportSummary reportSummary = response.getResult(); + Response response = securityAndComplianceCenterApiService.getProfile(getProfileOptions).execute(); + Profile profile = response.getResult(); - System.out.println(reportSummary); - // end-get_report_summary + System.out.println(profile); + // end-get_profile } 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("getReportEvaluation() result:"); - // begin-get_report_evaluation - GetReportEvaluationOptions getReportEvaluationOptions = new GetReportEvaluationOptions.Builder() - .reportId(reportIdForReportLink) + System.out.println("replaceProfile() result:"); + // begin-replace_profile + ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() + .controlLibraryId(controlLibraryIdLink) + .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") .build(); - - Response response = securityAndComplianceCenterApiService.getReportEvaluation(getReportEvaluationOptions).execute(); - InputStream inputStream = response.getResult(); - - System.out.println(inputStream); - // end-get_report_evaluation - } 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("getReportControls() result:"); - // begin-get_report_controls - GetReportControlsOptions getReportControlsOptions = new GetReportControlsOptions.Builder() - .reportId(reportIdForReportLink) - .status("compliant") + DefaultParametersPrototype defaultParametersPrototypeModel = new DefaultParametersPrototype.Builder() + .assessmentType("Automated") + .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") + .parameterName("session_invalidation_in_seconds") + .parameterDefaultValue("120") + .parameterDisplayName("Sign out due to inactivity in seconds") + .parameterType("numeric") + .build(); + ReplaceProfileOptions replaceProfileOptions = new ReplaceProfileOptions.Builder() + .profileId(profileIdLink) + .profileName("test_profile1") + .profileDescription("test_description1") + .profileType("custom") + .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) + .defaultParameters(java.util.Arrays.asList(defaultParametersPrototypeModel)) .build(); - Response response = securityAndComplianceCenterApiService.getReportControls(getReportControlsOptions).execute(); - ReportControls reportControls = response.getResult(); + Response response = securityAndComplianceCenterApiService.replaceProfile(replaceProfileOptions).execute(); + Profile profile = response.getResult(); - System.out.println(reportControls); - // end-get_report_controls + System.out.println(profile); + // end-replace_profile } 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("getReportRule() result:"); - // begin-get_report_rule - GetReportRuleOptions getReportRuleOptions = new GetReportRuleOptions.Builder() - .reportId(reportIdForReportLink) - .ruleId("rule-8d444f8c-fd1d-48de-bcaa-f43732568761") + System.out.println("listRules() result:"); + // begin-list_rules + ListRulesOptions listRulesOptions = new ListRulesOptions.Builder() + .type("system_defined") .build(); - Response response = securityAndComplianceCenterApiService.getReportRule(getReportRuleOptions).execute(); - RuleInfo ruleInfo = response.getResult(); + Response response = securityAndComplianceCenterApiService.listRules(listRulesOptions).execute(); + RulesPageBase rulesPageBase = response.getResult(); - System.out.println(ruleInfo); - // end-get_report_rule + System.out.println(rulesPageBase); + // end-list_rules } 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("listReportEvaluations() result:"); - // begin-list_report_evaluations - ListReportEvaluationsOptions listReportEvaluationsOptions = new ListReportEvaluationsOptions.Builder() - .reportId(reportIdForReportLink) - .xCorrelationId("testString") - .xRequestId("testString") - .assessmentId("testString") - .componentId("testString") - .targetId("testString") - .targetName("testString") - .status("failure") - .limit(Long.valueOf("10")) + System.out.println("createAttachment() result:"); + // begin-create_attachment + PropertyItem propertyItemModel = new PropertyItem.Builder() + .name("scope_id") + .value("cg3335893hh1428692d6747cf300yeb5") + .build(); + MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() + .environment("ibm-cloud") + .xProperties(java.util.Arrays.asList(propertyItemModel)) + .build(); + FailedControls failedControlsModel = new FailedControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList()) + .build(); + AttachmentsNotificationsPrototype attachmentsNotificationsPrototypeModel = new AttachmentsNotificationsPrototype.Builder() + .enabled(false) + .controls(failedControlsModel) + .build(); + AttachmentParameterPrototype attachmentParameterPrototypeModel = new AttachmentParameterPrototype.Builder() + .assessmentType("Automated") + .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") + .parameterName("session_invalidation_in_seconds") + .parameterValue("120") + .parameterDisplayName("Sign out due to inactivity in seconds") + .parameterType("numeric") + .build(); + AttachmentsPrototype attachmentsPrototypeModel = new AttachmentsPrototype.Builder() + .name("account-0d8c3805dfea40aa8ad02265a18eb12b") + .description("Test description") + .scope(java.util.Arrays.asList(multiCloudScopeModel)) + .status("enabled") + .schedule("every_30_days") + .notifications(attachmentsNotificationsPrototypeModel) + .attachmentParameters(java.util.Arrays.asList(attachmentParameterPrototypeModel)) + .build(); + CreateAttachmentOptions createAttachmentOptions = new CreateAttachmentOptions.Builder() + .profileId(profileIdLink) + .attachments(java.util.Arrays.asList(attachmentsPrototypeModel)) .build(); - ReportEvaluationsPager pager = new ReportEvaluationsPager(securityAndComplianceCenterApiService, listReportEvaluationsOptions); - List allResults = new ArrayList<>(); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - allResults.addAll(nextPage); - } + Response response = securityAndComplianceCenterApiService.createAttachment(createAttachmentOptions).execute(); + AttachmentPrototype attachmentPrototype = response.getResult(); - System.out.println(GsonSingleton.getGson().toJson(allResults)); - // end-list_report_evaluations + System.out.println(attachmentPrototype); + // end-create_attachment + + attachmentIdLink = attachmentPrototype.attachments().get(0).id(); } 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("listReportResources() result:"); - // begin-list_report_resources - ListReportResourcesOptions listReportResourcesOptions = new ListReportResourcesOptions.Builder() - .reportId(reportIdForReportLink) + System.out.println("listAttachments() result:"); + // begin-list_attachments + ListAttachmentsOptions listAttachmentsOptions = new ListAttachmentsOptions.Builder() + .profileId(profileIdLink) .xCorrelationId("testString") .xRequestId("testString") - .id("testString") - .resourceName("testString") - .accountId(accountIdForReportLink) - .componentId("testString") - .status("compliant") - .sort("account_id") .limit(Long.valueOf("10")) .build(); - ReportResourcesPager pager = new ReportResourcesPager(securityAndComplianceCenterApiService, listReportResourcesOptions); - List allResults = new ArrayList<>(); + AttachmentsPager pager = new AttachmentsPager(securityAndComplianceCenterApiService, listAttachmentsOptions); + List allResults = new ArrayList<>(); while (pager.hasNext()) { - List nextPage = pager.getNext(); + List nextPage = pager.getNext(); allResults.addAll(nextPage); } System.out.println(GsonSingleton.getGson().toJson(allResults)); - // end-list_report_resources + // end-list_attachments } 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("getReportTags() result:"); - // begin-get_report_tags - GetReportTagsOptions getReportTagsOptions = new GetReportTagsOptions.Builder() - .reportId(reportIdForReportLink) + System.out.println("getProfileAttachment() result:"); + // begin-get_profile_attachment + GetProfileAttachmentOptions getProfileAttachmentOptions = new GetProfileAttachmentOptions.Builder() + .attachmentId(attachmentIdLink) + .profileId(profileIdLink) .build(); - Response response = securityAndComplianceCenterApiService.getReportTags(getReportTagsOptions).execute(); - ReportTags reportTags = response.getResult(); + Response response = securityAndComplianceCenterApiService.getProfileAttachment(getProfileAttachmentOptions).execute(); + AttachmentItem attachmentItem = response.getResult(); - System.out.println(reportTags); - // end-get_report_tags + System.out.println(attachmentItem); + // end-get_profile_attachment } 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("getReportViolationsDrift() result:"); - // begin-get_report_violations_drift - GetReportViolationsDriftOptions getReportViolationsDriftOptions = new GetReportViolationsDriftOptions.Builder() - .reportId(reportIdForReportLink) + System.out.println("replaceProfileAttachment() result:"); + // begin-replace_profile_attachment + PropertyItem propertyItemModel = new PropertyItem.Builder() + .name("scope_id") + .value("cg3335893hh1428692d6747cf300yeb5") + .build(); + MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() + .environment("ibm-cloud") + .xProperties(java.util.Arrays.asList(propertyItemModel)) + .build(); + FailedControls failedControlsModel = new FailedControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList()) + .build(); + AttachmentsNotificationsPrototype attachmentsNotificationsPrototypeModel = new AttachmentsNotificationsPrototype.Builder() + .enabled(false) + .controls(failedControlsModel) + .build(); + AttachmentParameterPrototype attachmentParameterPrototypeModel = new AttachmentParameterPrototype.Builder() + .assessmentType("Automated") + .assessmentId("rule-a637949b-7e51-46c4-afd4-b96619001bf1") + .parameterName("session_invalidation_in_seconds") + .parameterValue("120") + .parameterDisplayName("Sign out due to inactivity in seconds") + .parameterType("numeric") + .build(); + ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions = new ReplaceProfileAttachmentOptions.Builder() + .attachmentId(attachmentIdLink) + .profileId(profileIdLink) + .scope(java.util.Arrays.asList(multiCloudScopeModel)) + .status("enabled") + .schedule("every_30_days") + .notifications(attachmentsNotificationsPrototypeModel) + .attachmentParameters(java.util.Arrays.asList(attachmentParameterPrototypeModel)) + .name("account-0d8c3805dfea40aa8ad02265a18eb12b") + .description("Test description") .build(); - Response response = securityAndComplianceCenterApiService.getReportViolationsDrift(getReportViolationsDriftOptions).execute(); - ReportViolationsDrift reportViolationsDrift = response.getResult(); + Response response = securityAndComplianceCenterApiService.replaceProfileAttachment(replaceProfileAttachmentOptions).execute(); + AttachmentItem attachmentItem = response.getResult(); - System.out.println(reportViolationsDrift); - // end-get_report_violations_drift + System.out.println(attachmentItem); + // end-replace_profile_attachment } 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("listProviderTypes() result:"); - // begin-list_provider_types - ListProviderTypesOptions listProviderTypesOptions = new ListProviderTypesOptions.Builder() + System.out.println("createScan() result:"); + // begin-create_scan + CreateScanOptions createScanOptions = new CreateScanOptions.Builder() + .attachmentId(attachmentIdLink) .build(); - Response response = securityAndComplianceCenterApiService.listProviderTypes(listProviderTypesOptions).execute(); - ProviderTypesCollection providerTypesCollection = response.getResult(); - - System.out.println(providerTypesCollection); - // end-list_provider_types + Response response = securityAndComplianceCenterApiService.createScan(createScanOptions).execute(); + Scan scan = response.getResult(); - providerTypeIdLink = providerTypesCollection.getProviderTypes().get(0).getId(); + System.out.println(scan); + // end-create_scan } 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("getProviderTypeById() result:"); - // begin-get_provider_type_by_id - GetProviderTypeByIdOptions getProviderTypeByIdOptions = new GetProviderTypeByIdOptions.Builder() - .providerTypeId(providerTypeIdLink) + System.out.println("listAttachmentsAccount() result:"); + // begin-list_attachments_account + ListAttachmentsAccountOptions listAttachmentsAccountOptions = new ListAttachmentsAccountOptions.Builder() + .xCorrelationId("testString") + .xRequestId("testString") + .limit(Long.valueOf("10")) .build(); - Response response = securityAndComplianceCenterApiService.getProviderTypeById(getProviderTypeByIdOptions).execute(); - ProviderTypeItem providerTypeItem = response.getResult(); + AttachmentsAccountPager pager = new AttachmentsAccountPager(securityAndComplianceCenterApiService, listAttachmentsAccountOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } - System.out.println(providerTypeItem); - // end-get_provider_type_by_id + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // end-list_attachments_account } catch (ServiceResponseException e) { logger.error(String.format("Service returned status code %s: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); @@ -1121,6 +1111,8 @@ public static void main(String[] args) throws Exception { // begin-create_provider_type_instance CreateProviderTypeInstanceOptions createProviderTypeInstanceOptions = new CreateProviderTypeInstanceOptions.Builder() .providerTypeId(providerTypeIdLink) + .name("workload-protection-instance-1") + .attributes(new java.util.HashMap()) .build(); Response response = securityAndComplianceCenterApiService.createProviderTypeInstance(createProviderTypeInstanceOptions).execute(); @@ -1156,9 +1148,13 @@ public static void main(String[] args) throws Exception { try { System.out.println("updateProviderTypeInstance() result:"); // begin-update_provider_type_instance + UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName updateProviderTypeInstanceRequestModel = new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.Builder() + .name("workload-protection-instance-1") + .build(); UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptions = new UpdateProviderTypeInstanceOptions.Builder() .providerTypeId(providerTypeIdLink) .providerTypeInstanceId(providerTypeInstanceIdLink) + .updateProviderTypeInstanceRequest(updateProviderTypeInstanceRequestModel) .build(); Response response = securityAndComplianceCenterApiService.updateProviderTypeInstance(updateProviderTypeInstanceOptions).execute(); @@ -1187,11 +1183,46 @@ public static void main(String[] args) throws Exception { e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); } + try { + System.out.println("listProviderTypes() result:"); + // begin-list_provider_types + ListProviderTypesOptions listProviderTypesOptions = new ListProviderTypesOptions.Builder() + .build(); + + Response response = securityAndComplianceCenterApiService.listProviderTypes(listProviderTypesOptions).execute(); + ProviderTypesCollection providerTypesCollection = response.getResult(); + + System.out.println(providerTypesCollection); + // end-list_provider_types + + providerTypeIdLink = providerTypesCollection.getProviderTypes().get(0).getId(); + } 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("getProviderTypeById() result:"); + // begin-get_provider_type_by_id + GetProviderTypeByIdOptions getProviderTypeByIdOptions = new GetProviderTypeByIdOptions.Builder() + .providerTypeId(providerTypeIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getProviderTypeById(getProviderTypeByIdOptions).execute(); + ProviderTypeItem providerTypeItem = response.getResult(); + + System.out.println(providerTypeItem); + // end-get_provider_type_by_id + } 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("deleteCustomProfile() result:"); // begin-delete_custom_profile DeleteCustomProfileOptions deleteCustomProfileOptions = new DeleteCustomProfileOptions.Builder() - .profilesId(profileIdLink) + .profileId(profileIdLink) .build(); Response response = securityAndComplianceCenterApiService.deleteCustomProfile(deleteCustomProfileOptions).execute(); @@ -1240,7 +1271,7 @@ public static void main(String[] args) throws Exception { // begin-delete_profile_attachment DeleteProfileAttachmentOptions deleteProfileAttachmentOptions = new DeleteProfileAttachmentOptions.Builder() .attachmentId(attachmentIdLink) - .profilesId(profileIdLink) + .profileId(profileIdLink) .build(); Response response = securityAndComplianceCenterApiService.deleteProfileAttachment(deleteProfileAttachmentOptions).execute(); diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApi.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApi.java index 7935bb49..77fb49cf 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApi.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApi.java @@ -209,10 +209,10 @@ public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) } builder.header("Accept", "application/json"); if (getSettingsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-Id", getSettingsOptions.xCorrelationId()); + builder.header("X-Correlation-ID", getSettingsOptions.xCorrelationId()); } if (getSettingsOptions.xRequestId() != null) { - builder.header("X-Request-Id", getSettingsOptions.xRequestId()); + builder.header("X-Request-ID", getSettingsOptions.xRequestId()); } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -248,10 +248,10 @@ public ServiceCall updateSettings(UpdateSettingsOptions updateSettings } builder.header("Accept", "application/json"); if (updateSettingsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-Id", updateSettingsOptions.xCorrelationId()); + builder.header("X-Correlation-ID", updateSettingsOptions.xCorrelationId()); } if (updateSettingsOptions.xRequestId() != null) { - builder.header("X-Request-Id", updateSettingsOptions.xRequestId()); + builder.header("X-Request-ID", updateSettingsOptions.xRequestId()); } final JsonObject contentJson = new JsonObject(); if (updateSettingsOptions.eventNotifications() != null) { @@ -298,10 +298,10 @@ public ServiceCall postTestEvent(PostTestEventOptions postTestEventOp } builder.header("Accept", "application/json"); if (postTestEventOptions.xCorrelationId() != null) { - builder.header("X-Correlation-Id", postTestEventOptions.xCorrelationId()); + builder.header("X-Correlation-ID", postTestEventOptions.xCorrelationId()); } if (postTestEventOptions.xRequestId() != null) { - builder.header("X-Request-Id", postTestEventOptions.xRequestId()); + builder.header("X-Request-ID", postTestEventOptions.xRequestId()); } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -322,7 +322,7 @@ public ServiceCall postTestEvent() { } /** - * Get control libraries. + * List control libraries. * * Retrieve all of the control libraries that are available in your account, including predefined, and custom * libraries. @@ -332,7 +332,8 @@ public ServiceCall postTestEvent() { * Each control has several specifications and assessments that are mapped to it. A specification is a defined * requirement that is specific to a component. An assessment, or several, are mapped to each specification with a * detailed evaluation that is done to check whether the specification is compliant. For more information, see - * [Creating custom libraries](/docs/security-compliance?topic=security-compliance-custom-library). + * [Creating custom + * libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). * * @param listControlLibrariesOptions the {@link ListControlLibrariesOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ControlLibraryCollection} @@ -368,7 +369,7 @@ public ServiceCall listControlLibraries(ListControlLib } /** - * Get control libraries. + * List control libraries. * * Retrieve all of the control libraries that are available in your account, including predefined, and custom * libraries. @@ -378,7 +379,8 @@ public ServiceCall listControlLibraries(ListControlLib * Each control has several specifications and assessments that are mapped to it. A specification is a defined * requirement that is specific to a component. An assessment, or several, are mapped to each specification with a * detailed evaluation that is done to check whether the specification is compliant. For more information, see - * [Creating custom libraries](/docs/security-compliance?topic=security-compliance-custom-library). + * [Creating custom + * libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). * * @return a {@link ServiceCall} with a result of type {@link ControlLibraryCollection} */ @@ -396,7 +398,8 @@ public ServiceCall listControlLibraries() { * Each control has several specifications and assessments that are mapped to it. A specification is a defined * requirement that is specific to a component. An assessment, or several, are mapped to each specification with a * detailed evaluation that is done to check whether the specification is compliant. For more information, see - * [Creating custom libraries](/docs/security-compliance?topic=security-compliance-custom-library). + * [Creating custom + * libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). * * @param createCustomControlLibraryOptions the {@link CreateCustomControlLibraryOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ControlLibrary} @@ -447,7 +450,8 @@ public ServiceCall createCustomControlLibrary(CreateCustomContro * * With Security and Compliance Center, you can manage a custom control library that is specific to your * organization's needs. Each control has several specifications and assessments that are mapped to it. For more - * information, see [Creating custom libraries](/docs/security-compliance?topic=security-compliance-custom-library). + * information, see [Creating custom + * libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). * * @param deleteCustomControlLibraryOptions the {@link DeleteCustomControlLibraryOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ControlLibraryDelete} @@ -484,7 +488,8 @@ public ServiceCall deleteCustomControlLibrary(DeleteCustom * Each control has several specifications and assessments that are mapped to it. A specification is a defined * requirement that is specific to a component. An assessment, or several, are mapped to each specification with a * detailed evaluation that is done to check whether the specification is compliant. For more information, see - * [Creating custom libraries](/docs/security-compliance?topic=security-compliance-custom-library). + * [Creating custom + * libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). * * @param getControlLibraryOptions the {@link GetControlLibraryOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ControlLibrary} @@ -520,7 +525,7 @@ public ServiceCall getControlLibrary(GetControlLibraryOptions ge * With Security and Compliance Center, you can create and update a custom control library that is specific to your * organization's needs. You define the controls and specifications before you map previously created assessments. * Each control has several specifications and assessments that are mapped to it. For more information, see [Creating - * custom libraries](/docs/security-compliance?topic=security-compliance-custom-library). + * custom libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). * * @param replaceCustomControlLibraryOptions the {@link ReplaceCustomControlLibraryOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ControlLibrary} @@ -598,7 +603,7 @@ public ServiceCall replaceCustomControlLibrary(ReplaceCustomCont } /** - * Get all profiles. + * List profiles. * * View all of the predefined and custom profiles that are available in your account. * @@ -636,7 +641,7 @@ public ServiceCall listProfiles(ListProfilesOptions listProfi } /** - * Get all profiles. + * List profiles. * * View all of the predefined and custom profiles that are available in your account. * @@ -651,7 +656,7 @@ public ServiceCall listProfiles() { * * Create a custom profile that is specific to your usecase, by using an existing library as a starting point. For * more information, see [Building custom - * profiles](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). * * @param createProfileOptions the {@link CreateProfileOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link Profile} @@ -688,7 +693,7 @@ public ServiceCall createProfile(CreateProfileOptions createProfileOpti * * Delete a custom profile by providing the profile ID. You can find the ID in the Security and Compliance Center UI. * For more information about managing your custom profiles, see [Building custom - * profiles](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). * * @param deleteCustomProfileOptions the {@link DeleteCustomProfileOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link Profile} @@ -697,8 +702,8 @@ public ServiceCall deleteCustomProfile(DeleteCustomProfileOptions delet com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCustomProfileOptions, "deleteCustomProfileOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("profiles_id", deleteCustomProfileOptions.profilesId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profiles_id}", pathParamsMap)); + pathParamsMap.put("profile_id", deleteCustomProfileOptions.profileId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profile_id}", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteCustomProfile"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); @@ -720,7 +725,7 @@ public ServiceCall deleteCustomProfile(DeleteCustomProfileOptions delet * * View the details of a profile by providing the profile ID. You can find the profile ID in the Security and * Compliance Center UI. For more information, see [Building custom - * profiles](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). * * @param getProfileOptions the {@link GetProfileOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link Profile} @@ -729,8 +734,8 @@ public ServiceCall getProfile(GetProfileOptions getProfileOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull(getProfileOptions, "getProfileOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("profiles_id", getProfileOptions.profilesId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profiles_id}", pathParamsMap)); + pathParamsMap.put("profile_id", getProfileOptions.profileId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profile_id}", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getProfile"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); @@ -753,7 +758,7 @@ public ServiceCall getProfile(GetProfileOptions getProfileOptions) { * Update the details of a custom profile. With Security and Compliance Center, you can manage a profile that is * specific to your usecase, by using an existing library as a starting point. For more information, see [Building * custom - * profiles](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). * * @param replaceProfileOptions the {@link ReplaceProfileOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link Profile} @@ -762,8 +767,8 @@ public ServiceCall replaceProfile(ReplaceProfileOptions replaceProfileO com.ibm.cloud.sdk.core.util.Validator.notNull(replaceProfileOptions, "replaceProfileOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("profiles_id", replaceProfileOptions.profilesId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profiles_id}", pathParamsMap)); + pathParamsMap.put("profile_id", replaceProfileOptions.profileId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profile_id}", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "replaceProfile"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); @@ -808,10 +813,10 @@ public ServiceCall listRules(ListRulesOptions listRulesOptions) { } builder.header("Accept", "application/json"); if (listRulesOptions.xCorrelationId() != null) { - builder.header("X-Correlation-Id", listRulesOptions.xCorrelationId()); + builder.header("X-Correlation-ID", listRulesOptions.xCorrelationId()); } if (listRulesOptions.xRequestId() != null) { - builder.header("X-Request-Id", listRulesOptions.xRequestId()); + builder.header("X-Request-ID", listRulesOptions.xRequestId()); } if (listRulesOptions.type() != null) { builder.query("type", String.valueOf(listRulesOptions.type())); @@ -860,18 +865,15 @@ public ServiceCall createRule(CreateRuleOptions createRuleOptions) { } builder.header("Accept", "application/json"); if (createRuleOptions.xCorrelationId() != null) { - builder.header("X-Correlation-Id", createRuleOptions.xCorrelationId()); + builder.header("X-Correlation-ID", createRuleOptions.xCorrelationId()); } if (createRuleOptions.xRequestId() != null) { - builder.header("X-Request-Id", createRuleOptions.xRequestId()); + builder.header("X-Request-ID", createRuleOptions.xRequestId()); } final JsonObject contentJson = new JsonObject(); contentJson.addProperty("description", createRuleOptions.description()); contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRuleOptions.target())); contentJson.add("required_config", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRuleOptions.requiredConfig())); - if (createRuleOptions.type() != null) { - contentJson.addProperty("type", createRuleOptions.type()); - } if (createRuleOptions.version() != null) { contentJson.addProperty("version", createRuleOptions.version()); } @@ -907,10 +909,10 @@ public ServiceCall deleteRule(DeleteRuleOptions deleteRuleOptions) { builder.header(header.getKey(), header.getValue()); } if (deleteRuleOptions.xCorrelationId() != null) { - builder.header("X-Correlation-Id", deleteRuleOptions.xCorrelationId()); + builder.header("X-Correlation-ID", deleteRuleOptions.xCorrelationId()); } if (deleteRuleOptions.xRequestId() != null) { - builder.header("X-Request-Id", deleteRuleOptions.xRequestId()); + builder.header("X-Request-ID", deleteRuleOptions.xRequestId()); } ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); @@ -937,10 +939,10 @@ public ServiceCall getRule(GetRuleOptions getRuleOptions) { } builder.header("Accept", "application/json"); if (getRuleOptions.xCorrelationId() != null) { - builder.header("X-Correlation-Id", getRuleOptions.xCorrelationId()); + builder.header("X-Correlation-ID", getRuleOptions.xCorrelationId()); } if (getRuleOptions.xRequestId() != null) { - builder.header("X-Request-Id", getRuleOptions.xRequestId()); + builder.header("X-Request-ID", getRuleOptions.xRequestId()); } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -970,18 +972,15 @@ public ServiceCall replaceRule(ReplaceRuleOptions replaceRuleOptions) { builder.header("Accept", "application/json"); builder.header("If-Match", replaceRuleOptions.ifMatch()); if (replaceRuleOptions.xCorrelationId() != null) { - builder.header("X-Correlation-Id", replaceRuleOptions.xCorrelationId()); + builder.header("X-Correlation-ID", replaceRuleOptions.xCorrelationId()); } if (replaceRuleOptions.xRequestId() != null) { - builder.header("X-Request-Id", replaceRuleOptions.xRequestId()); + builder.header("X-Request-ID", replaceRuleOptions.xRequestId()); } final JsonObject contentJson = new JsonObject(); contentJson.addProperty("description", replaceRuleOptions.description()); contentJson.add("target", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRuleOptions.target())); contentJson.add("required_config", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRuleOptions.requiredConfig())); - if (replaceRuleOptions.type() != null) { - contentJson.addProperty("type", replaceRuleOptions.type()); - } if (replaceRuleOptions.version() != null) { contentJson.addProperty("version", replaceRuleOptions.version()); } @@ -998,12 +997,12 @@ public ServiceCall replaceRule(ReplaceRuleOptions replaceRuleOptions) { } /** - * Get all attachments linked to a specific profile. + * List attachments to a profile. * * View all of the attachments that are linked to a specific profile. An attachment is the association between the * set of resources that you want to evaluate and a profile that contains the specific controls that you want to use. * For more information, see [Running an evaluation for IBM - * Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * * @param listAttachmentsOptions the {@link ListAttachmentsOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link AttachmentCollection} @@ -1012,8 +1011,8 @@ public ServiceCall listAttachments(ListAttachmentsOptions com.ibm.cloud.sdk.core.util.Validator.notNull(listAttachmentsOptions, "listAttachmentsOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("profiles_id", listAttachmentsOptions.profilesId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profiles_id}/attachments", pathParamsMap)); + pathParamsMap.put("profile_id", listAttachmentsOptions.profileId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profile_id}/attachments", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listAttachments"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); @@ -1041,7 +1040,7 @@ public ServiceCall listAttachments(ListAttachmentsOptions * * Create an attachment to link to a profile to schedule evaluations of your resources on a recurring schedule, or * on-demand. For more information, see [Running an evaluation for IBM - * Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * * @param createAttachmentOptions the {@link CreateAttachmentOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link AttachmentPrototype} @@ -1050,8 +1049,8 @@ public ServiceCall createAttachment(CreateAttachmentOptions com.ibm.cloud.sdk.core.util.Validator.notNull(createAttachmentOptions, "createAttachmentOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("profiles_id", createAttachmentOptions.profilesId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profiles_id}/attachments", pathParamsMap)); + pathParamsMap.put("profile_id", createAttachmentOptions.profileId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profile_id}/attachments", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createAttachment"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); @@ -1079,7 +1078,7 @@ public ServiceCall createAttachment(CreateAttachmentOptions * * Delete an attachment. Alternatively, if you think that you might need this configuration in the future, you can * pause an attachment to stop being charged. For more information, see [Running an evaluation for IBM - * Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * * @param deleteProfileAttachmentOptions the {@link DeleteProfileAttachmentOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link AttachmentItem} @@ -1089,8 +1088,8 @@ public ServiceCall deleteProfileAttachment(DeleteProfileAttachme "deleteProfileAttachmentOptions cannot be null"); Map pathParamsMap = new HashMap(); pathParamsMap.put("attachment_id", deleteProfileAttachmentOptions.attachmentId()); - pathParamsMap.put("profiles_id", deleteProfileAttachmentOptions.profilesId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profiles_id}/attachments/{attachment_id}", pathParamsMap)); + pathParamsMap.put("profile_id", deleteProfileAttachmentOptions.profileId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profile_id}/attachments/{attachment_id}", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteProfileAttachment"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); @@ -1112,7 +1111,7 @@ public ServiceCall deleteProfileAttachment(DeleteProfileAttachme * * View the details of an attachment a profile by providing the attachment ID. You can find this value in the * Security and Compliance Center UI. For more information, see [Running an evaluation for IBM - * Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * * @param getProfileAttachmentOptions the {@link GetProfileAttachmentOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link AttachmentItem} @@ -1122,8 +1121,8 @@ public ServiceCall getProfileAttachment(GetProfileAttachmentOpti "getProfileAttachmentOptions cannot be null"); Map pathParamsMap = new HashMap(); pathParamsMap.put("attachment_id", getProfileAttachmentOptions.attachmentId()); - pathParamsMap.put("profiles_id", getProfileAttachmentOptions.profilesId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profiles_id}/attachments/{attachment_id}", pathParamsMap)); + pathParamsMap.put("profile_id", getProfileAttachmentOptions.profileId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profile_id}/attachments/{attachment_id}", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getProfileAttachment"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); @@ -1145,7 +1144,7 @@ public ServiceCall getProfileAttachment(GetProfileAttachmentOpti * * Update an attachment that is linked to a profile to evaluate your resources on a recurring schedule, or on-demand. * For more information, see [Running an evaluation for IBM - * Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * * @param replaceProfileAttachmentOptions the {@link ReplaceProfileAttachmentOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link AttachmentItem} @@ -1155,8 +1154,8 @@ public ServiceCall replaceProfileAttachment(ReplaceProfileAttach "replaceProfileAttachmentOptions cannot be null"); Map pathParamsMap = new HashMap(); pathParamsMap.put("attachment_id", replaceProfileAttachmentOptions.attachmentId()); - pathParamsMap.put("profiles_id", replaceProfileAttachmentOptions.profilesId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profiles_id}/attachments/{attachment_id}", pathParamsMap)); + pathParamsMap.put("profile_id", replaceProfileAttachmentOptions.profileId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles/{profile_id}/attachments/{attachment_id}", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "replaceProfileAttachment"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); @@ -1258,12 +1257,12 @@ public ServiceCall createScan(CreateScanOptions createScanOptions) { } /** - * Get all attachments in an instance. + * List attachments. * * View all of the attachments that are linked to an account. An attachment is the association between the set of * resources that you want to evaluate and a profile that contains the specific controls that you want to use. For * more information, see [Running an evaluation for IBM - * Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * * @param listAttachmentsAccountOptions the {@link ListAttachmentsAccountOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link AttachmentCollection} @@ -1296,12 +1295,12 @@ public ServiceCall listAttachmentsAccount(ListAttachmentsA } /** - * Get all attachments in an instance. + * List attachments. * * View all of the attachments that are linked to an account. An attachment is the association between the set of * resources that you want to evaluate and a profile that contains the specific controls that you want to use. For * more information, see [Running an evaluation for IBM - * Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * * @return a {@link ServiceCall} with a result of type {@link AttachmentCollection} */ @@ -1310,7 +1309,7 @@ public ServiceCall listAttachmentsAccount() { } /** - * Get the latest reports. + * List latest reports. * * Retrieve the latest reports, which are grouped by profile ID, scope ID, and attachment ID. For more information, * see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). @@ -1343,7 +1342,7 @@ public ServiceCall getLatestReports(GetLatestReportsOptions getLat } /** - * Get the latest reports. + * List latest reports. * * Retrieve the latest reports, which are grouped by profile ID, scope ID, and attachment ID. For more information, * see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). @@ -1622,12 +1621,18 @@ public ServiceCall listReportEvaluations(ListReportEvaluationsOp if (listReportEvaluationsOptions.assessmentId() != null) { builder.query("assessment_id", String.valueOf(listReportEvaluationsOptions.assessmentId())); } + if (listReportEvaluationsOptions.assessmentMethod() != null) { + builder.query("assessment_method", String.valueOf(listReportEvaluationsOptions.assessmentMethod())); + } if (listReportEvaluationsOptions.componentId() != null) { builder.query("component_id", String.valueOf(listReportEvaluationsOptions.componentId())); } if (listReportEvaluationsOptions.targetId() != null) { builder.query("target_id", String.valueOf(listReportEvaluationsOptions.targetId())); } + if (listReportEvaluationsOptions.targetEnv() != null) { + builder.query("target_env", String.valueOf(listReportEvaluationsOptions.targetEnv())); + } if (listReportEvaluationsOptions.targetName() != null) { builder.query("target_name", String.valueOf(listReportEvaluationsOptions.targetName())); } @@ -1701,7 +1706,7 @@ public ServiceCall listReportResources(ListReportResourcesOptions } /** - * Get report tags. + * List report tags. * * Retrieve a list of tags for the specified report. For more information, see [Viewing * results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). @@ -1766,85 +1771,10 @@ public ServiceCall getReportViolationsDrift(GetReportViol } /** - * List all provider types. - * - * List all the registered provider types. For more information about connecting Workload Protection with the Security - * and Compliance Center, see [Connecting Workload - * Protection](/docs/security-compliance?topic=security-compliance-setup-workload-protection&interface=api#wp-register). - * - * @param listProviderTypesOptions the {@link ListProviderTypesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProviderTypesCollection} - */ - public ServiceCall listProviderTypes(ListProviderTypesOptions listProviderTypesOptions) { - if (listProviderTypesOptions == null) { - listProviderTypesOptions = new ListProviderTypesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listProviderTypes"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listProviderTypesOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listProviderTypesOptions.xCorrelationId()); - } - if (listProviderTypesOptions.xRequestId() != null) { - builder.header("X-Request-ID", listProviderTypesOptions.xRequestId()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List all provider types. - * - * List all the registered provider types. For more information about connecting Workload Protection with the Security - * and Compliance Center, see [Connecting Workload - * Protection](/docs/security-compliance?topic=security-compliance-setup-workload-protection&interface=api#wp-register). - * - * @return a {@link ServiceCall} with a result of type {@link ProviderTypesCollection} - */ - public ServiceCall listProviderTypes() { - return listProviderTypes(null); - } - - /** - * Get a provider type. - * - * Retrieve a provider type by specifying its ID. For more information about integrations, see [Connecting Workload - * Protection](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). - * - * @param getProviderTypeByIdOptions the {@link GetProviderTypeByIdOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProviderTypeItem} - */ - public ServiceCall getProviderTypeById(GetProviderTypeByIdOptions getProviderTypeByIdOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getProviderTypeByIdOptions, - "getProviderTypeByIdOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("provider_type_id", getProviderTypeByIdOptions.providerTypeId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types/{provider_type_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getProviderTypeById"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (getProviderTypeByIdOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getProviderTypeByIdOptions.xCorrelationId()); - } - if (getProviderTypeByIdOptions.xRequestId() != null) { - builder.header("X-Request-ID", getProviderTypeByIdOptions.xRequestId()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List all provider type instances. + * List provider type instances. * - * Retrieve all instances of provider type. For more information about integrations, see [Connecting Workload - * Protection](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + * Retrieve all instances of a provider type. For more information about integrations, see [Connecting Workload + * Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). * * @param listProviderTypeInstancesOptions the {@link ListProviderTypeInstancesOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstancesResponse} @@ -1875,7 +1805,7 @@ public ServiceCall listProviderTypeInstances(List * Create a provider type instance. * * Create an instance of a provider type. For more information about integrations, see [Connecting Workload - * Protection](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + * Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). * * @param createProviderTypeInstanceOptions the {@link CreateProviderTypeInstanceOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstanceItem} @@ -1898,12 +1828,8 @@ public ServiceCall createProviderTypeInstance(CreatePr builder.header("X-Request-ID", createProviderTypeInstanceOptions.xRequestId()); } final JsonObject contentJson = new JsonObject(); - if (createProviderTypeInstanceOptions.name() != null) { - contentJson.addProperty("name", createProviderTypeInstanceOptions.name()); - } - if (createProviderTypeInstanceOptions.attributes() != null) { - contentJson.add("attributes", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProviderTypeInstanceOptions.attributes())); - } + contentJson.addProperty("name", createProviderTypeInstanceOptions.name()); + contentJson.add("attributes", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProviderTypeInstanceOptions.attributes())); builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -1911,9 +1837,10 @@ public ServiceCall createProviderTypeInstance(CreatePr } /** - * Remove a specific instance of a provider type. + * Delete a provider type instance. * - * Remove a specific instance of a provider type. + * Remove a provider type instance. For more information about integrations, see [Connecting Workload + * Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). * * @param deleteProviderTypeInstanceOptions the {@link DeleteProviderTypeInstanceOptions} containing the options for the call * @return a {@link ServiceCall} with a void result @@ -1940,11 +1867,11 @@ public ServiceCall deleteProviderTypeInstance(DeleteProviderTypeInstanceOp } /** - * List a provider type instance. + * Get a provider type instance. * * Retrieve a provider type instance by specifying the provider type ID, and Security and Compliance Center instance * ID. For more information about integrations, see [Connecting Workload - * Protection](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + * Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). * * @param getProviderTypeInstanceOptions the {@link GetProviderTypeInstanceOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstanceItem} @@ -1973,9 +1900,10 @@ public ServiceCall getProviderTypeInstance(GetProvider } /** - * Patch a specific instance of a provider type. + * Update a provider type instance. * - * Patch a specific instance of a provider type. + * Update a provider type instance. For more information about integrations, see [Connecting Workload + * Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). * * @param updateProviderTypeInstanceOptions the {@link UpdateProviderTypeInstanceOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstanceItem} @@ -1998,23 +1926,17 @@ public ServiceCall updateProviderTypeInstance(UpdatePr if (updateProviderTypeInstanceOptions.xRequestId() != null) { builder.header("X-Request-ID", updateProviderTypeInstanceOptions.xRequestId()); } - final JsonObject contentJson = new JsonObject(); - if (updateProviderTypeInstanceOptions.name() != null) { - contentJson.addProperty("name", updateProviderTypeInstanceOptions.name()); - } - if (updateProviderTypeInstanceOptions.attributes() != null) { - contentJson.add("attributes", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProviderTypeInstanceOptions.attributes())); - } - builder.bodyJson(contentJson); + builder.bodyContent(com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting().toJson(updateProviderTypeInstanceOptions.updateProviderTypeInstanceRequest()), "application/json"); ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get a list of instances for all provider types. + * List instances of provider types. * - * Get a list of instances for all provider types. + * Get a list of all provider types' instances. For more information about integrations, see [Connecting Workload + * Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). * * @param getProviderTypesInstancesOptions the {@link GetProviderTypesInstancesOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ProviderTypesInstancesResponse} @@ -2041,9 +1963,10 @@ public ServiceCall getProviderTypesInstances(Get } /** - * Get a list of instances for all provider types. + * List instances of provider types. * - * Get a list of instances for all provider types. + * Get a list of all provider types' instances. For more information about integrations, see [Connecting Workload + * Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). * * @return a {@link ServiceCall} with a result of type {@link ProviderTypesInstancesResponse} */ @@ -2051,4 +1974,79 @@ public ServiceCall getProviderTypesInstances() { return getProviderTypesInstances(null); } + /** + * List provider types. + * + * List all the registered provider types. For more information about connecting Workload Protection with the Security + * and Compliance Center, see [Connecting Workload + * Protection](/docs/security-compliance?topic=security-compliance-setup-workload-protection&interface=api#wp-register). + * + * @param listProviderTypesOptions the {@link ListProviderTypesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProviderTypesCollection} + */ + public ServiceCall listProviderTypes(ListProviderTypesOptions listProviderTypesOptions) { + if (listProviderTypesOptions == null) { + listProviderTypesOptions = new ListProviderTypesOptions.Builder().build(); + } + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types")); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listProviderTypes"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listProviderTypesOptions.xCorrelationId() != null) { + builder.header("X-Correlation-ID", listProviderTypesOptions.xCorrelationId()); + } + if (listProviderTypesOptions.xRequestId() != null) { + builder.header("X-Request-ID", listProviderTypesOptions.xRequestId()); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List provider types. + * + * List all the registered provider types. For more information about connecting Workload Protection with the Security + * and Compliance Center, see [Connecting Workload + * Protection](/docs/security-compliance?topic=security-compliance-setup-workload-protection&interface=api#wp-register). + * + * @return a {@link ServiceCall} with a result of type {@link ProviderTypesCollection} + */ + public ServiceCall listProviderTypes() { + return listProviderTypes(null); + } + + /** + * Get a provider type. + * + * Retrieve a provider type by specifying its ID. For more information about integrations, see [Connecting Workload + * Protection](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + * + * @param getProviderTypeByIdOptions the {@link GetProviderTypeByIdOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProviderTypeItem} + */ + public ServiceCall getProviderTypeById(GetProviderTypeByIdOptions getProviderTypeByIdOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getProviderTypeByIdOptions, + "getProviderTypeByIdOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("provider_type_id", getProviderTypeByIdOptions.providerTypeId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types/{provider_type_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getProviderTypeById"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getProviderTypeByIdOptions.xCorrelationId() != null) { + builder.header("X-Correlation-ID", getProviderTypeByIdOptions.xCorrelationId()); + } + if (getProviderTypeByIdOptions.xRequestId() != null) { + builder.header("X-Request-ID", getProviderTypeByIdOptions.xRequestId()); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecifications.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecifications.java index da57fcd9..a5e3eaa4 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecifications.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecifications.java @@ -36,8 +36,8 @@ public interface Responsibility { protected String responsibility; @SerializedName("component_id") protected String componentId; - @SerializedName("componenet_name") - protected String componenetName; + @SerializedName("component_name") + protected String componentName; protected String environment; @SerializedName("control_specification_description") protected String controlSpecificationDescription; @@ -52,7 +52,7 @@ public static class Builder { private String controlSpecificationId; private String responsibility; private String componentId; - private String componenetName; + private String componentName; private String environment; private String controlSpecificationDescription; private Long assessmentsCount; @@ -67,7 +67,7 @@ private Builder(ControlSpecifications controlSpecifications) { this.controlSpecificationId = controlSpecifications.controlSpecificationId; this.responsibility = controlSpecifications.responsibility; this.componentId = controlSpecifications.componentId; - this.componenetName = controlSpecifications.componenetName; + this.componentName = controlSpecifications.componentName; this.environment = controlSpecifications.environment; this.controlSpecificationDescription = controlSpecifications.controlSpecificationDescription; this.assessmentsCount = controlSpecifications.assessmentsCount; @@ -139,13 +139,13 @@ public Builder componentId(String componentId) { } /** - * Set the componenetName. + * Set the componentName. * - * @param componenetName the componenetName + * @param componentName the componentName * @return the ControlSpecifications builder */ - public Builder componenetName(String componenetName) { - this.componenetName = componenetName; + public Builder componentName(String componentName) { + this.componentName = componentName; return this; } @@ -201,7 +201,7 @@ protected ControlSpecifications(Builder builder) { controlSpecificationId = builder.controlSpecificationId; responsibility = builder.responsibility; componentId = builder.componentId; - componenetName = builder.componenetName; + componentName = builder.componentName; environment = builder.environment; controlSpecificationDescription = builder.controlSpecificationDescription; assessmentsCount = builder.assessmentsCount; @@ -251,14 +251,14 @@ public String componentId() { } /** - * Gets the componenetName. + * Gets the componentName. * * The component name. * - * @return the componenetName + * @return the componentName */ - public String componenetName() { - return componenetName; + public String componentName() { + return componentName; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateAttachmentOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateAttachmentOptions.java index f6a2cba0..bd6caf84 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateAttachmentOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateAttachmentOptions.java @@ -22,9 +22,8 @@ */ public class CreateAttachmentOptions extends GenericModel { - protected String profilesId; - protected List attachments; protected String profileId; + protected List attachments; protected String xCorrelationId; protected String xRequestId; @@ -32,9 +31,8 @@ public class CreateAttachmentOptions extends GenericModel { * Builder. */ public static class Builder { - private String profilesId; - private List attachments; private String profileId; + private List attachments; private String xCorrelationId; private String xRequestId; @@ -44,7 +42,6 @@ public static class Builder { * @param createAttachmentOptions the instance to initialize the Builder with */ private Builder(CreateAttachmentOptions createAttachmentOptions) { - this.profilesId = createAttachmentOptions.profilesId; this.attachments = createAttachmentOptions.attachments; this.profileId = createAttachmentOptions.profileId; this.xCorrelationId = createAttachmentOptions.xCorrelationId; @@ -60,11 +57,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param profilesId the profilesId + * @param profileId the profileId * @param attachments the attachments */ - public Builder(String profilesId, List attachments) { - this.profilesId = profilesId; + public Builder(String profileId, List attachments) { + this.profileId = profileId; this.attachments = attachments; } @@ -94,13 +91,13 @@ public Builder addAttachments(AttachmentsPrototype attachments) { } /** - * Set the profilesId. + * Set the profileId. * - * @param profilesId the profilesId + * @param profileId the profileId * @return the CreateAttachmentOptions builder */ - public Builder profilesId(String profilesId) { - this.profilesId = profilesId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } @@ -116,17 +113,6 @@ public Builder attachments(List attachments) { return this; } - /** - * Set the profileId. - * - * @param profileId the profileId - * @return the CreateAttachmentOptions builder - */ - public Builder profileId(String profileId) { - this.profileId = profileId; - return this; - } - /** * Set the xCorrelationId. * @@ -165,11 +151,11 @@ public Builder attachmentPrototype(AttachmentPrototype attachmentPrototype) { protected CreateAttachmentOptions() { } protected CreateAttachmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profilesId, - "profilesId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attachments, "attachments cannot be null"); - profilesId = builder.profilesId; + profileId = builder.profileId; attachments = builder.attachments; profileId = builder.profileId; xCorrelationId = builder.xCorrelationId; @@ -186,14 +172,14 @@ public Builder newBuilder() { } /** - * Gets the profilesId. + * Gets the profileId. * * The profile ID. * - * @return the profilesId + * @return the profileId */ - public String profilesId() { - return profilesId; + public String profileId() { + return profileId; } /** @@ -207,17 +193,6 @@ public List attachments() { return attachments; } - /** - * Gets the profileId. - * - * The ID of the profile that is specified in the attachment. - * - * @return the profileId - */ - public String profileId() { - return profileId; - } - /** * Gets the xCorrelationId. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProviderTypeInstanceOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProviderTypeInstanceOptions.java index 1430b900..1cef3d89 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProviderTypeInstanceOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProviderTypeInstanceOptions.java @@ -60,9 +60,13 @@ public Builder() { * Instantiates a new builder with required properties. * * @param providerTypeId the providerTypeId + * @param name the name + * @param attributes the attributes */ - public Builder(String providerTypeId) { + public Builder(String providerTypeId, String name, Map attributes) { this.providerTypeId = providerTypeId; + this.name = name; + this.attributes = attributes; } /** @@ -135,6 +139,10 @@ protected CreateProviderTypeInstanceOptions() { } protected CreateProviderTypeInstanceOptions(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerTypeId, "providerTypeId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); providerTypeId = builder.providerTypeId; name = builder.name; attributes = builder.attributes; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateRuleOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateRuleOptions.java index 2b3cb4ad..40ab889d 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateRuleOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateRuleOptions.java @@ -22,20 +22,9 @@ */ public class CreateRuleOptions extends GenericModel { - /** - * The rule type (user_defined or system_defined). - */ - public interface Type { - /** user_defined. */ - String USER_DEFINED = "user_defined"; - /** system_defined. */ - String SYSTEM_DEFINED = "system_defined"; - } - protected String description; - protected Target target; + protected TargetPrototype target; protected RequiredConfig requiredConfig; - protected String type; protected String version; protected Import xImport; protected List labels; @@ -47,9 +36,8 @@ public interface Type { */ public static class Builder { private String description; - private Target target; + private TargetPrototype target; private RequiredConfig requiredConfig; - private String type; private String version; private Import xImport; private List labels; @@ -65,7 +53,6 @@ private Builder(CreateRuleOptions createRuleOptions) { this.description = createRuleOptions.description; this.target = createRuleOptions.target; this.requiredConfig = createRuleOptions.requiredConfig; - this.type = createRuleOptions.type; this.version = createRuleOptions.version; this.xImport = createRuleOptions.xImport; this.labels = createRuleOptions.labels; @@ -86,7 +73,7 @@ public Builder() { * @param target the target * @param requiredConfig the requiredConfig */ - public Builder(String description, Target target, RequiredConfig requiredConfig) { + public Builder(String description, TargetPrototype target, RequiredConfig requiredConfig) { this.description = description; this.target = target; this.requiredConfig = requiredConfig; @@ -134,7 +121,7 @@ public Builder description(String description) { * @param target the target * @return the CreateRuleOptions builder */ - public Builder target(Target target) { + public Builder target(TargetPrototype target) { this.target = target; return this; } @@ -150,17 +137,6 @@ public Builder requiredConfig(RequiredConfig requiredConfig) { return this; } - /** - * Set the type. - * - * @param type the type - * @return the CreateRuleOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - /** * Set the version. * @@ -230,7 +206,6 @@ protected CreateRuleOptions(Builder builder) { description = builder.description; target = builder.target; requiredConfig = builder.requiredConfig; - type = builder.type; version = builder.version; xImport = builder.xImport; labels = builder.labels; @@ -265,7 +240,7 @@ public String description() { * * @return the target */ - public Target target() { + public TargetPrototype target() { return target; } @@ -280,17 +255,6 @@ public RequiredConfig requiredConfig() { return requiredConfig; } - /** - * Gets the type. - * - * The rule type (user_defined or system_defined). - * - * @return the type - */ - public String type() { - return type; - } - /** * Gets the version. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomProfileOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomProfileOptions.java index 308a90b2..aea57c50 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomProfileOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomProfileOptions.java @@ -19,7 +19,7 @@ */ public class DeleteCustomProfileOptions extends GenericModel { - protected String profilesId; + protected String profileId; protected String xCorrelationId; protected String xRequestId; @@ -27,7 +27,7 @@ public class DeleteCustomProfileOptions extends GenericModel { * Builder. */ public static class Builder { - private String profilesId; + private String profileId; private String xCorrelationId; private String xRequestId; @@ -37,7 +37,7 @@ public static class Builder { * @param deleteCustomProfileOptions the instance to initialize the Builder with */ private Builder(DeleteCustomProfileOptions deleteCustomProfileOptions) { - this.profilesId = deleteCustomProfileOptions.profilesId; + this.profileId = deleteCustomProfileOptions.profileId; this.xCorrelationId = deleteCustomProfileOptions.xCorrelationId; this.xRequestId = deleteCustomProfileOptions.xRequestId; } @@ -51,10 +51,10 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param profilesId the profilesId + * @param profileId the profileId */ - public Builder(String profilesId) { - this.profilesId = profilesId; + public Builder(String profileId) { + this.profileId = profileId; } /** @@ -67,13 +67,13 @@ public DeleteCustomProfileOptions build() { } /** - * Set the profilesId. + * Set the profileId. * - * @param profilesId the profilesId + * @param profileId the profileId * @return the DeleteCustomProfileOptions builder */ - public Builder profilesId(String profilesId) { - this.profilesId = profilesId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } @@ -103,9 +103,9 @@ public Builder xRequestId(String xRequestId) { protected DeleteCustomProfileOptions() { } protected DeleteCustomProfileOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profilesId, - "profilesId cannot be empty"); - profilesId = builder.profilesId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); + profileId = builder.profileId; xCorrelationId = builder.xCorrelationId; xRequestId = builder.xRequestId; } @@ -120,14 +120,14 @@ public Builder newBuilder() { } /** - * Gets the profilesId. + * Gets the profileId. * * The profile ID. * - * @return the profilesId + * @return the profileId */ - public String profilesId() { - return profilesId; + public String profileId() { + return profileId; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProfileAttachmentOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProfileAttachmentOptions.java index 8ec59574..55c596e1 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProfileAttachmentOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProfileAttachmentOptions.java @@ -20,7 +20,7 @@ public class DeleteProfileAttachmentOptions extends GenericModel { protected String attachmentId; - protected String profilesId; + protected String profileId; protected String xCorrelationId; protected String xRequestId; @@ -29,7 +29,7 @@ public class DeleteProfileAttachmentOptions extends GenericModel { */ public static class Builder { private String attachmentId; - private String profilesId; + private String profileId; private String xCorrelationId; private String xRequestId; @@ -40,7 +40,7 @@ public static class Builder { */ private Builder(DeleteProfileAttachmentOptions deleteProfileAttachmentOptions) { this.attachmentId = deleteProfileAttachmentOptions.attachmentId; - this.profilesId = deleteProfileAttachmentOptions.profilesId; + this.profileId = deleteProfileAttachmentOptions.profileId; this.xCorrelationId = deleteProfileAttachmentOptions.xCorrelationId; this.xRequestId = deleteProfileAttachmentOptions.xRequestId; } @@ -55,11 +55,11 @@ public Builder() { * Instantiates a new builder with required properties. * * @param attachmentId the attachmentId - * @param profilesId the profilesId + * @param profileId the profileId */ - public Builder(String attachmentId, String profilesId) { + public Builder(String attachmentId, String profileId) { this.attachmentId = attachmentId; - this.profilesId = profilesId; + this.profileId = profileId; } /** @@ -83,13 +83,13 @@ public Builder attachmentId(String attachmentId) { } /** - * Set the profilesId. + * Set the profileId. * - * @param profilesId the profilesId + * @param profileId the profileId * @return the DeleteProfileAttachmentOptions builder */ - public Builder profilesId(String profilesId) { - this.profilesId = profilesId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } @@ -121,10 +121,10 @@ protected DeleteProfileAttachmentOptions() { } protected DeleteProfileAttachmentOptions(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.attachmentId, "attachmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profilesId, - "profilesId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); attachmentId = builder.attachmentId; - profilesId = builder.profilesId; + profileId = builder.profileId; xCorrelationId = builder.xCorrelationId; xRequestId = builder.xRequestId; } @@ -150,14 +150,14 @@ public String attachmentId() { } /** - * Gets the profilesId. + * Gets the profileId. * * The profile ID. * - * @return the profilesId + * @return the profileId */ - public String profilesId() { - return profilesId; + public String profileId() { + return profileId; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileAttachmentOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileAttachmentOptions.java index ff38879a..4fd305d4 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileAttachmentOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileAttachmentOptions.java @@ -20,7 +20,7 @@ public class GetProfileAttachmentOptions extends GenericModel { protected String attachmentId; - protected String profilesId; + protected String profileId; protected String xCorrelationId; protected String xRequestId; @@ -29,7 +29,7 @@ public class GetProfileAttachmentOptions extends GenericModel { */ public static class Builder { private String attachmentId; - private String profilesId; + private String profileId; private String xCorrelationId; private String xRequestId; @@ -40,7 +40,7 @@ public static class Builder { */ private Builder(GetProfileAttachmentOptions getProfileAttachmentOptions) { this.attachmentId = getProfileAttachmentOptions.attachmentId; - this.profilesId = getProfileAttachmentOptions.profilesId; + this.profileId = getProfileAttachmentOptions.profileId; this.xCorrelationId = getProfileAttachmentOptions.xCorrelationId; this.xRequestId = getProfileAttachmentOptions.xRequestId; } @@ -55,11 +55,11 @@ public Builder() { * Instantiates a new builder with required properties. * * @param attachmentId the attachmentId - * @param profilesId the profilesId + * @param profileId the profileId */ - public Builder(String attachmentId, String profilesId) { + public Builder(String attachmentId, String profileId) { this.attachmentId = attachmentId; - this.profilesId = profilesId; + this.profileId = profileId; } /** @@ -83,13 +83,13 @@ public Builder attachmentId(String attachmentId) { } /** - * Set the profilesId. + * Set the profileId. * - * @param profilesId the profilesId + * @param profileId the profileId * @return the GetProfileAttachmentOptions builder */ - public Builder profilesId(String profilesId) { - this.profilesId = profilesId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } @@ -121,10 +121,10 @@ protected GetProfileAttachmentOptions() { } protected GetProfileAttachmentOptions(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.attachmentId, "attachmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profilesId, - "profilesId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); attachmentId = builder.attachmentId; - profilesId = builder.profilesId; + profileId = builder.profileId; xCorrelationId = builder.xCorrelationId; xRequestId = builder.xRequestId; } @@ -150,14 +150,14 @@ public String attachmentId() { } /** - * Gets the profilesId. + * Gets the profileId. * * The profile ID. * - * @return the profilesId + * @return the profileId */ - public String profilesId() { - return profilesId; + public String profileId() { + return profileId; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileOptions.java index 8268a433..f2715f56 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileOptions.java @@ -19,7 +19,7 @@ */ public class GetProfileOptions extends GenericModel { - protected String profilesId; + protected String profileId; protected String xCorrelationId; protected String xRequestId; @@ -27,7 +27,7 @@ public class GetProfileOptions extends GenericModel { * Builder. */ public static class Builder { - private String profilesId; + private String profileId; private String xCorrelationId; private String xRequestId; @@ -37,7 +37,7 @@ public static class Builder { * @param getProfileOptions the instance to initialize the Builder with */ private Builder(GetProfileOptions getProfileOptions) { - this.profilesId = getProfileOptions.profilesId; + this.profileId = getProfileOptions.profileId; this.xCorrelationId = getProfileOptions.xCorrelationId; this.xRequestId = getProfileOptions.xRequestId; } @@ -51,10 +51,10 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param profilesId the profilesId + * @param profileId the profileId */ - public Builder(String profilesId) { - this.profilesId = profilesId; + public Builder(String profileId) { + this.profileId = profileId; } /** @@ -67,13 +67,13 @@ public GetProfileOptions build() { } /** - * Set the profilesId. + * Set the profileId. * - * @param profilesId the profilesId + * @param profileId the profileId * @return the GetProfileOptions builder */ - public Builder profilesId(String profilesId) { - this.profilesId = profilesId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } @@ -103,9 +103,9 @@ public Builder xRequestId(String xRequestId) { protected GetProfileOptions() { } protected GetProfileOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profilesId, - "profilesId cannot be empty"); - profilesId = builder.profilesId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); + profileId = builder.profileId; xCorrelationId = builder.xCorrelationId; xRequestId = builder.xRequestId; } @@ -120,14 +120,14 @@ public Builder newBuilder() { } /** - * Gets the profilesId. + * Gets the profileId. * * The profile ID. * - * @return the profilesId + * @return the profileId */ - public String profilesId() { - return profilesId; + public String profileId() { + return profileId; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListAttachmentsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListAttachmentsOptions.java index 2d40b1fd..30d518c5 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListAttachmentsOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListAttachmentsOptions.java @@ -19,7 +19,7 @@ */ public class ListAttachmentsOptions extends GenericModel { - protected String profilesId; + protected String profileId; protected String xCorrelationId; protected String xRequestId; protected Long limit; @@ -29,7 +29,7 @@ public class ListAttachmentsOptions extends GenericModel { * Builder. */ public static class Builder { - private String profilesId; + private String profileId; private String xCorrelationId; private String xRequestId; private Long limit; @@ -41,7 +41,7 @@ public static class Builder { * @param listAttachmentsOptions the instance to initialize the Builder with */ private Builder(ListAttachmentsOptions listAttachmentsOptions) { - this.profilesId = listAttachmentsOptions.profilesId; + this.profileId = listAttachmentsOptions.profileId; this.xCorrelationId = listAttachmentsOptions.xCorrelationId; this.xRequestId = listAttachmentsOptions.xRequestId; this.limit = listAttachmentsOptions.limit; @@ -57,10 +57,10 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param profilesId the profilesId + * @param profileId the profileId */ - public Builder(String profilesId) { - this.profilesId = profilesId; + public Builder(String profileId) { + this.profileId = profileId; } /** @@ -73,13 +73,13 @@ public ListAttachmentsOptions build() { } /** - * Set the profilesId. + * Set the profileId. * - * @param profilesId the profilesId + * @param profileId the profileId * @return the ListAttachmentsOptions builder */ - public Builder profilesId(String profilesId) { - this.profilesId = profilesId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } @@ -131,9 +131,9 @@ public Builder start(String start) { protected ListAttachmentsOptions() { } protected ListAttachmentsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profilesId, - "profilesId cannot be empty"); - profilesId = builder.profilesId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); + profileId = builder.profileId; xCorrelationId = builder.xCorrelationId; xRequestId = builder.xRequestId; limit = builder.limit; @@ -150,14 +150,14 @@ public Builder newBuilder() { } /** - * Gets the profilesId. + * Gets the profileId. * * The profile ID. * - * @return the profilesId + * @return the profileId */ - public String profilesId() { - return profilesId; + public String profileId() { + return profileId; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportEvaluationsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportEvaluationsOptions.java index 526be369..50c24557 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportEvaluationsOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportEvaluationsOptions.java @@ -37,8 +37,10 @@ public interface Status { protected String xCorrelationId; protected String xRequestId; protected String assessmentId; + protected String assessmentMethod; protected String componentId; protected String targetId; + protected String targetEnv; protected String targetName; protected String status; protected String start; @@ -52,8 +54,10 @@ public static class Builder { private String xCorrelationId; private String xRequestId; private String assessmentId; + private String assessmentMethod; private String componentId; private String targetId; + private String targetEnv; private String targetName; private String status; private String start; @@ -69,8 +73,10 @@ private Builder(ListReportEvaluationsOptions listReportEvaluationsOptions) { this.xCorrelationId = listReportEvaluationsOptions.xCorrelationId; this.xRequestId = listReportEvaluationsOptions.xRequestId; this.assessmentId = listReportEvaluationsOptions.assessmentId; + this.assessmentMethod = listReportEvaluationsOptions.assessmentMethod; this.componentId = listReportEvaluationsOptions.componentId; this.targetId = listReportEvaluationsOptions.targetId; + this.targetEnv = listReportEvaluationsOptions.targetEnv; this.targetName = listReportEvaluationsOptions.targetName; this.status = listReportEvaluationsOptions.status; this.start = listReportEvaluationsOptions.start; @@ -145,6 +151,17 @@ public Builder assessmentId(String assessmentId) { return this; } + /** + * Set the assessmentMethod. + * + * @param assessmentMethod the assessmentMethod + * @return the ListReportEvaluationsOptions builder + */ + public Builder assessmentMethod(String assessmentMethod) { + this.assessmentMethod = assessmentMethod; + return this; + } + /** * Set the componentId. * @@ -167,6 +184,17 @@ public Builder targetId(String targetId) { return this; } + /** + * Set the targetEnv. + * + * @param targetEnv the targetEnv + * @return the ListReportEvaluationsOptions builder + */ + public Builder targetEnv(String targetEnv) { + this.targetEnv = targetEnv; + return this; + } + /** * Set the targetName. * @@ -221,8 +249,10 @@ protected ListReportEvaluationsOptions(Builder builder) { xCorrelationId = builder.xCorrelationId; xRequestId = builder.xRequestId; assessmentId = builder.assessmentId; + assessmentMethod = builder.assessmentMethod; componentId = builder.componentId; targetId = builder.targetId; + targetEnv = builder.targetEnv; targetName = builder.targetName; status = builder.status; start = builder.start; @@ -286,6 +316,17 @@ public String assessmentId() { return assessmentId; } + /** + * Gets the assessmentMethod. + * + * The assessment method. + * + * @return the assessmentMethod + */ + public String assessmentMethod() { + return assessmentMethod; + } + /** * Gets the componentId. * @@ -308,6 +349,17 @@ public String targetId() { return targetId; } + /** + * Gets the targetEnv. + * + * The environment of the evaluation target. + * + * @return the targetEnv + */ + public String targetEnv() { + return targetEnv; + } + /** * Gets the targetName. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileCollection.java index 53d41102..60203c0b 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileCollection.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileCollection.java @@ -18,7 +18,7 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The response body to get all profiles that are linked to your account. + * The response body to list all profiles that are linked to your account. */ public class ProfileCollection extends GenericModel { diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributes.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributes.java new file mode 100644 index 00000000..16b9d4bf --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributes.java @@ -0,0 +1,27 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.google.gson.reflect.TypeToken; +import com.ibm.cloud.sdk.core.service.model.DynamicModel; + +/** + * The attributes for connecting to the provider type instance. + */ +public class ProviderTypeInstanceAttributes extends DynamicModel { + + + public ProviderTypeInstanceAttributes() { + super(new TypeToken() { }); + } +} diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceItem.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceItem.java index 1b47ce9e..795f87a9 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceItem.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceItem.java @@ -13,7 +13,6 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; import java.util.Date; -import java.util.Map; import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -26,7 +25,7 @@ public class ProviderTypeInstanceItem extends GenericModel { protected String id; protected String type; protected String name; - protected Map attributes; + protected ProviderTypeInstanceAttributes attributes; @SerializedName("created_at") protected Date createdAt; @SerializedName("updated_at") @@ -74,7 +73,7 @@ public String getName() { * * @return the attributes */ - public Map getAttributes() { + public ProviderTypeInstanceAttributes getAttributes() { return attributes; } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileAttachmentOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileAttachmentOptions.java index 5f4f9659..651a91ce 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileAttachmentOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileAttachmentOptions.java @@ -46,9 +46,8 @@ public interface Schedule { } protected String attachmentId; - protected String profilesId; - protected String id; protected String profileId; + protected String id; protected String accountId; protected String instanceId; protected List scope; @@ -72,9 +71,8 @@ public interface Schedule { */ public static class Builder { private String attachmentId; - private String profilesId; - private String id; private String profileId; + private String id; private String accountId; private String instanceId; private List scope; @@ -100,9 +98,8 @@ public static class Builder { */ private Builder(ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions) { this.attachmentId = replaceProfileAttachmentOptions.attachmentId; - this.profilesId = replaceProfileAttachmentOptions.profilesId; - this.id = replaceProfileAttachmentOptions.id; this.profileId = replaceProfileAttachmentOptions.profileId; + this.id = replaceProfileAttachmentOptions.id; this.accountId = replaceProfileAttachmentOptions.accountId; this.instanceId = replaceProfileAttachmentOptions.instanceId; this.scope = replaceProfileAttachmentOptions.scope; @@ -132,11 +129,11 @@ public Builder() { * Instantiates a new builder with required properties. * * @param attachmentId the attachmentId - * @param profilesId the profilesId + * @param profileId the profileId */ - public Builder(String attachmentId, String profilesId) { + public Builder(String attachmentId, String profileId) { this.attachmentId = attachmentId; - this.profilesId = profilesId; + this.profileId = profileId; } /** @@ -192,13 +189,13 @@ public Builder attachmentId(String attachmentId) { } /** - * Set the profilesId. + * Set the profileId. * - * @param profilesId the profilesId + * @param profileId the profileId * @return the ReplaceProfileAttachmentOptions builder */ - public Builder profilesId(String profilesId) { - this.profilesId = profilesId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } @@ -213,17 +210,6 @@ public Builder id(String id) { return this; } - /** - * Set the profileId. - * - * @param profileId the profileId - * @return the ReplaceProfileAttachmentOptions builder - */ - public Builder profileId(String profileId) { - this.profileId = profileId; - return this; - } - /** * Set the accountId. * @@ -446,10 +432,9 @@ protected ReplaceProfileAttachmentOptions() { } protected ReplaceProfileAttachmentOptions(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.attachmentId, "attachmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profilesId, - "profilesId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); attachmentId = builder.attachmentId; - profilesId = builder.profilesId; id = builder.id; profileId = builder.profileId; accountId = builder.accountId; @@ -492,14 +477,14 @@ public String attachmentId() { } /** - * Gets the profilesId. + * Gets the profileId. * * The profile ID. * - * @return the profilesId + * @return the profileId */ - public String profilesId() { - return profilesId; + public String profileId() { + return profileId; } /** @@ -513,17 +498,6 @@ public String id() { return id; } - /** - * Gets the profileId. - * - * The ID of the profile that is specified in the attachment. - * - * @return the profileId - */ - public String profileId() { - return profileId; - } - /** * Gets the accountId. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileOptions.java index 678a66f9..e17b22ee 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileOptions.java @@ -32,7 +32,7 @@ public interface ProfileType { String CUSTOM = "custom"; } - protected String profilesId; + protected String profileId; protected String profileName; protected String profileDescription; protected String profileType; @@ -45,7 +45,7 @@ public interface ProfileType { * Builder. */ public static class Builder { - private String profilesId; + private String profileId; private String profileName; private String profileDescription; private String profileType; @@ -60,7 +60,7 @@ public static class Builder { * @param replaceProfileOptions the instance to initialize the Builder with */ private Builder(ReplaceProfileOptions replaceProfileOptions) { - this.profilesId = replaceProfileOptions.profilesId; + this.profileId = replaceProfileOptions.profileId; this.profileName = replaceProfileOptions.profileName; this.profileDescription = replaceProfileOptions.profileDescription; this.profileType = replaceProfileOptions.profileType; @@ -79,15 +79,15 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param profilesId the profilesId + * @param profileId the profileId * @param profileName the profileName * @param profileDescription the profileDescription * @param profileType the profileType * @param controls the controls * @param defaultParameters the defaultParameters */ - public Builder(String profilesId, String profileName, String profileDescription, String profileType, List controls, List defaultParameters) { - this.profilesId = profilesId; + public Builder(String profileId, String profileName, String profileDescription, String profileType, List controls, List defaultParameters) { + this.profileId = profileId; this.profileName = profileName; this.profileDescription = profileDescription; this.profileType = profileType; @@ -137,13 +137,13 @@ public Builder addDefaultParameters(DefaultParametersPrototype defaultParameters } /** - * Set the profilesId. + * Set the profileId. * - * @param profilesId the profilesId + * @param profileId the profileId * @return the ReplaceProfileOptions builder */ - public Builder profilesId(String profilesId) { - this.profilesId = profilesId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } @@ -230,8 +230,8 @@ public Builder xRequestId(String xRequestId) { protected ReplaceProfileOptions() { } protected ReplaceProfileOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profilesId, - "profilesId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.profileName, "profileName cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.profileDescription, @@ -242,7 +242,7 @@ protected ReplaceProfileOptions(Builder builder) { "controls cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.defaultParameters, "defaultParameters cannot be null"); - profilesId = builder.profilesId; + profileId = builder.profileId; profileName = builder.profileName; profileDescription = builder.profileDescription; profileType = builder.profileType; @@ -262,14 +262,14 @@ public Builder newBuilder() { } /** - * Gets the profilesId. + * Gets the profileId. * * The profile ID. * - * @return the profilesId + * @return the profileId */ - public String profilesId() { - return profilesId; + public String profileId() { + return profileId; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceRuleOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceRuleOptions.java index b67745db..d5355387 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceRuleOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceRuleOptions.java @@ -22,22 +22,11 @@ */ public class ReplaceRuleOptions extends GenericModel { - /** - * The rule type (user_defined or system_defined). - */ - public interface Type { - /** user_defined. */ - String USER_DEFINED = "user_defined"; - /** system_defined. */ - String SYSTEM_DEFINED = "system_defined"; - } - protected String ruleId; protected String ifMatch; protected String description; - protected Target target; + protected TargetPrototype target; protected RequiredConfig requiredConfig; - protected String type; protected String version; protected Import xImport; protected List labels; @@ -51,9 +40,8 @@ public static class Builder { private String ruleId; private String ifMatch; private String description; - private Target target; + private TargetPrototype target; private RequiredConfig requiredConfig; - private String type; private String version; private Import xImport; private List labels; @@ -71,7 +59,6 @@ private Builder(ReplaceRuleOptions replaceRuleOptions) { this.description = replaceRuleOptions.description; this.target = replaceRuleOptions.target; this.requiredConfig = replaceRuleOptions.requiredConfig; - this.type = replaceRuleOptions.type; this.version = replaceRuleOptions.version; this.xImport = replaceRuleOptions.xImport; this.labels = replaceRuleOptions.labels; @@ -94,7 +81,7 @@ public Builder() { * @param target the target * @param requiredConfig the requiredConfig */ - public Builder(String ruleId, String ifMatch, String description, Target target, RequiredConfig requiredConfig) { + public Builder(String ruleId, String ifMatch, String description, TargetPrototype target, RequiredConfig requiredConfig) { this.ruleId = ruleId; this.ifMatch = ifMatch; this.description = description; @@ -166,7 +153,7 @@ public Builder description(String description) { * @param target the target * @return the ReplaceRuleOptions builder */ - public Builder target(Target target) { + public Builder target(TargetPrototype target) { this.target = target; return this; } @@ -182,17 +169,6 @@ public Builder requiredConfig(RequiredConfig requiredConfig) { return this; } - /** - * Set the type. - * - * @param type the type - * @return the ReplaceRuleOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - /** * Set the version. * @@ -268,7 +244,6 @@ protected ReplaceRuleOptions(Builder builder) { description = builder.description; target = builder.target; requiredConfig = builder.requiredConfig; - type = builder.type; version = builder.version; xImport = builder.xImport; labels = builder.labels; @@ -329,7 +304,7 @@ public String description() { * * @return the target */ - public Target target() { + public TargetPrototype target() { return target; } @@ -344,17 +319,6 @@ public RequiredConfig requiredConfig() { return requiredConfig; } - /** - * Gets the type. - * - * The rule type (user_defined or system_defined). - * - * @return the type - */ - public String type() { - return type; - } - /** * Gets the version. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfig.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfig.java index 8c45af75..fd4440a6 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfig.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfig.java @@ -20,8 +20,8 @@ * The required configurations. * * Classes which extend this class: - * - RequiredConfigRequiredConfigAnd - * - RequiredConfigRequiredConfigOr + * - RequiredConfigAnd + * - RequiredConfigOr * - RequiredConfigRequiredConfigBase */ public class RequiredConfig extends GenericModel { diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigAnd.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAnd.java similarity index 67% rename from modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigAnd.java rename to modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAnd.java index 4f37e79d..ad7c0286 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigAnd.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAnd.java @@ -16,9 +16,9 @@ import java.util.List; /** - * RequiredConfigRequiredConfigAnd. + * RequiredConfigAnd. */ -public class RequiredConfigRequiredConfigAnd extends RequiredConfig { +public class RequiredConfigAnd extends RequiredConfig { /** @@ -29,13 +29,13 @@ public static class Builder { private List and; /** - * Instantiates a new Builder from an existing RequiredConfigRequiredConfigAnd instance. + * Instantiates a new Builder from an existing RequiredConfigAnd instance. * - * @param requiredConfigRequiredConfigAnd the instance to initialize the Builder with + * @param requiredConfigAnd the instance to initialize the Builder with */ - public Builder(RequiredConfig requiredConfigRequiredConfigAnd) { - this.description = requiredConfigRequiredConfigAnd.description; - this.and = requiredConfigRequiredConfigAnd.and; + public Builder(RequiredConfig requiredConfigAnd) { + this.description = requiredConfigAnd.description; + this.and = requiredConfigAnd.and; } /** @@ -45,19 +45,19 @@ public Builder() { } /** - * Builds a RequiredConfigRequiredConfigAnd. + * Builds a RequiredConfigAnd. * - * @return the new RequiredConfigRequiredConfigAnd instance + * @return the new RequiredConfigAnd instance */ - public RequiredConfigRequiredConfigAnd build() { - return new RequiredConfigRequiredConfigAnd(this); + public RequiredConfigAnd build() { + return new RequiredConfigAnd(this); } /** * Adds an and to and. * * @param and the new and - * @return the RequiredConfigRequiredConfigAnd builder + * @return the RequiredConfigAnd builder */ public Builder addAnd(RequiredConfigItems and) { com.ibm.cloud.sdk.core.util.Validator.notNull(and, @@ -73,7 +73,7 @@ public Builder addAnd(RequiredConfigItems and) { * Set the description. * * @param description the description - * @return the RequiredConfigRequiredConfigAnd builder + * @return the RequiredConfigAnd builder */ public Builder description(String description) { this.description = description; @@ -85,7 +85,7 @@ public Builder description(String description) { * Existing and will be replaced. * * @param and the and - * @return the RequiredConfigRequiredConfigAnd builder + * @return the RequiredConfigAnd builder */ public Builder and(List and) { this.and = and; @@ -93,9 +93,9 @@ public Builder and(List and) { } } - protected RequiredConfigRequiredConfigAnd() { } + protected RequiredConfigAnd() { } - protected RequiredConfigRequiredConfigAnd(Builder builder) { + protected RequiredConfigAnd(Builder builder) { description = builder.description; and = builder.and; } @@ -103,7 +103,7 @@ protected RequiredConfigRequiredConfigAnd(Builder builder) { /** * New builder. * - * @return a RequiredConfigRequiredConfigAnd builder + * @return a RequiredConfigAnd builder */ public Builder newBuilder() { return new Builder(this); diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigBase.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigBase.java new file mode 100644 index 00000000..1828f57b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigBase.java @@ -0,0 +1,237 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The required configuration base object. + */ +public class RequiredConfigBase extends GenericModel { + + /** + * The operator. + */ + public interface Operator { + /** string_equals. */ + String STRING_EQUALS = "string_equals"; + /** string_not_equals. */ + String STRING_NOT_EQUALS = "string_not_equals"; + /** string_match. */ + String STRING_MATCH = "string_match"; + /** string_not_match. */ + String STRING_NOT_MATCH = "string_not_match"; + /** string_contains. */ + String STRING_CONTAINS = "string_contains"; + /** string_not_contains. */ + String STRING_NOT_CONTAINS = "string_not_contains"; + /** num_equals. */ + String NUM_EQUALS = "num_equals"; + /** num_not_equals. */ + String NUM_NOT_EQUALS = "num_not_equals"; + /** num_less_than. */ + String NUM_LESS_THAN = "num_less_than"; + /** num_less_than_equals. */ + String NUM_LESS_THAN_EQUALS = "num_less_than_equals"; + /** num_greater_than. */ + String NUM_GREATER_THAN = "num_greater_than"; + /** num_greater_than_equals. */ + String NUM_GREATER_THAN_EQUALS = "num_greater_than_equals"; + /** is_empty. */ + String IS_EMPTY = "is_empty"; + /** is_not_empty. */ + String IS_NOT_EMPTY = "is_not_empty"; + /** is_true. */ + String IS_TRUE = "is_true"; + /** is_false. */ + String IS_FALSE = "is_false"; + /** strings_in_list. */ + String STRINGS_IN_LIST = "strings_in_list"; + /** strings_allowed. */ + String STRINGS_ALLOWED = "strings_allowed"; + /** strings_required. */ + String STRINGS_REQUIRED = "strings_required"; + /** ips_in_range. */ + String IPS_IN_RANGE = "ips_in_range"; + /** ips_equals. */ + String IPS_EQUALS = "ips_equals"; + /** ips_not_equals. */ + String IPS_NOT_EQUALS = "ips_not_equals"; + /** days_less_than. */ + String DAYS_LESS_THAN = "days_less_than"; + } + + protected String description; + protected String property; + protected String operator; + protected Object value; + + /** + * Builder. + */ + public static class Builder { + private String description; + private String property; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing RequiredConfigBase instance. + * + * @param requiredConfigBase the instance to initialize the Builder with + */ + private Builder(RequiredConfigBase requiredConfigBase) { + this.description = requiredConfigBase.description; + this.property = requiredConfigBase.property; + this.operator = requiredConfigBase.operator; + this.value = requiredConfigBase.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param property the property + * @param operator the operator + */ + public Builder(String property, String operator) { + this.property = property; + this.operator = operator; + } + + /** + * Builds a RequiredConfigBase. + * + * @return the new RequiredConfigBase instance + */ + public RequiredConfigBase build() { + return new RequiredConfigBase(this); + } + + /** + * Set the description. + * + * @param description the description + * @return the RequiredConfigBase builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the property. + * + * @param property the property + * @return the RequiredConfigBase builder + */ + public Builder property(String property) { + this.property = property; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the RequiredConfigBase builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RequiredConfigBase builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected RequiredConfigBase() { } + + protected RequiredConfigBase(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.property, + "property cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); + description = builder.description; + property = builder.property; + operator = builder.operator; + value = builder.value; + } + + /** + * New builder. + * + * @return a RequiredConfigBase builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the description. + * + * The required config description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the property. + * + * The property. + * + * @return the property + */ + public String property() { + return property; + } + + /** + * Gets the operator. + * + * The operator. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * Schema for any JSON type. + * + * @return the value + */ + public Object value() { + return value; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItems.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItems.java index 4f3247ef..744bd013 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItems.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItems.java @@ -20,8 +20,8 @@ * RequiredConfigItems. * * Classes which extend this class: - * - RequiredConfigItemsRequiredConfigOr - * - RequiredConfigItemsRequiredConfigAnd + * - RequiredConfigItemsRequiredConfigOrDepth1 + * - RequiredConfigItemsRequiredConfigAndDepth1 * - RequiredConfigItemsRequiredConfigBase */ public class RequiredConfigItems extends GenericModel { @@ -79,8 +79,8 @@ public interface Operator { } protected String description; - protected List or; - protected List and; + protected List or; + protected List and; protected String property; protected String operator; protected Object value; @@ -105,7 +105,7 @@ public String description() { * * @return the or */ - public List or() { + public List or() { return or; } @@ -116,7 +116,7 @@ public List or() { * * @return the and */ - public List and() { + public List and() { return and; } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAnd.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndDepth1.java similarity index 58% rename from modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAnd.java rename to modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndDepth1.java index 86889ed2..d1090c14 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAnd.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndDepth1.java @@ -16,9 +16,9 @@ import java.util.List; /** - * RequiredConfigItemsRequiredConfigAnd. + * RequiredConfigItemsRequiredConfigAndDepth1. */ -public class RequiredConfigItemsRequiredConfigAnd extends RequiredConfigItems { +public class RequiredConfigItemsRequiredConfigAndDepth1 extends RequiredConfigItems { /** @@ -26,16 +26,16 @@ public class RequiredConfigItemsRequiredConfigAnd extends RequiredConfigItems { */ public static class Builder { private String description; - private List and; + private List and; /** - * Instantiates a new Builder from an existing RequiredConfigItemsRequiredConfigAnd instance. + * Instantiates a new Builder from an existing RequiredConfigItemsRequiredConfigAndDepth1 instance. * - * @param requiredConfigItemsRequiredConfigAnd the instance to initialize the Builder with + * @param requiredConfigItemsRequiredConfigAndDepth1 the instance to initialize the Builder with */ - public Builder(RequiredConfigItems requiredConfigItemsRequiredConfigAnd) { - this.description = requiredConfigItemsRequiredConfigAnd.description; - this.and = requiredConfigItemsRequiredConfigAnd.and; + public Builder(RequiredConfigItems requiredConfigItemsRequiredConfigAndDepth1) { + this.description = requiredConfigItemsRequiredConfigAndDepth1.description; + this.and = requiredConfigItemsRequiredConfigAndDepth1.and; } /** @@ -45,25 +45,25 @@ public Builder() { } /** - * Builds a RequiredConfigItemsRequiredConfigAnd. + * Builds a RequiredConfigItemsRequiredConfigAndDepth1. * - * @return the new RequiredConfigItemsRequiredConfigAnd instance + * @return the new RequiredConfigItemsRequiredConfigAndDepth1 instance */ - public RequiredConfigItemsRequiredConfigAnd build() { - return new RequiredConfigItemsRequiredConfigAnd(this); + public RequiredConfigItemsRequiredConfigAndDepth1 build() { + return new RequiredConfigItemsRequiredConfigAndDepth1(this); } /** * Adds an and to and. * * @param and the new and - * @return the RequiredConfigItemsRequiredConfigAnd builder + * @return the RequiredConfigItemsRequiredConfigAndDepth1 builder */ - public Builder addAnd(RequiredConfigItems and) { + public Builder addAnd(RequiredConfigBase and) { com.ibm.cloud.sdk.core.util.Validator.notNull(and, "and cannot be null"); if (this.and == null) { - this.and = new ArrayList(); + this.and = new ArrayList(); } this.and.add(and); return this; @@ -73,7 +73,7 @@ public Builder addAnd(RequiredConfigItems and) { * Set the description. * * @param description the description - * @return the RequiredConfigItemsRequiredConfigAnd builder + * @return the RequiredConfigItemsRequiredConfigAndDepth1 builder */ public Builder description(String description) { this.description = description; @@ -85,17 +85,17 @@ public Builder description(String description) { * Existing and will be replaced. * * @param and the and - * @return the RequiredConfigItemsRequiredConfigAnd builder + * @return the RequiredConfigItemsRequiredConfigAndDepth1 builder */ - public Builder and(List and) { + public Builder and(List and) { this.and = and; return this; } } - protected RequiredConfigItemsRequiredConfigAnd() { } + protected RequiredConfigItemsRequiredConfigAndDepth1() { } - protected RequiredConfigItemsRequiredConfigAnd(Builder builder) { + protected RequiredConfigItemsRequiredConfigAndDepth1(Builder builder) { description = builder.description; and = builder.and; } @@ -103,7 +103,7 @@ protected RequiredConfigItemsRequiredConfigAnd(Builder builder) { /** * New builder. * - * @return a RequiredConfigItemsRequiredConfigAnd builder + * @return a RequiredConfigItemsRequiredConfigAndDepth1 builder */ public Builder newBuilder() { return new Builder(this); diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOr.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrDepth1.java similarity index 60% rename from modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOr.java rename to modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrDepth1.java index cce73931..40de3876 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOr.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrDepth1.java @@ -18,7 +18,7 @@ /** * The `OR` required configurations. */ -public class RequiredConfigItemsRequiredConfigOr extends RequiredConfigItems { +public class RequiredConfigItemsRequiredConfigOrDepth1 extends RequiredConfigItems { /** @@ -26,16 +26,16 @@ public class RequiredConfigItemsRequiredConfigOr extends RequiredConfigItems { */ public static class Builder { private String description; - private List or; + private List or; /** - * Instantiates a new Builder from an existing RequiredConfigItemsRequiredConfigOr instance. + * Instantiates a new Builder from an existing RequiredConfigItemsRequiredConfigOrDepth1 instance. * - * @param requiredConfigItemsRequiredConfigOr the instance to initialize the Builder with + * @param requiredConfigItemsRequiredConfigOrDepth1 the instance to initialize the Builder with */ - public Builder(RequiredConfigItems requiredConfigItemsRequiredConfigOr) { - this.description = requiredConfigItemsRequiredConfigOr.description; - this.or = requiredConfigItemsRequiredConfigOr.or; + public Builder(RequiredConfigItems requiredConfigItemsRequiredConfigOrDepth1) { + this.description = requiredConfigItemsRequiredConfigOrDepth1.description; + this.or = requiredConfigItemsRequiredConfigOrDepth1.or; } /** @@ -45,25 +45,25 @@ public Builder() { } /** - * Builds a RequiredConfigItemsRequiredConfigOr. + * Builds a RequiredConfigItemsRequiredConfigOrDepth1. * - * @return the new RequiredConfigItemsRequiredConfigOr instance + * @return the new RequiredConfigItemsRequiredConfigOrDepth1 instance */ - public RequiredConfigItemsRequiredConfigOr build() { - return new RequiredConfigItemsRequiredConfigOr(this); + public RequiredConfigItemsRequiredConfigOrDepth1 build() { + return new RequiredConfigItemsRequiredConfigOrDepth1(this); } /** * Adds an or to or. * * @param or the new or - * @return the RequiredConfigItemsRequiredConfigOr builder + * @return the RequiredConfigItemsRequiredConfigOrDepth1 builder */ - public Builder addOr(RequiredConfigItems or) { + public Builder addOr(RequiredConfigBase or) { com.ibm.cloud.sdk.core.util.Validator.notNull(or, "or cannot be null"); if (this.or == null) { - this.or = new ArrayList(); + this.or = new ArrayList(); } this.or.add(or); return this; @@ -73,7 +73,7 @@ public Builder addOr(RequiredConfigItems or) { * Set the description. * * @param description the description - * @return the RequiredConfigItemsRequiredConfigOr builder + * @return the RequiredConfigItemsRequiredConfigOrDepth1 builder */ public Builder description(String description) { this.description = description; @@ -85,17 +85,17 @@ public Builder description(String description) { * Existing or will be replaced. * * @param or the or - * @return the RequiredConfigItemsRequiredConfigOr builder + * @return the RequiredConfigItemsRequiredConfigOrDepth1 builder */ - public Builder or(List or) { + public Builder or(List or) { this.or = or; return this; } } - protected RequiredConfigItemsRequiredConfigOr() { } + protected RequiredConfigItemsRequiredConfigOrDepth1() { } - protected RequiredConfigItemsRequiredConfigOr(Builder builder) { + protected RequiredConfigItemsRequiredConfigOrDepth1(Builder builder) { description = builder.description; or = builder.or; } @@ -103,7 +103,7 @@ protected RequiredConfigItemsRequiredConfigOr(Builder builder) { /** * New builder. * - * @return a RequiredConfigItemsRequiredConfigOr builder + * @return a RequiredConfigItemsRequiredConfigOrDepth1 builder */ public Builder newBuilder() { return new Builder(this); diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigOr.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOr.java similarity index 68% rename from modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigOr.java rename to modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOr.java index dbacdc0e..a78cf501 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigOr.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOr.java @@ -18,7 +18,7 @@ /** * The `OR` required configurations. */ -public class RequiredConfigRequiredConfigOr extends RequiredConfig { +public class RequiredConfigOr extends RequiredConfig { /** @@ -29,13 +29,13 @@ public static class Builder { private List or; /** - * Instantiates a new Builder from an existing RequiredConfigRequiredConfigOr instance. + * Instantiates a new Builder from an existing RequiredConfigOr instance. * - * @param requiredConfigRequiredConfigOr the instance to initialize the Builder with + * @param requiredConfigOr the instance to initialize the Builder with */ - public Builder(RequiredConfig requiredConfigRequiredConfigOr) { - this.description = requiredConfigRequiredConfigOr.description; - this.or = requiredConfigRequiredConfigOr.or; + public Builder(RequiredConfig requiredConfigOr) { + this.description = requiredConfigOr.description; + this.or = requiredConfigOr.or; } /** @@ -45,19 +45,19 @@ public Builder() { } /** - * Builds a RequiredConfigRequiredConfigOr. + * Builds a RequiredConfigOr. * - * @return the new RequiredConfigRequiredConfigOr instance + * @return the new RequiredConfigOr instance */ - public RequiredConfigRequiredConfigOr build() { - return new RequiredConfigRequiredConfigOr(this); + public RequiredConfigOr build() { + return new RequiredConfigOr(this); } /** * Adds an or to or. * * @param or the new or - * @return the RequiredConfigRequiredConfigOr builder + * @return the RequiredConfigOr builder */ public Builder addOr(RequiredConfigItems or) { com.ibm.cloud.sdk.core.util.Validator.notNull(or, @@ -73,7 +73,7 @@ public Builder addOr(RequiredConfigItems or) { * Set the description. * * @param description the description - * @return the RequiredConfigRequiredConfigOr builder + * @return the RequiredConfigOr builder */ public Builder description(String description) { this.description = description; @@ -85,7 +85,7 @@ public Builder description(String description) { * Existing or will be replaced. * * @param or the or - * @return the RequiredConfigRequiredConfigOr builder + * @return the RequiredConfigOr builder */ public Builder or(List or) { this.or = or; @@ -93,9 +93,9 @@ public Builder or(List or) { } } - protected RequiredConfigRequiredConfigOr() { } + protected RequiredConfigOr() { } - protected RequiredConfigRequiredConfigOr(Builder builder) { + protected RequiredConfigOr(Builder builder) { description = builder.description; or = builder.or; } @@ -103,7 +103,7 @@ protected RequiredConfigRequiredConfigOr(Builder builder) { /** * New builder. * - * @return a RequiredConfigRequiredConfigOr builder + * @return a RequiredConfigOr builder */ public Builder newBuilder() { return new Builder(this); diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Target.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Target.java index 06193702..2709b610 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Target.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Target.java @@ -12,7 +12,6 @@ */ package com.ibm.cloud.security_and_compliance_center_api.v3.model; -import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -32,137 +31,8 @@ public class Target extends GenericModel { @SerializedName("additional_target_attributes") protected List additionalTargetAttributes; - /** - * Builder. - */ - public static class Builder { - private String serviceName; - private String serviceDisplayName; - private String resourceKind; - private List additionalTargetAttributes; - - /** - * Instantiates a new Builder from an existing Target instance. - * - * @param target the instance to initialize the Builder with - */ - private Builder(Target target) { - this.serviceName = target.serviceName; - this.serviceDisplayName = target.serviceDisplayName; - this.resourceKind = target.resourceKind; - this.additionalTargetAttributes = target.additionalTargetAttributes; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Instantiates a new builder with required properties. - * - * @param serviceName the serviceName - * @param resourceKind the resourceKind - */ - public Builder(String serviceName, String resourceKind) { - this.serviceName = serviceName; - this.resourceKind = resourceKind; - } - - /** - * Builds a Target. - * - * @return the new Target instance - */ - public Target build() { - return new Target(this); - } - - /** - * Adds an additionalTargetAttributes to additionalTargetAttributes. - * - * @param additionalTargetAttributes the new additionalTargetAttributes - * @return the Target builder - */ - public Builder addAdditionalTargetAttributes(AdditionalTargetAttribute additionalTargetAttributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull(additionalTargetAttributes, - "additionalTargetAttributes cannot be null"); - if (this.additionalTargetAttributes == null) { - this.additionalTargetAttributes = new ArrayList(); - } - this.additionalTargetAttributes.add(additionalTargetAttributes); - return this; - } - - /** - * Set the serviceName. - * - * @param serviceName the serviceName - * @return the Target builder - */ - public Builder serviceName(String serviceName) { - this.serviceName = serviceName; - return this; - } - - /** - * Set the serviceDisplayName. - * - * @param serviceDisplayName the serviceDisplayName - * @return the Target builder - */ - public Builder serviceDisplayName(String serviceDisplayName) { - this.serviceDisplayName = serviceDisplayName; - return this; - } - - /** - * Set the resourceKind. - * - * @param resourceKind the resourceKind - * @return the Target builder - */ - public Builder resourceKind(String resourceKind) { - this.resourceKind = resourceKind; - return this; - } - - /** - * Set the additionalTargetAttributes. - * Existing additionalTargetAttributes will be replaced. - * - * @param additionalTargetAttributes the additionalTargetAttributes - * @return the Target builder - */ - public Builder additionalTargetAttributes(List additionalTargetAttributes) { - this.additionalTargetAttributes = additionalTargetAttributes; - return this; - } - } - protected Target() { } - protected Target(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, - "serviceName cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resourceKind, - "resourceKind cannot be null"); - serviceName = builder.serviceName; - serviceDisplayName = builder.serviceDisplayName; - resourceKind = builder.resourceKind; - additionalTargetAttributes = builder.additionalTargetAttributes; - } - - /** - * New builder. - * - * @return a Target builder - */ - public Builder newBuilder() { - return new Builder(this); - } - /** * Gets the serviceName. * @@ -170,7 +40,7 @@ public Builder newBuilder() { * * @return the serviceName */ - public String serviceName() { + public String getServiceName() { return serviceName; } @@ -181,7 +51,7 @@ public String serviceName() { * * @return the serviceDisplayName */ - public String serviceDisplayName() { + public String getServiceDisplayName() { return serviceDisplayName; } @@ -192,18 +62,18 @@ public String serviceDisplayName() { * * @return the resourceKind */ - public String resourceKind() { + public String getResourceKind() { return resourceKind; } /** * Gets the additionalTargetAttributes. * - * The list of targets supported properties. + * The additional target attributes used to filter to a subset of resources. * * @return the additionalTargetAttributes */ - public List additionalTargetAttributes() { + public List getAdditionalTargetAttributes() { return additionalTargetAttributes; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototype.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototype.java new file mode 100644 index 00000000..03d4400f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototype.java @@ -0,0 +1,183 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The rule target. + */ +public class TargetPrototype extends GenericModel { + + @SerializedName("service_name") + protected String serviceName; + @SerializedName("resource_kind") + protected String resourceKind; + @SerializedName("additional_target_attributes") + protected List additionalTargetAttributes; + + /** + * Builder. + */ + public static class Builder { + private String serviceName; + private String resourceKind; + private List additionalTargetAttributes; + + /** + * Instantiates a new Builder from an existing TargetPrototype instance. + * + * @param targetPrototype the instance to initialize the Builder with + */ + private Builder(TargetPrototype targetPrototype) { + this.serviceName = targetPrototype.serviceName; + this.resourceKind = targetPrototype.resourceKind; + this.additionalTargetAttributes = targetPrototype.additionalTargetAttributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param serviceName the serviceName + * @param resourceKind the resourceKind + */ + public Builder(String serviceName, String resourceKind) { + this.serviceName = serviceName; + this.resourceKind = resourceKind; + } + + /** + * Builds a TargetPrototype. + * + * @return the new TargetPrototype instance + */ + public TargetPrototype build() { + return new TargetPrototype(this); + } + + /** + * Adds an additionalTargetAttributes to additionalTargetAttributes. + * + * @param additionalTargetAttributes the new additionalTargetAttributes + * @return the TargetPrototype builder + */ + public Builder addAdditionalTargetAttributes(AdditionalTargetAttribute additionalTargetAttributes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(additionalTargetAttributes, + "additionalTargetAttributes cannot be null"); + if (this.additionalTargetAttributes == null) { + this.additionalTargetAttributes = new ArrayList(); + } + this.additionalTargetAttributes.add(additionalTargetAttributes); + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the TargetPrototype builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the resourceKind. + * + * @param resourceKind the resourceKind + * @return the TargetPrototype builder + */ + public Builder resourceKind(String resourceKind) { + this.resourceKind = resourceKind; + return this; + } + + /** + * Set the additionalTargetAttributes. + * Existing additionalTargetAttributes will be replaced. + * + * @param additionalTargetAttributes the additionalTargetAttributes + * @return the TargetPrototype builder + */ + public Builder additionalTargetAttributes(List additionalTargetAttributes) { + this.additionalTargetAttributes = additionalTargetAttributes; + return this; + } + } + + protected TargetPrototype() { } + + protected TargetPrototype(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.serviceName, + "serviceName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resourceKind, + "resourceKind cannot be null"); + serviceName = builder.serviceName; + resourceKind = builder.resourceKind; + additionalTargetAttributes = builder.additionalTargetAttributes; + } + + /** + * New builder. + * + * @return a TargetPrototype builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the serviceName. + * + * The target service name. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the resourceKind. + * + * The target resource kind. + * + * @return the resourceKind + */ + public String resourceKind() { + return resourceKind; + } + + /** + * Gets the additionalTargetAttributes. + * + * The additional target attributes used to filter to a subset of resources. + * + * @return the additionalTargetAttributes + */ + public List additionalTargetAttributes() { + return additionalTargetAttributes; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceOptions.java index 270d946c..b6399c45 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceOptions.java @@ -12,8 +12,6 @@ */ package com.ibm.cloud.security_and_compliance_center_api.v3.model; -import java.util.Map; - import com.ibm.cloud.sdk.core.service.model.GenericModel; /** @@ -23,8 +21,7 @@ public class UpdateProviderTypeInstanceOptions extends GenericModel { protected String providerTypeId; protected String providerTypeInstanceId; - protected String name; - protected Map attributes; + protected UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest; protected String xCorrelationId; protected String xRequestId; @@ -34,8 +31,7 @@ public class UpdateProviderTypeInstanceOptions extends GenericModel { public static class Builder { private String providerTypeId; private String providerTypeInstanceId; - private String name; - private Map attributes; + private UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest; private String xCorrelationId; private String xRequestId; @@ -47,8 +43,7 @@ public static class Builder { private Builder(UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptions) { this.providerTypeId = updateProviderTypeInstanceOptions.providerTypeId; this.providerTypeInstanceId = updateProviderTypeInstanceOptions.providerTypeInstanceId; - this.name = updateProviderTypeInstanceOptions.name; - this.attributes = updateProviderTypeInstanceOptions.attributes; + this.updateProviderTypeInstanceRequest = updateProviderTypeInstanceOptions.updateProviderTypeInstanceRequest; this.xCorrelationId = updateProviderTypeInstanceOptions.xCorrelationId; this.xRequestId = updateProviderTypeInstanceOptions.xRequestId; } @@ -64,10 +59,12 @@ public Builder() { * * @param providerTypeId the providerTypeId * @param providerTypeInstanceId the providerTypeInstanceId + * @param updateProviderTypeInstanceRequest the updateProviderTypeInstanceRequest */ - public Builder(String providerTypeId, String providerTypeInstanceId) { + public Builder(String providerTypeId, String providerTypeInstanceId, UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest) { this.providerTypeId = providerTypeId; this.providerTypeInstanceId = providerTypeInstanceId; + this.updateProviderTypeInstanceRequest = updateProviderTypeInstanceRequest; } /** @@ -102,24 +99,13 @@ public Builder providerTypeInstanceId(String providerTypeInstanceId) { } /** - * Set the name. - * - * @param name the name - * @return the UpdateProviderTypeInstanceOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the attributes. + * Set the updateProviderTypeInstanceRequest. * - * @param attributes the attributes + * @param updateProviderTypeInstanceRequest the updateProviderTypeInstanceRequest * @return the UpdateProviderTypeInstanceOptions builder */ - public Builder attributes(Map attributes) { - this.attributes = attributes; + public Builder updateProviderTypeInstanceRequest(UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest) { + this.updateProviderTypeInstanceRequest = updateProviderTypeInstanceRequest; return this; } @@ -153,10 +139,11 @@ protected UpdateProviderTypeInstanceOptions(Builder builder) { "providerTypeId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerTypeInstanceId, "providerTypeInstanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.updateProviderTypeInstanceRequest, + "updateProviderTypeInstanceRequest cannot be null"); providerTypeId = builder.providerTypeId; providerTypeInstanceId = builder.providerTypeInstanceId; - name = builder.name; - attributes = builder.attributes; + updateProviderTypeInstanceRequest = builder.updateProviderTypeInstanceRequest; xCorrelationId = builder.xCorrelationId; xRequestId = builder.xRequestId; } @@ -193,25 +180,14 @@ public String providerTypeInstanceId() { } /** - * Gets the name. - * - * The provider type instance name. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the attributes. + * Gets the updateProviderTypeInstanceRequest. * - * The attributes for connecting to the provider type instance. + * Provider type instance object to be patched. * - * @return the attributes + * @return the updateProviderTypeInstanceRequest */ - public Map attributes() { - return attributes; + public UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest() { + return updateProviderTypeInstanceRequest; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequest.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequest.java new file mode 100644 index 00000000..2873f3cc --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequest.java @@ -0,0 +1,55 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import java.util.Map; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * UpdateProviderTypeInstanceRequest. + * + * Classes which extend this class: + * - UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName + * - UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes + */ +public class UpdateProviderTypeInstanceRequest extends GenericModel { + + protected String name; + protected Map attributes; + + protected UpdateProviderTypeInstanceRequest() { } + + /** + * Gets the name. + * + * The provider type instance name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the attributes. + * + * The attributes for connecting to the provider type instance. + * + * @return the attributes + */ + public Map attributes() { + return attributes; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes.java new file mode 100644 index 00000000..33f036b3 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes.java @@ -0,0 +1,91 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import java.util.Map; + +/** + * The provider type instance payload for patching attributes. + */ +public class UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes extends UpdateProviderTypeInstanceRequest { + + + /** + * Builder. + */ + public static class Builder { + private Map attributes; + + /** + * Instantiates a new Builder from an existing UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes instance. + * + * @param updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes the instance to initialize the Builder with + */ + public Builder(UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes) { + this.attributes = updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes.attributes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attributes the attributes + */ + public Builder(Map attributes) { + this.attributes = attributes; + } + + /** + * Builds a UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes. + * + * @return the new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes instance + */ + public UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes build() { + return new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes(this); + } + + /** + * Set the attributes. + * + * @param attributes the attributes + * @return the UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes builder + */ + public Builder attributes(Map attributes) { + this.attributes = attributes; + return this; + } + } + + protected UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes() { } + + protected UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attributes, + "attributes cannot be null"); + attributes = builder.attributes; + } + + /** + * New builder. + * + * @return a UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.java new file mode 100644 index 00000000..4e47e383 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.java @@ -0,0 +1,89 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +/** + * The provider type instance payload for patching name. + */ +public class UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName extends UpdateProviderTypeInstanceRequest { + + + /** + * Builder. + */ + public static class Builder { + private String name; + + /** + * Instantiates a new Builder from an existing UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName instance. + * + * @param updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName the instance to initialize the Builder with + */ + public Builder(UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName) { + this.name = updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.name; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + */ + public Builder(String name) { + this.name = name; + } + + /** + * Builds a UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName. + * + * @return the new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName instance + */ + public UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName build() { + return new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + } + + protected UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName() { } + + protected UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + name = builder.name; + } + + /** + * New builder. + * + * @return a UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName builder + */ + public Builder newBuilder() { + return new Builder(this); + } +} + diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiIT.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiIT.java index 52f0c1de..993fad97 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiIT.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiIT.java @@ -111,6 +111,7 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfilesPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Property; import com.ibm.cloud.security_and_compliance_center_api.v3.model.PropertyItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceAttributes; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceItem; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstancesResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeItem; @@ -132,13 +133,14 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportViolationsDrift; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportsPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfig; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItems; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigAndDepth1; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigBase; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigOr; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigBase; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigOr; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Resource; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ResourcePage; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ResourceSummary; @@ -152,8 +154,12 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Target; import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.model.TestEvent; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequest; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSettingsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import com.ibm.cloud.security_and_compliance_center_api.test.SdkIntegrationTestBase; @@ -194,6 +200,7 @@ public class SecurityAndComplianceCenterApiIT extends SdkIntegrationTestBase { String reportIdForReportLink = null; String ruleIdLink = null; String typeForReportLink = null; + String xCorrelationIdLink = null; /** * This method provides our config filename to the base class. @@ -229,7 +236,7 @@ public void constructService() { public void testGetSettings() throws Exception { try { GetSettingsOptions getSettingsOptions = new GetSettingsOptions.Builder() - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .build(); @@ -246,6 +253,7 @@ public void testGetSettings() throws Exception { objectStorageCrnForUpdateSettingsLink = settingsResult.objectStorage().instanceCrn(); objectStorageBucketForUpdateSettingsLink = settingsResult.objectStorage().bucket(); objectStorageLocationForUpdateSettingsLink = settingsResult.objectStorage().bucketLocation(); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -261,9 +269,8 @@ public void testCreateRule() throws Exception { .value("us-east") .build(); - Target targetModel = new Target.Builder() + TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() .serviceName("cloud-object-storage") - .serviceDisplayName("testString") .resourceKind("bucket") .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) .build(); @@ -275,7 +282,7 @@ public void testCreateRule() throws Exception { .value("${hard_quota}") .build(); - RequiredConfigRequiredConfigAnd requiredConfigModel = new RequiredConfigRequiredConfigAnd.Builder() + RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() .description("The Cloud Object Storage rule.") .and(java.util.Arrays.asList(requiredConfigItemsModel)) .build(); @@ -293,13 +300,12 @@ public void testCreateRule() throws Exception { CreateRuleOptions createRuleOptions = new CreateRuleOptions.Builder() .description("Example rule") - .target(targetModel) + .target(targetPrototypeModel) .requiredConfig(requiredConfigModel) - .type("user_defined") .version("1.0.0") .xImport(importModel) .labels(java.util.Arrays.asList()) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .build(); @@ -310,8 +316,8 @@ public void testCreateRule() throws Exception { assertEquals(response.getStatusCode(), 201); Rule ruleResult = response.getResult(); - assertNotNull(ruleResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); ruleIdLink = ruleResult.getId(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", @@ -324,7 +330,7 @@ public void testGetRule() throws Exception { try { GetRuleOptions getRuleOptions = new GetRuleOptions.Builder() .ruleId(ruleIdLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .build(); @@ -344,11 +350,11 @@ public void testGetRule() throws Exception { } } - @Test(dependsOnMethods = { "testCreateRule" }) + @Test(dependsOnMethods = { "testGetRule" }) public void testGetLatestReports() throws Exception { try { GetLatestReportsOptions getLatestReportsOptions = new GetLatestReportsOptions.Builder() - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .sort("profile_name") .build(); @@ -362,6 +368,7 @@ public void testGetLatestReports() throws Exception { ReportLatest reportLatestResult = response.getResult(); assertNotNull(reportLatestResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); accountIdForReportLink = reportLatestResult.getReports().get(0).getAccount().getId(); reportIdForReportLink = reportLatestResult.getReports().get(0).getId(); attachmentIdForReportLink = reportLatestResult.getReports().get(0).getAttachment().getId(); @@ -396,7 +403,7 @@ public void testUpdateSettings() throws Exception { UpdateSettingsOptions updateSettingsOptions = new UpdateSettingsOptions.Builder() .eventNotifications(eventNotificationsModel) .objectStorage(objectStorageModel) - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .build(); @@ -408,35 +415,35 @@ public void testUpdateSettings() throws Exception { Settings settingsResult = response.getResult(); - //assertNotNull(settingsResult); + assertNull(settingsResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - // @Test(dependsOnMethods = { "testUpdateSettings" }) - // public void testPostTestEvent() throws Exception { - // try { - // PostTestEventOptions postTestEventOptions = new PostTestEventOptions.Builder() - // .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") - // .xRequestId("testString") - // .build(); - - // // Invoke operation - // Response response = service.postTestEvent(postTestEventOptions).execute(); - // // Validate response - // assertNotNull(response); - // assertEquals(response.getStatusCode(), 202); - - // TestEvent testEventResult = response.getResult(); - - // assertNotNull(testEventResult); - // } catch (ServiceResponseException e) { - // fail(String.format("Service returned status code %d: %s%nError details: %s", - // e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); - // } - // } + /*@Test(dependsOnMethods = { "testUpdateSettings" }) + public void testPostTestEvent() throws Exception { + try { + PostTestEventOptions postTestEventOptions = new PostTestEventOptions.Builder() + .xCorrelationId(xCorrelationIdLink) + .xRequestId("testString") + .build(); + + // Invoke operation + Response response = service.postTestEvent(postTestEventOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 202); + + TestEvent testEventResult = response.getResult(); + + assertNotNull(testEventResult); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + }*/ @Test(dependsOnMethods = { "testUpdateSettings" }) public void testCreateCustomControlLibrary() throws Exception { @@ -453,7 +460,7 @@ public void testCreateCustomControlLibrary() throws Exception { .assessmentMethod("ibm-cloud-rule") .assessmentType("automated") .assessmentDescription("Check that there is an Activity Tracker event route defined to collect global events generated by IBM Cloud services") - .parameterCount(Long.valueOf("38")) + .parameterCount(Long.valueOf("26")) .parameters(java.util.Arrays.asList(parameterInfoModel)) .build(); @@ -461,10 +468,10 @@ public void testCreateCustomControlLibrary() throws Exception { .controlSpecificationId("5c7d6f88-a92f-4734-9b49-bd22b0900184") .responsibility("user") .componentId("iam-identity") - .componenetName("testString") + .componentName("IAM Identity Service") .environment("ibm-cloud") .controlSpecificationDescription("IBM cloud") - .assessmentsCount(Long.valueOf("38")) + .assessmentsCount(Long.valueOf("26")) .assessments(java.util.Arrays.asList(implementationModel)) .build(); @@ -493,7 +500,7 @@ public void testCreateCustomControlLibrary() throws Exception { .controls(java.util.Arrays.asList(controlsInControlLibModel)) .controlLibraryVersion("1.0.0") .latest(true) - .controlsCount(Long.valueOf("38")) + .controlsCount(Long.valueOf("26")) .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -524,7 +531,6 @@ public void testListControlLibraries() throws Exception { .controlLibraryType("custom") .build(); - // Invoke operation Response response = service.listControlLibraries(listControlLibrariesOptions).execute(); // Validate response @@ -613,7 +619,7 @@ public void testReplaceCustomControlLibrary() throws Exception { .assessmentMethod("ibm-cloud-rule") .assessmentType("automated") .assessmentDescription("Check that there is an Activity Tracker event route defined to collect global events generated by IBM Cloud services") - .parameterCount(Long.valueOf("38")) + .parameterCount(Long.valueOf("26")) .parameters(java.util.Arrays.asList(parameterInfoModel)) .build(); @@ -621,10 +627,10 @@ public void testReplaceCustomControlLibrary() throws Exception { .controlSpecificationId("5c7d6f88-a92f-4734-9b49-bd22b0900184") .responsibility("user") .componentId("iam-identity") - .componenetName("testString") + .componentName("IAM Identity Service") .environment("ibm-cloud") .controlSpecificationDescription("IBM cloud") - .assessmentsCount(Long.valueOf("38")) + .assessmentsCount(Long.valueOf("26")) .assessments(java.util.Arrays.asList(implementationModel)) .build(); @@ -660,8 +666,8 @@ public void testReplaceCustomControlLibrary() throws Exception { .updatedBy("testString") .latest(true) .hierarchyEnabled(true) - .controlsCount(Long.valueOf("38")) - .controlParentsCount(Long.valueOf("38")) + .controlsCount(Long.valueOf("26")) + .controlParentsCount(Long.valueOf("26")) .controls(java.util.Arrays.asList(controlsInControlLibModel)) .xCorrelationId("testString") .xRequestId("testString") @@ -788,7 +794,7 @@ public void testListProfilesWithPager() throws Exception { public void testGetProfile() throws Exception { try { GetProfileOptions getProfileOptions = new GetProfileOptions.Builder() - .profilesId(profileIdLink) + .profileId(profileIdLink) .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -826,7 +832,7 @@ public void testReplaceProfile() throws Exception { .build(); ReplaceProfileOptions replaceProfileOptions = new ReplaceProfileOptions.Builder() - .profilesId(profileIdLink) + .profileId(profileIdLink) .profileName("test_profile1") .profileDescription("test_description1") .profileType("custom") @@ -855,7 +861,7 @@ public void testReplaceProfile() throws Exception { public void testListRules() throws Exception { try { ListRulesOptions listRulesOptions = new ListRulesOptions.Builder() - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .type("system_defined") .search("testString") @@ -886,9 +892,8 @@ public void testReplaceRule() throws Exception { .value("us-south") .build(); - Target targetModel = new Target.Builder() + TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() .serviceName("cloud-object-storage") - .serviceDisplayName("Cloud Object Storage") .resourceKind("bucket") .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) .build(); @@ -900,7 +905,7 @@ public void testReplaceRule() throws Exception { .value("${hard_quota}") .build(); - RequiredConfigRequiredConfigAnd requiredConfigModel = new RequiredConfigRequiredConfigAnd.Builder() + RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() .description("The Cloud Object Storage rule.") .and(java.util.Arrays.asList(requiredConfigItemsModel)) .build(); @@ -920,13 +925,12 @@ public void testReplaceRule() throws Exception { .ruleId(ruleIdLink) .ifMatch(eTagLink) .description("Example rule") - .target(targetModel) + .target(targetPrototypeModel) .requiredConfig(requiredConfigModel) - .type("user_defined") .version("1.0.1") .xImport(importModel) .labels(java.util.Arrays.asList()) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .build(); @@ -949,9 +953,9 @@ public void testReplaceRule() throws Exception { public void testCreateAttachment() throws Exception { try { PropertyItem propertyScopeId = new PropertyItem.Builder() - .name("scope_id") - .value(config.get("ACCOUNTID")) - .build(); + .name("scope_id") + .value(config.get("ACCOUNTID")) + .build(); PropertyItem propertyScopeType = new PropertyItem.Builder() .name("scope_type") @@ -995,7 +999,7 @@ public void testCreateAttachment() throws Exception { .build(); CreateAttachmentOptions createAttachmentOptions = new CreateAttachmentOptions.Builder() - .profilesId(profileIdLink) + .profileId(profileIdLink) .attachments(java.util.Arrays.asList(attachmentsPrototypeModel)) .xCorrelationId("testString") .xRequestId("testString") @@ -1021,7 +1025,7 @@ public void testCreateAttachment() throws Exception { public void testListAttachments() throws Exception { try { ListAttachmentsOptions listAttachmentsOptions = new ListAttachmentsOptions.Builder() - .profilesId(profileIdLink) + .profileId(profileIdLink) .xCorrelationId("testString") .xRequestId("testString") .limit(Long.valueOf("1")) @@ -1046,7 +1050,7 @@ public void testListAttachments() throws Exception { public void testListAttachmentsWithPager() throws Exception { try { ListAttachmentsOptions options = new ListAttachmentsOptions.Builder() - .profilesId(profileIdLink) + .profileId(profileIdLink) .xCorrelationId("testString") .xRequestId("testString") .limit(Long.valueOf("10")) @@ -1081,7 +1085,7 @@ public void testGetProfileAttachment() throws Exception { try { GetProfileAttachmentOptions getProfileAttachmentOptions = new GetProfileAttachmentOptions.Builder() .attachmentId(attachmentIdLink) - .profilesId(profileIdLink) + .profileId(profileIdLink) .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -1105,14 +1109,14 @@ public void testGetProfileAttachment() throws Exception { public void testReplaceProfileAttachment() throws Exception { try { PropertyItem propertyScopeId = new PropertyItem.Builder() - .name("scope_id") + .name("scope_id") .value(config.get("ACCOUNTID")) .build(); PropertyItem propertyScopeType = new PropertyItem.Builder() .name("scope_type") .value("account") - .build(); + .build(); MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() .environment("ibm-cloud") @@ -1146,7 +1150,6 @@ public void testReplaceProfileAttachment() throws Exception { ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions = new ReplaceProfileAttachmentOptions.Builder() .attachmentId(attachmentIdLink) - .profilesId(profileIdLink) .id("testString") .profileId(profileIdLink) .accountId(config.get("ACCOUNTID")) @@ -1211,64 +1214,10 @@ public void testCreateScan() throws Exception { } @Test(dependsOnMethods = { "testCreateScan" }) - public void testListAttachmentsAccount() throws Exception { - try { - ListAttachmentsAccountOptions listAttachmentsAccountOptions = new ListAttachmentsAccountOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("1")) - .build(); - - // Invoke operation - Response response = service.listAttachmentsAccount(listAttachmentsAccountOptions).execute(); - - // Validate response - assertNotNull(response); - assertEquals(response.getStatusCode(), 200); - - AttachmentCollection attachmentCollectionResult = response.getResult(); - - assertNotNull(attachmentCollectionResult); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); - } - } - - @Test(dependsOnMethods = { "testListAttachmentsAccount" }) - public void testListAttachmentsAccountWithPager() throws Exception { - try { - ListAttachmentsAccountOptions options = new ListAttachmentsAccountOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("1")) - .build(); - - // Test getNext(). - List allResults = new ArrayList<>(); - AttachmentsAccountPager pager = new AttachmentsAccountPager(service, options); - if(pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - - assertNotNull(allResults); - assertFalse(allResults.isEmpty()); - - assertEquals(allResults.size(),1); - System.out.println(String.format("Retrieved a total of %d item(s) with pagination.", allResults.size())); - } catch (ServiceResponseException e) { - fail(String.format("Service returned status code %d: %s%nError details: %s", - e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); - } - } - - @Test(dependsOnMethods = { "testListAttachmentsAccount" }) public void testListReports() throws Exception { try { ListReportsOptions listReportsOptions = new ListReportsOptions.Builder() - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .attachmentId(attachmentIdForReportLink) .groupId(groupIdForReportLink) @@ -1287,6 +1236,7 @@ public void testListReports() throws Exception { ReportPage reportPageResult = response.getResult(); assertNotNull(reportPageResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -1297,7 +1247,7 @@ public void testListReports() throws Exception { public void testListReportsWithPager() throws Exception { try { ListReportsOptions options = new ListReportsOptions.Builder() - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .attachmentId(attachmentIdForReportLink) .groupId(groupIdForReportLink) @@ -1331,12 +1281,13 @@ public void testListReportsWithPager() throws Exception { } } + @Test(dependsOnMethods = { "testListReports" }) public void testGetReport() throws Exception { try { GetReportOptions getReportOptions = new GetReportOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .build(); @@ -1349,6 +1300,7 @@ public void testGetReport() throws Exception { Report reportResult = response.getResult(); assertNotNull(reportResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -1360,7 +1312,7 @@ public void testGetReportSummary() throws Exception { try { GetReportSummaryOptions getReportSummaryOptions = new GetReportSummaryOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .build(); @@ -1373,6 +1325,7 @@ public void testGetReportSummary() throws Exception { ReportSummary reportSummaryResult = response.getResult(); assertNotNull(reportSummaryResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -1384,7 +1337,7 @@ public void testGetReportEvaluation() throws Exception { try { GetReportEvaluationOptions getReportEvaluationOptions = new GetReportEvaluationOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .excludeSummary(true) .build(); @@ -1398,18 +1351,19 @@ public void testGetReportEvaluation() throws Exception { InputStream inputStreamResult = response.getResult(); assertNotNull(inputStreamResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testGetReportEvaluation" }) + @Test(dependsOnMethods = { "testGetReportSummary" }) public void testGetReportControls() throws Exception { try { GetReportControlsOptions getReportControlsOptions = new GetReportControlsOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .controlId("testString") .controlName("testString") @@ -1428,6 +1382,7 @@ public void testGetReportControls() throws Exception { ReportControls reportControlsResult = response.getResult(); assertNotNull(reportControlsResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -1439,11 +1394,13 @@ public void testListReportEvaluations() throws Exception { try { ListReportEvaluationsOptions listReportEvaluationsOptions = new ListReportEvaluationsOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .assessmentId("testString") + .assessmentMethod("testString") .componentId("testString") .targetId("testString") + .targetEnv("testString") .targetName("testString") .status("failure") .limit(Long.valueOf("1")) @@ -1458,6 +1415,7 @@ public void testListReportEvaluations() throws Exception { EvaluationPage evaluationPageResult = response.getResult(); assertNotNull(evaluationPageResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -1469,8 +1427,14 @@ public void testListReportEvaluationsWithPager() throws Exception { try { ListReportEvaluationsOptions options = new ListReportEvaluationsOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") + .assessmentId("testString") + .assessmentMethod("testString") + .componentId("testString") + .targetId("testString") + .targetEnv("testString") + .targetName("testString") .status("failure") .limit(Long.valueOf("10")) .build(); @@ -1496,12 +1460,13 @@ public void testListReportEvaluationsWithPager() throws Exception { } } - @Test(dependsOnMethods = { "testListReportEvaluationsWithPager" }) + + @Test(dependsOnMethods = { "testListReportEvaluations" }) public void testListReportResources() throws Exception { try { ListReportResourcesOptions listReportResourcesOptions = new ListReportResourcesOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .id("testString") .resourceName("testString") @@ -1521,6 +1486,7 @@ public void testListReportResources() throws Exception { ResourcePage resourcePageResult = response.getResult(); assertNotNull(resourcePageResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -1532,9 +1498,12 @@ public void testListReportResourcesWithPager() throws Exception { try { ListReportResourcesOptions options = new ListReportResourcesOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") + .id("testString") + .resourceName("testString") .accountId(accountIdForReportLink) + .componentId("testString") .status("compliant") .sort("account_id") .limit(Long.valueOf("10")) @@ -1566,7 +1535,7 @@ public void testGetReportTags() throws Exception { try { GetReportTagsOptions getReportTagsOptions = new GetReportTagsOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .build(); @@ -1579,6 +1548,7 @@ public void testGetReportTags() throws Exception { ReportTags reportTagsResult = response.getResult(); assertNotNull(reportTagsResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -1590,7 +1560,7 @@ public void testGetReportViolationsDrift() throws Exception { try { GetReportViolationsDriftOptions getReportViolationsDriftOptions = new GetReportViolationsDriftOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .scanTimeDuration(Long.valueOf("0")) .build(); @@ -1604,6 +1574,7 @@ public void testGetReportViolationsDrift() throws Exception { ReportViolationsDrift reportViolationsDriftResult = response.getResult(); assertNotNull(reportViolationsDriftResult); + xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -1627,8 +1598,6 @@ public void testListProviderTypes() throws Exception { ProviderTypesCollection providerTypesCollectionResult = response.getResult(); assertNotNull(providerTypesCollectionResult); - providerTypeIdLink = providerTypesCollectionResult.getProviderTypes().get(0).getId(); - for(ProviderTypeItem providerTypeItem: providerTypesCollectionResult.getProviderTypes()){ if(providerTypeItem.getName().equals("workload-protection")){ providerTypeIdLink = providerTypeItem.getId(); @@ -1745,11 +1714,14 @@ public void testGetProviderTypeInstance() throws Exception { @Test(dependsOnMethods = { "testGetProviderTypeInstance" }) public void testUpdateProviderTypeInstance() throws Exception { try { + UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName updateProviderTypeInstanceRequestModel = new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.Builder() + .name("workload-protection-instance-1") + .build(); + UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptions = new UpdateProviderTypeInstanceOptions.Builder() .providerTypeId(providerTypeIdLink) .providerTypeInstanceId(providerTypeInstanceIdLink) - .name("workload-protection-instance-1") - .attributes(java.util.Collections.singletonMap("wp_crn", "crn:v1:staging:public:sysdig-secure:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:0df4004c-fb74-483b-97be-dd9bd35af4d8::")) + .updateProviderTypeInstanceRequest(updateProviderTypeInstanceRequestModel) .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -1797,7 +1769,7 @@ public void testDeleteProfileAttachment() throws Exception { try { DeleteProfileAttachmentOptions deleteProfileAttachmentOptions = new DeleteProfileAttachmentOptions.Builder() .attachmentId(attachmentIdLink) - .profilesId(profileIdLink) + .profileId(profileIdLink) .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -1816,13 +1788,12 @@ public void testDeleteProfileAttachment() throws Exception { e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - - + @Test(dependsOnMethods = { "testDeleteProfileAttachment" }) public void testDeleteCustomProfile() throws Exception { try { DeleteCustomProfileOptions deleteCustomProfileOptions = new DeleteCustomProfileOptions.Builder() - .profilesId(profileIdLink) + .profileId(profileIdLink) .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -1871,7 +1842,7 @@ public void testDeleteRule() throws Exception { try { DeleteRuleOptions deleteRuleOptions = new DeleteRuleOptions.Builder() .ruleId(ruleIdLink) - .xCorrelationId("testString") + .xCorrelationId(xCorrelationIdLink) .xRequestId("testString") .build(); @@ -1886,8 +1857,7 @@ public void testDeleteRule() throws Exception { } } - - @Test(dependsOnMethods = { "testDeleteProfileAttachment" }) + @Test(dependsOnMethods = { "testDeleteRule" }) public void testDeleteProviderTypeInstance() throws Exception { try { DeleteProviderTypeInstanceOptions deleteProviderTypeInstanceOptions = new DeleteProviderTypeInstanceOptions.Builder() diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiTest.java index 1e83cc8f..f9040fb6 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiTest.java @@ -111,6 +111,7 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfilesPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Property; import com.ibm.cloud.security_and_compliance_center_api.v3.model.PropertyItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceAttributes; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceItem; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstancesResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeItem; @@ -132,13 +133,14 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportViolationsDrift; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportsPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfig; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItems; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigAndDepth1; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigBase; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigOr; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigBase; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigOr; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Resource; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ResourcePage; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ResourceSummary; @@ -152,8 +154,12 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Target; import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.model.TestEvent; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequest; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSettingsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.IOException; @@ -209,7 +215,7 @@ public void testConstructServiceURLWithInvalidVariable() throws Throwable { @Test public void testGetSettingsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"event_notifications\": {\"instance_crn\": \"crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"source_id\": \"crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::\", \"source_description\": \"This source is used for integration with IBM Cloud Security and Compliance Center.\", \"source_name\": \"compliance\"}, \"object_storage\": {\"instance_crn\": \"instanceCrn\", \"bucket\": \"bucket\", \"bucket_location\": \"bucketLocation\", \"bucket_endpoint\": \"bucketEndpoint\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}}"; + String mockResponseBody = "{\"event_notifications\": {\"instance_crn\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"source_id\": \"crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::\", \"source_description\": \"This source is used for integration with IBM Cloud Security and Compliance Center.\", \"source_name\": \"compliance\"}, \"object_storage\": {\"instance_crn\": \"instanceCrn\", \"bucket\": \"bucket\", \"bucket_location\": \"bucketLocation\", \"bucket_endpoint\": \"bucketEndpoint\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}}"; String getSettingsPath = "/settings"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -254,7 +260,7 @@ public void testGetSettingsWRetries() throws Throwable { @Test public void testUpdateSettingsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"event_notifications\": {\"instance_crn\": \"crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"source_id\": \"crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::\", \"source_description\": \"This source is used for integration with IBM Cloud Security and Compliance Center.\", \"source_name\": \"compliance\"}, \"object_storage\": {\"instance_crn\": \"instanceCrn\", \"bucket\": \"bucket\", \"bucket_location\": \"bucketLocation\", \"bucket_endpoint\": \"bucketEndpoint\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}}"; + String mockResponseBody = "{\"event_notifications\": {\"instance_crn\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"source_id\": \"crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::\", \"source_description\": \"This source is used for integration with IBM Cloud Security and Compliance Center.\", \"source_name\": \"compliance\"}, \"object_storage\": {\"instance_crn\": \"instanceCrn\", \"bucket\": \"bucket\", \"bucket_location\": \"bucketLocation\", \"bucket_endpoint\": \"bucketEndpoint\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}}"; String updateSettingsPath = "/settings"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -263,16 +269,16 @@ public void testUpdateSettingsWOptions() throws Throwable { // Construct an instance of the EventNotifications model EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .instanceCrn("crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") + .instanceCrn("crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .sourceId("crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::") + .sourceId("crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::") .sourceDescription("This source is used for integration with IBM Cloud Security and Compliance Center.") .sourceName("compliance") .build(); // Construct an instance of the ObjectStorage model ObjectStorage objectStorageModel = new ObjectStorage.Builder() - .instanceCrn("crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") + .instanceCrn("crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") .bucket("px-scan-results") .bucketLocation("us-south") .bucketEndpoint("testString") @@ -483,7 +489,7 @@ public void testListControlLibrariesWithPagerGetAll() throws Throwable { @Test public void testCreateCustomControlLibraryWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"predefined\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"control_library_version\": \"controlLibraryVersion\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"latest\": true, \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19, \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"1fa45e17-9322-4e6c-bbd6-1c51db08e790\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"componenet_name\": \"componenetName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_requirement\": true, \"status\": \"enabled\"}]}"; + String mockResponseBody = "{\"id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"predefined\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"control_library_version\": \"controlLibraryVersion\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"latest\": true, \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19, \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"1fa45e17-9322-4e6c-bbd6-1c51db08e790\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"component_name\": \"componentName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_requirement\": true, \"status\": \"enabled\"}]}"; String createCustomControlLibraryPath = "/control_libraries"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -513,7 +519,7 @@ public void testCreateCustomControlLibraryWOptions() throws Throwable { .controlSpecificationId("5c7d6f88-a92f-4734-9b49-bd22b0900184") .responsibility("user") .componentId("iam-identity") - .componenetName("testString") + .componentName("IAM Identity Service") .environment("ibm-cloud") .controlSpecificationDescription("IBM cloud") .assessmentsCount(Long.valueOf("26")) @@ -646,7 +652,7 @@ public void testDeleteCustomControlLibraryNoOptions() throws Throwable { @Test public void testGetControlLibraryWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"predefined\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"control_library_version\": \"controlLibraryVersion\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"latest\": true, \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19, \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"1fa45e17-9322-4e6c-bbd6-1c51db08e790\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"componenet_name\": \"componenetName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_requirement\": true, \"status\": \"enabled\"}]}"; + String mockResponseBody = "{\"id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"predefined\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"control_library_version\": \"controlLibraryVersion\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"latest\": true, \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19, \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"1fa45e17-9322-4e6c-bbd6-1c51db08e790\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"component_name\": \"componentName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_requirement\": true, \"status\": \"enabled\"}]}"; String getControlLibraryPath = "/control_libraries/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -699,7 +705,7 @@ public void testGetControlLibraryNoOptions() throws Throwable { @Test public void testReplaceCustomControlLibraryWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"predefined\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"control_library_version\": \"controlLibraryVersion\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"latest\": true, \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19, \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"1fa45e17-9322-4e6c-bbd6-1c51db08e790\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"componenet_name\": \"componenetName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_requirement\": true, \"status\": \"enabled\"}]}"; + String mockResponseBody = "{\"id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"predefined\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"control_library_version\": \"controlLibraryVersion\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"latest\": true, \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19, \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"1fa45e17-9322-4e6c-bbd6-1c51db08e790\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"component_name\": \"componentName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_requirement\": true, \"status\": \"enabled\"}]}"; String replaceCustomControlLibraryPath = "/control_libraries/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -729,7 +735,7 @@ public void testReplaceCustomControlLibraryWOptions() throws Throwable { .controlSpecificationId("5c7d6f88-a92f-4734-9b49-bd22b0900184") .responsibility("user") .componentId("iam-identity") - .componenetName("testString") + .componentName("IAM Identity Service") .environment("ibm-cloud") .controlSpecificationDescription("IBM cloud") .assessmentsCount(Long.valueOf("26")) @@ -937,7 +943,7 @@ public void testListProfilesWithPagerGetAll() throws Throwable { @Test public void testCreateProfileWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"predefined\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"instance_id\": \"instanceId\", \"latest\": true, \"hierarchy_enabled\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"controls_count\": 13, \"control_parents_count\": 19, \"attachments_count\": 16, \"controls\": [{\"control_library_id\": \"e98a56ff-dc24-41d4-9875-1e188e2da6cd\", \"control_id\": \"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_requirement\": true, \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications_count\": 26, \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"componenet_name\": \"componenetName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}]}"; + String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"predefined\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"instance_id\": \"instanceId\", \"latest\": true, \"hierarchy_enabled\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"controls_count\": 13, \"control_parents_count\": 19, \"attachments_count\": 16, \"controls\": [{\"control_library_id\": \"e98a56ff-dc24-41d4-9875-1e188e2da6cd\", \"control_id\": \"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_requirement\": true, \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications_count\": 26, \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"component_name\": \"componentName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}]}"; String createProfilePath = "/profiles"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1010,7 +1016,7 @@ public void testCreateProfileNoOptions() throws Throwable { @Test public void testDeleteCustomProfileWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"predefined\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"instance_id\": \"instanceId\", \"latest\": true, \"hierarchy_enabled\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"controls_count\": 13, \"control_parents_count\": 19, \"attachments_count\": 16, \"controls\": [{\"control_library_id\": \"e98a56ff-dc24-41d4-9875-1e188e2da6cd\", \"control_id\": \"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_requirement\": true, \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications_count\": 26, \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"componenet_name\": \"componenetName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}]}"; + String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"predefined\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"instance_id\": \"instanceId\", \"latest\": true, \"hierarchy_enabled\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"controls_count\": 13, \"control_parents_count\": 19, \"attachments_count\": 16, \"controls\": [{\"control_library_id\": \"e98a56ff-dc24-41d4-9875-1e188e2da6cd\", \"control_id\": \"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_requirement\": true, \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications_count\": 26, \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"component_name\": \"componentName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}]}"; String deleteCustomProfilePath = "/profiles/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1019,7 +1025,7 @@ public void testDeleteCustomProfileWOptions() throws Throwable { // Construct an instance of the DeleteCustomProfileOptions model DeleteCustomProfileOptions deleteCustomProfileOptionsModel = new DeleteCustomProfileOptions.Builder() - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -1063,7 +1069,7 @@ public void testDeleteCustomProfileNoOptions() throws Throwable { @Test public void testGetProfileWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"predefined\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"instance_id\": \"instanceId\", \"latest\": true, \"hierarchy_enabled\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"controls_count\": 13, \"control_parents_count\": 19, \"attachments_count\": 16, \"controls\": [{\"control_library_id\": \"e98a56ff-dc24-41d4-9875-1e188e2da6cd\", \"control_id\": \"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_requirement\": true, \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications_count\": 26, \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"componenet_name\": \"componenetName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}]}"; + String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"predefined\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"instance_id\": \"instanceId\", \"latest\": true, \"hierarchy_enabled\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"controls_count\": 13, \"control_parents_count\": 19, \"attachments_count\": 16, \"controls\": [{\"control_library_id\": \"e98a56ff-dc24-41d4-9875-1e188e2da6cd\", \"control_id\": \"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_requirement\": true, \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications_count\": 26, \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"component_name\": \"componentName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}]}"; String getProfilePath = "/profiles/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1072,7 +1078,7 @@ public void testGetProfileWOptions() throws Throwable { // Construct an instance of the GetProfileOptions model GetProfileOptions getProfileOptionsModel = new GetProfileOptions.Builder() - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -1116,7 +1122,7 @@ public void testGetProfileNoOptions() throws Throwable { @Test public void testReplaceProfileWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"predefined\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"instance_id\": \"instanceId\", \"latest\": true, \"hierarchy_enabled\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"controls_count\": 13, \"control_parents_count\": 19, \"attachments_count\": 16, \"controls\": [{\"control_library_id\": \"e98a56ff-dc24-41d4-9875-1e188e2da6cd\", \"control_id\": \"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_requirement\": true, \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications_count\": 26, \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"componenet_name\": \"componenetName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}]}"; + String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"predefined\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"e0923045-f00d-44de-b49b-6f1f0e8033cc\", \"instance_id\": \"instanceId\", \"latest\": true, \"hierarchy_enabled\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"controls_count\": 13, \"control_parents_count\": 19, \"attachments_count\": 16, \"controls\": [{\"control_library_id\": \"e98a56ff-dc24-41d4-9875-1e188e2da6cd\", \"control_id\": \"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_requirement\": true, \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications_count\": 26, \"control_specifications\": [{\"control_specification_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"responsibility\": \"user\", \"component_id\": \"f3517159-889e-4781-819a-89d89b747c85\", \"component_name\": \"componentName\", \"environment\": \"environment\", \"control_specification_description\": \"controlSpecificationDescription\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"assessmentId\", \"assessment_method\": \"assessmentMethod\", \"assessment_type\": \"assessmentType\", \"assessment_description\": \"assessmentDescription\", \"parameter_count\": 14, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}]}"; String replaceProfilePath = "/profiles/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1141,7 +1147,7 @@ public void testReplaceProfileWOptions() throws Throwable { // Construct an instance of the ReplaceProfileOptions model ReplaceProfileOptions replaceProfileOptionsModel = new ReplaceProfileOptions.Builder() - .profilesId("testString") + .profileId("testString") .profileName("test_profile1") .profileDescription("test_description1") .profileType("custom") @@ -1190,7 +1196,7 @@ public void testReplaceProfileNoOptions() throws Throwable { @Test public void testListRulesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"rules\": [{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"id\": \"id\", \"account_id\": \"accountId\", \"description\": \"description\", \"type\": \"user_defined\", \"version\": \"version\", \"import\": {\"parameters\": [{\"name\": \"name\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"string\"}]}, \"target\": {\"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"value\"}]}, \"required_config\": {\"description\": \"description\", \"and\": [{\"description\": \"description\"}]}, \"labels\": [\"labels\"]}]}"; + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"rules\": [{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"id\": \"id\", \"account_id\": \"accountId\", \"description\": \"description\", \"type\": \"user_defined\", \"version\": \"version\", \"import\": {\"parameters\": [{\"name\": \"name\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"string\"}]}, \"target\": {\"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"value\"}]}, \"required_config\": {\"description\": \"description\", \"and\": [{\"description\": \"description\", \"or\": [{\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}]}]}, \"labels\": [\"labels\"]}]}"; String listRulesPath = "/rules"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1241,7 +1247,7 @@ public void testListRulesWRetries() throws Throwable { @Test public void testCreateRuleWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"id\": \"id\", \"account_id\": \"accountId\", \"description\": \"description\", \"type\": \"user_defined\", \"version\": \"version\", \"import\": {\"parameters\": [{\"name\": \"name\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"string\"}]}, \"target\": {\"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"value\"}]}, \"required_config\": {\"description\": \"description\", \"and\": [{\"description\": \"description\"}]}, \"labels\": [\"labels\"]}"; + String mockResponseBody = "{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"id\": \"id\", \"account_id\": \"accountId\", \"description\": \"description\", \"type\": \"user_defined\", \"version\": \"version\", \"import\": {\"parameters\": [{\"name\": \"name\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"string\"}]}, \"target\": {\"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"value\"}]}, \"required_config\": {\"description\": \"description\", \"and\": [{\"description\": \"description\", \"or\": [{\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}]}]}, \"labels\": [\"labels\"]}"; String createRulePath = "/rules"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1255,10 +1261,9 @@ public void testCreateRuleWOptions() throws Throwable { .value("us-east") .build(); - // Construct an instance of the Target model - Target targetModel = new Target.Builder() + // Construct an instance of the TargetPrototype model + TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() .serviceName("cloud-object-storage") - .serviceDisplayName("testString") .resourceKind("bucket") .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) .build(); @@ -1271,8 +1276,8 @@ public void testCreateRuleWOptions() throws Throwable { .value("${hard_quota}") .build(); - // Construct an instance of the RequiredConfigRequiredConfigAnd model - RequiredConfigRequiredConfigAnd requiredConfigModel = new RequiredConfigRequiredConfigAnd.Builder() + // Construct an instance of the RequiredConfigAnd model + RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() .description("The Cloud Object Storage rule.") .and(java.util.Arrays.asList(requiredConfigItemsModel)) .build(); @@ -1293,9 +1298,8 @@ public void testCreateRuleWOptions() throws Throwable { // Construct an instance of the CreateRuleOptions model CreateRuleOptions createRuleOptionsModel = new CreateRuleOptions.Builder() .description("Example rule") - .target(targetModel) + .target(targetPrototypeModel) .requiredConfig(requiredConfigModel) - .type("user_defined") .version("1.0.0") .xImport(importModel) .labels(java.util.Arrays.asList()) @@ -1394,7 +1398,7 @@ public void testDeleteRuleNoOptions() throws Throwable { @Test public void testGetRuleWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"id\": \"id\", \"account_id\": \"accountId\", \"description\": \"description\", \"type\": \"user_defined\", \"version\": \"version\", \"import\": {\"parameters\": [{\"name\": \"name\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"string\"}]}, \"target\": {\"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"value\"}]}, \"required_config\": {\"description\": \"description\", \"and\": [{\"description\": \"description\"}]}, \"labels\": [\"labels\"]}"; + String mockResponseBody = "{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"id\": \"id\", \"account_id\": \"accountId\", \"description\": \"description\", \"type\": \"user_defined\", \"version\": \"version\", \"import\": {\"parameters\": [{\"name\": \"name\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"string\"}]}, \"target\": {\"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"value\"}]}, \"required_config\": {\"description\": \"description\", \"and\": [{\"description\": \"description\", \"or\": [{\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}]}]}, \"labels\": [\"labels\"]}"; String getRulePath = "/rules/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1447,7 +1451,7 @@ public void testGetRuleNoOptions() throws Throwable { @Test public void testReplaceRuleWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"id\": \"id\", \"account_id\": \"accountId\", \"description\": \"description\", \"type\": \"user_defined\", \"version\": \"version\", \"import\": {\"parameters\": [{\"name\": \"name\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"string\"}]}, \"target\": {\"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"value\"}]}, \"required_config\": {\"description\": \"description\", \"and\": [{\"description\": \"description\"}]}, \"labels\": [\"labels\"]}"; + String mockResponseBody = "{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"id\": \"id\", \"account_id\": \"accountId\", \"description\": \"description\", \"type\": \"user_defined\", \"version\": \"version\", \"import\": {\"parameters\": [{\"name\": \"name\", \"display_name\": \"displayName\", \"description\": \"description\", \"type\": \"string\"}]}, \"target\": {\"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"value\"}]}, \"required_config\": {\"description\": \"description\", \"and\": [{\"description\": \"description\", \"or\": [{\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}]}]}, \"labels\": [\"labels\"]}"; String replaceRulePath = "/rules/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -1461,10 +1465,9 @@ public void testReplaceRuleWOptions() throws Throwable { .value("us-south") .build(); - // Construct an instance of the Target model - Target targetModel = new Target.Builder() + // Construct an instance of the TargetPrototype model + TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() .serviceName("cloud-object-storage") - .serviceDisplayName("Cloud Object Storage") .resourceKind("bucket") .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) .build(); @@ -1477,8 +1480,8 @@ public void testReplaceRuleWOptions() throws Throwable { .value("${hard_quota}") .build(); - // Construct an instance of the RequiredConfigRequiredConfigAnd model - RequiredConfigRequiredConfigAnd requiredConfigModel = new RequiredConfigRequiredConfigAnd.Builder() + // Construct an instance of the RequiredConfigAnd model + RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() .description("The Cloud Object Storage rule.") .and(java.util.Arrays.asList(requiredConfigItemsModel)) .build(); @@ -1501,9 +1504,8 @@ public void testReplaceRuleWOptions() throws Throwable { .ruleId("testString") .ifMatch("testString") .description("Example rule") - .target(targetModel) + .target(targetPrototypeModel) .requiredConfig(requiredConfigModel) - .type("user_defined") .version("1.0.1") .xImport(importModel) .labels(java.util.Arrays.asList()) @@ -1561,7 +1563,7 @@ public void testListAttachmentsWOptions() throws Throwable { // Construct an instance of the ListAttachmentsOptions model ListAttachmentsOptions listAttachmentsOptionsModel = new ListAttachmentsOptions.Builder() - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .limit(Long.valueOf("10")) @@ -1625,7 +1627,7 @@ public void testListAttachmentsWithPagerGetNext() throws Throwable { .setBody("{\"message\": \"No more results available!\"}")); ListAttachmentsOptions listAttachmentsOptions = new ListAttachmentsOptions.Builder() - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .limit(Long.valueOf("10")) @@ -1661,7 +1663,7 @@ public void testListAttachmentsWithPagerGetAll() throws Throwable { .setBody("{\"message\": \"No more results available!\"}")); ListAttachmentsOptions listAttachmentsOptions = new ListAttachmentsOptions.Builder() - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .limit(Long.valueOf("10")) @@ -1732,7 +1734,7 @@ public void testCreateAttachmentWOptions() throws Throwable { // Construct an instance of the CreateAttachmentOptions model CreateAttachmentOptions createAttachmentOptionsModel = new CreateAttachmentOptions.Builder() - .profilesId("testString") + .profileId("testString") .attachments(java.util.Arrays.asList(attachmentsPrototypeModel)) .profileId("testString") .xCorrelationId("testString") @@ -1788,7 +1790,7 @@ public void testDeleteProfileAttachmentWOptions() throws Throwable { // Construct an instance of the DeleteProfileAttachmentOptions model DeleteProfileAttachmentOptions deleteProfileAttachmentOptionsModel = new DeleteProfileAttachmentOptions.Builder() .attachmentId("testString") - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -1842,7 +1844,7 @@ public void testGetProfileAttachmentWOptions() throws Throwable { // Construct an instance of the GetProfileAttachmentOptions model GetProfileAttachmentOptions getProfileAttachmentOptionsModel = new GetProfileAttachmentOptions.Builder() .attachmentId("testString") - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -1937,7 +1939,7 @@ public void testReplaceProfileAttachmentWOptions() throws Throwable { // Construct an instance of the ReplaceProfileAttachmentOptions model ReplaceProfileAttachmentOptions replaceProfileAttachmentOptionsModel = new ReplaceProfileAttachmentOptions.Builder() .attachmentId("testString") - .profilesId("testString") + .profileId("testString") .id("testString") .profileId("testString") .accountId("testString") @@ -2642,8 +2644,10 @@ public void testListReportEvaluationsWOptions() throws Throwable { .xCorrelationId("testString") .xRequestId("testString") .assessmentId("testString") + .assessmentMethod("testString") .componentId("testString") .targetId("testString") + .targetEnv("testString") .targetName("testString") .status("failure") .start("testString") @@ -2667,8 +2671,10 @@ public void testListReportEvaluationsWOptions() throws Throwable { Map query = TestUtilities.parseQueryString(request); assertNotNull(query); assertEquals(query.get("assessment_id"), "testString"); + assertEquals(query.get("assessment_method"), "testString"); assertEquals(query.get("component_id"), "testString"); assertEquals(query.get("target_id"), "testString"); + assertEquals(query.get("target_env"), "testString"); assertEquals(query.get("target_name"), "testString"); assertEquals(query.get("status"), "failure"); assertEquals(query.get("start"), "testString"); @@ -2716,8 +2722,10 @@ public void testListReportEvaluationsWithPagerGetNext() throws Throwable { .xCorrelationId("testString") .xRequestId("testString") .assessmentId("testString") + .assessmentMethod("testString") .componentId("testString") .targetId("testString") + .targetEnv("testString") .targetName("testString") .status("failure") .limit(Long.valueOf("10")) @@ -2757,8 +2765,10 @@ public void testListReportEvaluationsWithPagerGetAll() throws Throwable { .xCorrelationId("testString") .xRequestId("testString") .assessmentId("testString") + .assessmentMethod("testString") .componentId("testString") .targetId("testString") + .targetEnv("testString") .targetName("testString") .status("failure") .limit(Long.valueOf("10")) @@ -3027,109 +3037,11 @@ public void testGetReportViolationsDriftNoOptions() throws Throwable { securityAndComplianceCenterApiService.getReportViolationsDrift(null).execute(); } - // Test the listProviderTypes operation with a valid options model parameter - @Test - public void testListProviderTypesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"provider_types\": [{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection\", \"description\": \"Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.\", \"s2s_enabled\": true, \"instance_limit\": 1, \"mode\": \"PULL\", \"data_type\": \"com.sysdig.secure.results\", \"icon\": \"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+\", \"label\": {\"text\": \"1 per instance\", \"tip\": \"Only 1 per instance\"}, \"attributes\": {\"mapKey\": {\"type\": \"text\", \"display_name\": \"Workload Protection Instance CRN\"}}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}]}"; - String listProviderTypesPath = "/provider_types"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListProviderTypesOptions model - ListProviderTypesOptions listProviderTypesOptionsModel = new ListProviderTypesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .build(); - - // Invoke listProviderTypes() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.listProviderTypes(listProviderTypesOptionsModel).execute(); - assertNotNull(response); - ProviderTypesCollection responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listProviderTypesPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the listProviderTypes operation with and without retries enabled - @Test - public void testListProviderTypesWRetries() throws Throwable { - securityAndComplianceCenterApiService.enableRetries(4, 30); - testListProviderTypesWOptions(); - - securityAndComplianceCenterApiService.disableRetries(); - testListProviderTypesWOptions(); - } - - // Test the getProviderTypeById operation with a valid options model parameter - @Test - public void testGetProviderTypeByIdWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection\", \"description\": \"Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.\", \"s2s_enabled\": true, \"instance_limit\": 1, \"mode\": \"PULL\", \"data_type\": \"com.sysdig.secure.results\", \"icon\": \"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+\", \"label\": {\"text\": \"1 per instance\", \"tip\": \"Only 1 per instance\"}, \"attributes\": {\"mapKey\": {\"type\": \"text\", \"display_name\": \"Workload Protection Instance CRN\"}}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}"; - String getProviderTypeByIdPath = "/provider_types/testString"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetProviderTypeByIdOptions model - GetProviderTypeByIdOptions getProviderTypeByIdOptionsModel = new GetProviderTypeByIdOptions.Builder() - .providerTypeId("testString") - .xCorrelationId("testString") - .xRequestId("testString") - .build(); - - // Invoke getProviderTypeById() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.getProviderTypeById(getProviderTypeByIdOptionsModel).execute(); - assertNotNull(response); - ProviderTypeItem responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProviderTypeByIdPath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } - - // Test the getProviderTypeById operation with and without retries enabled - @Test - public void testGetProviderTypeByIdWRetries() throws Throwable { - securityAndComplianceCenterApiService.enableRetries(4, 30); - testGetProviderTypeByIdWOptions(); - - securityAndComplianceCenterApiService.disableRetries(); - testGetProviderTypeByIdWOptions(); - } - - // Test the getProviderTypeById operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetProviderTypeByIdNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.getProviderTypeById(null).execute(); - } - // Test the listProviderTypeInstances operation with a valid options model parameter @Test public void testListProviderTypeInstancesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"provider_type_instances\": [{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {\"anyKey\": \"anyValue\"}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}]}"; + String mockResponseBody = "{\"provider_type_instances\": [{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}]}"; String listProviderTypeInstancesPath = "/provider_types/testString/provider_type_instances"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -3182,7 +3094,7 @@ public void testListProviderTypeInstancesNoOptions() throws Throwable { @Test public void testCreateProviderTypeInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {\"anyKey\": \"anyValue\"}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}"; + String mockResponseBody = "{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}"; String createProviderTypeInstancePath = "/provider_types/testString/provider_type_instances"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -3290,7 +3202,7 @@ public void testDeleteProviderTypeInstanceNoOptions() throws Throwable { @Test public void testGetProviderTypeInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {\"anyKey\": \"anyValue\"}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}"; + String mockResponseBody = "{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}"; String getProviderTypeInstancePath = "/provider_types/testString/provider_type_instances/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -3344,19 +3256,23 @@ public void testGetProviderTypeInstanceNoOptions() throws Throwable { @Test public void testUpdateProviderTypeInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {\"anyKey\": \"anyValue\"}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}"; + String mockResponseBody = "{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}"; String updateProviderTypeInstancePath = "/provider_types/testString/provider_type_instances/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); + // Construct an instance of the UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName model + UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName updateProviderTypeInstanceRequestModel = new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.Builder() + .name("workload-protection-instance-1") + .build(); + // Construct an instance of the UpdateProviderTypeInstanceOptions model UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptionsModel = new UpdateProviderTypeInstanceOptions.Builder() .providerTypeId("testString") .providerTypeInstanceId("testString") - .name("workload-protection-instance-1") - .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) + .updateProviderTypeInstanceRequest(updateProviderTypeInstanceRequestModel) .xCorrelationId("testString") .xRequestId("testString") .build(); @@ -3400,7 +3316,7 @@ public void testUpdateProviderTypeInstanceNoOptions() throws Throwable { @Test public void testGetProviderTypesInstancesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"provider_types_instances\": [{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {\"anyKey\": \"anyValue\"}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}]}"; + String mockResponseBody = "{\"provider_types_instances\": [{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection-instance-1\", \"attributes\": {}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}]}"; String getProviderTypesInstancesPath = "/provider_types_instances"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") @@ -3441,6 +3357,104 @@ public void testGetProviderTypesInstancesWRetries() throws Throwable { testGetProviderTypesInstancesWOptions(); } + // Test the listProviderTypes operation with a valid options model parameter + @Test + public void testListProviderTypesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"provider_types\": [{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection\", \"description\": \"Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.\", \"s2s_enabled\": true, \"instance_limit\": 1, \"mode\": \"PULL\", \"data_type\": \"com.sysdig.secure.results\", \"icon\": \"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+\", \"label\": {\"text\": \"1 per instance\", \"tip\": \"Only 1 per instance\"}, \"attributes\": {\"mapKey\": {\"type\": \"text\", \"display_name\": \"Workload Protection Instance CRN\"}}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}]}"; + String listProviderTypesPath = "/provider_types"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListProviderTypesOptions model + ListProviderTypesOptions listProviderTypesOptionsModel = new ListProviderTypesOptions.Builder() + .xCorrelationId("testString") + .xRequestId("testString") + .build(); + + // Invoke listProviderTypes() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listProviderTypes(listProviderTypesOptionsModel).execute(); + assertNotNull(response); + ProviderTypesCollection responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, listProviderTypesPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the listProviderTypes operation with and without retries enabled + @Test + public void testListProviderTypesWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testListProviderTypesWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testListProviderTypesWOptions(); + } + + // Test the getProviderTypeById operation with a valid options model parameter + @Test + public void testGetProviderTypeByIdWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"7588190cce3c05ac8f7942ea597dafce\", \"type\": \"workload-protection\", \"name\": \"workload-protection\", \"description\": \"Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.\", \"s2s_enabled\": true, \"instance_limit\": 1, \"mode\": \"PULL\", \"data_type\": \"com.sysdig.secure.results\", \"icon\": \"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+\", \"label\": {\"text\": \"1 per instance\", \"tip\": \"Only 1 per instance\"}, \"attributes\": {\"mapKey\": {\"type\": \"text\", \"display_name\": \"Workload Protection Instance CRN\"}}, \"created_at\": \"2023-07-24T13:14:18.884Z\", \"updated_at\": \"2023-07-24T13:14:18.884Z\"}"; + String getProviderTypeByIdPath = "/provider_types/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetProviderTypeByIdOptions model + GetProviderTypeByIdOptions getProviderTypeByIdOptionsModel = new GetProviderTypeByIdOptions.Builder() + .providerTypeId("testString") + .xCorrelationId("testString") + .xRequestId("testString") + .build(); + + // Invoke getProviderTypeById() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getProviderTypeById(getProviderTypeByIdOptionsModel).execute(); + assertNotNull(response); + ProviderTypeItem responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, getProviderTypeByIdPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getProviderTypeById operation with and without retries enabled + @Test + public void testGetProviderTypeByIdWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testGetProviderTypeByIdWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testGetProviderTypeByIdWOptions(); + } + + // Test the getProviderTypeById operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetProviderTypeByIdNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.getProviderTypeById(null).execute(); + } + // Perform setup needed before each test method @BeforeMethod public void beforeEachTest() { diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryTest.java index cdebe2bd..bc0314f1 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryTest.java @@ -67,7 +67,7 @@ public void testControlLibrary() throws Throwable { .controlSpecificationId("f3517159-889e-4781-819a-89d89b747c85") .responsibility("user") .componentId("f3517159-889e-4781-819a-89d89b747c85") - .componenetName("componenet_name") + .componentName("component_name") .environment("environment") .controlSpecificationDescription("control_specification_description") .assessmentsCount(Long.valueOf("1")) @@ -76,7 +76,7 @@ public void testControlLibrary() throws Throwable { assertEquals(controlSpecificationsModel.controlSpecificationId(), "f3517159-889e-4781-819a-89d89b747c85"); assertEquals(controlSpecificationsModel.responsibility(), "user"); assertEquals(controlSpecificationsModel.componentId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModel.componenetName(), "componenet_name"); + assertEquals(controlSpecificationsModel.componentName(), "component_name"); assertEquals(controlSpecificationsModel.environment(), "environment"); assertEquals(controlSpecificationsModel.controlSpecificationDescription(), "control_specification_description"); assertEquals(controlSpecificationsModel.assessmentsCount(), Long.valueOf("1")); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationsTest.java index d09c6b71..f73057ce 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationsTest.java @@ -63,7 +63,7 @@ public void testControlSpecifications() throws Throwable { .controlSpecificationId("f3517159-889e-4781-819a-89d89b747c85") .responsibility("user") .componentId("f3517159-889e-4781-819a-89d89b747c85") - .componenetName("testString") + .componentName("testString") .environment("testString") .controlSpecificationDescription("testString") .assessmentsCount(Long.valueOf("26")) @@ -72,7 +72,7 @@ public void testControlSpecifications() throws Throwable { assertEquals(controlSpecificationsModel.controlSpecificationId(), "f3517159-889e-4781-819a-89d89b747c85"); assertEquals(controlSpecificationsModel.responsibility(), "user"); assertEquals(controlSpecificationsModel.componentId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModel.componenetName(), "testString"); + assertEquals(controlSpecificationsModel.componentName(), "testString"); assertEquals(controlSpecificationsModel.environment(), "testString"); assertEquals(controlSpecificationsModel.controlSpecificationDescription(), "testString"); assertEquals(controlSpecificationsModel.assessmentsCount(), Long.valueOf("26")); @@ -85,7 +85,7 @@ public void testControlSpecifications() throws Throwable { assertEquals(controlSpecificationsModelNew.controlSpecificationId(), "f3517159-889e-4781-819a-89d89b747c85"); assertEquals(controlSpecificationsModelNew.responsibility(), "user"); assertEquals(controlSpecificationsModelNew.componentId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModelNew.componenetName(), "testString"); + assertEquals(controlSpecificationsModelNew.componentName(), "testString"); assertEquals(controlSpecificationsModelNew.environment(), "testString"); assertEquals(controlSpecificationsModelNew.controlSpecificationDescription(), "testString"); assertEquals(controlSpecificationsModelNew.assessmentsCount(), Long.valueOf("26")); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlsInControlLibTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlsInControlLibTest.java index fcd0eb3f..93de43ea 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlsInControlLibTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlsInControlLibTest.java @@ -65,7 +65,7 @@ public void testControlsInControlLib() throws Throwable { .controlSpecificationId("f3517159-889e-4781-819a-89d89b747c85") .responsibility("user") .componentId("f3517159-889e-4781-819a-89d89b747c85") - .componenetName("componenet_name") + .componentName("component_name") .environment("environment") .controlSpecificationDescription("control_specification_description") .assessmentsCount(Long.valueOf("1")) @@ -74,7 +74,7 @@ public void testControlsInControlLib() throws Throwable { assertEquals(controlSpecificationsModel.controlSpecificationId(), "f3517159-889e-4781-819a-89d89b747c85"); assertEquals(controlSpecificationsModel.responsibility(), "user"); assertEquals(controlSpecificationsModel.componentId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModel.componenetName(), "componenet_name"); + assertEquals(controlSpecificationsModel.componentName(), "component_name"); assertEquals(controlSpecificationsModel.environment(), "environment"); assertEquals(controlSpecificationsModel.controlSpecificationDescription(), "control_specification_description"); assertEquals(controlSpecificationsModel.assessmentsCount(), Long.valueOf("1")); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateAttachmentOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateAttachmentOptionsTest.java index 82b4c65c..f7f0cabc 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateAttachmentOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateAttachmentOptionsTest.java @@ -100,13 +100,11 @@ public void testCreateAttachmentOptions() throws Throwable { assertEquals(attachmentsPrototypeModel.attachmentParameters(), java.util.Arrays.asList(attachmentParameterPrototypeModel)); CreateAttachmentOptions createAttachmentOptionsModel = new CreateAttachmentOptions.Builder() - .profilesId("testString") .attachments(java.util.Arrays.asList(attachmentsPrototypeModel)) .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .build(); - assertEquals(createAttachmentOptionsModel.profilesId(), "testString"); assertEquals(createAttachmentOptionsModel.attachments(), java.util.Arrays.asList(attachmentsPrototypeModel)); assertEquals(createAttachmentOptionsModel.profileId(), "testString"); assertEquals(createAttachmentOptionsModel.xCorrelationId(), "testString"); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateCustomControlLibraryOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateCustomControlLibraryOptionsTest.java index 45eee4ef..ace51519 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateCustomControlLibraryOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateCustomControlLibraryOptionsTest.java @@ -66,7 +66,7 @@ public void testCreateCustomControlLibraryOptions() throws Throwable { .controlSpecificationId("f3517159-889e-4781-819a-89d89b747c85") .responsibility("user") .componentId("f3517159-889e-4781-819a-89d89b747c85") - .componenetName("testString") + .componentName("testString") .environment("testString") .controlSpecificationDescription("testString") .assessmentsCount(Long.valueOf("26")) @@ -75,7 +75,7 @@ public void testCreateCustomControlLibraryOptions() throws Throwable { assertEquals(controlSpecificationsModel.controlSpecificationId(), "f3517159-889e-4781-819a-89d89b747c85"); assertEquals(controlSpecificationsModel.responsibility(), "user"); assertEquals(controlSpecificationsModel.componentId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModel.componenetName(), "testString"); + assertEquals(controlSpecificationsModel.componentName(), "testString"); assertEquals(controlSpecificationsModel.environment(), "testString"); assertEquals(controlSpecificationsModel.controlSpecificationDescription(), "testString"); assertEquals(controlSpecificationsModel.assessmentsCount(), Long.valueOf("26")); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateRuleOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateRuleOptionsTest.java index c7c277a0..0c9b6890 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateRuleOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateRuleOptionsTest.java @@ -18,9 +18,10 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateRuleOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Import; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigAnd; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Target; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -46,23 +47,34 @@ public void testCreateRuleOptions() throws Throwable { assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); assertEquals(additionalTargetAttributeModel.value(), "testString"); - Target targetModel = new Target.Builder() + TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() .serviceName("testString") - .serviceDisplayName("testString") .resourceKind("testString") .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) .build(); - assertEquals(targetModel.serviceName(), "testString"); - assertEquals(targetModel.serviceDisplayName(), "testString"); - assertEquals(targetModel.resourceKind(), "testString"); - assertEquals(targetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(targetPrototypeModel.serviceName(), "testString"); + assertEquals(targetPrototypeModel.resourceKind(), "testString"); + assertEquals(targetPrototypeModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); - RequiredConfigItemsRequiredConfigOr requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigOr.Builder() + RequiredConfigBase requiredConfigBaseModel = new RequiredConfigBase.Builder() .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(requiredConfigBaseModel.description(), "testString"); + assertEquals(requiredConfigBaseModel.property(), "testString"); + assertEquals(requiredConfigBaseModel.operator(), "string_equals"); + assertEquals(requiredConfigBaseModel.value(), "testString"); + + RequiredConfigItemsRequiredConfigOrDepth1 requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigOrDepth1.Builder() + .description("testString") + .or(java.util.Arrays.asList(requiredConfigBaseModel)) .build(); assertEquals(requiredConfigItemsModel.description(), "testString"); + assertEquals(requiredConfigItemsModel.or(), java.util.Arrays.asList(requiredConfigBaseModel)); - RequiredConfigRequiredConfigAnd requiredConfigModel = new RequiredConfigRequiredConfigAnd.Builder() + RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() .description("testString") .and(java.util.Arrays.asList(requiredConfigItemsModel)) .build(); @@ -87,9 +99,8 @@ public void testCreateRuleOptions() throws Throwable { CreateRuleOptions createRuleOptionsModel = new CreateRuleOptions.Builder() .description("testString") - .target(targetModel) + .target(targetPrototypeModel) .requiredConfig(requiredConfigModel) - .type("user_defined") .version("testString") .xImport(importModel) .labels(java.util.Arrays.asList("testString")) @@ -97,9 +108,8 @@ public void testCreateRuleOptions() throws Throwable { .xRequestId("testString") .build(); assertEquals(createRuleOptionsModel.description(), "testString"); - assertEquals(createRuleOptionsModel.target(), targetModel); + assertEquals(createRuleOptionsModel.target(), targetPrototypeModel); assertEquals(createRuleOptionsModel.requiredConfig(), requiredConfigModel); - assertEquals(createRuleOptionsModel.type(), "user_defined"); assertEquals(createRuleOptionsModel.version(), "testString"); assertEquals(createRuleOptionsModel.xImport(), importModel); assertEquals(createRuleOptionsModel.labels(), java.util.Arrays.asList("testString")); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomProfileOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomProfileOptionsTest.java index 50ca0a8b..075756e4 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomProfileOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomProfileOptionsTest.java @@ -32,11 +32,11 @@ public class DeleteCustomProfileOptionsTest { @Test public void testDeleteCustomProfileOptions() throws Throwable { DeleteCustomProfileOptions deleteCustomProfileOptionsModel = new DeleteCustomProfileOptions.Builder() - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .build(); - assertEquals(deleteCustomProfileOptionsModel.profilesId(), "testString"); + assertEquals(deleteCustomProfileOptionsModel.profileId(), "testString"); assertEquals(deleteCustomProfileOptionsModel.xCorrelationId(), "testString"); assertEquals(deleteCustomProfileOptionsModel.xRequestId(), "testString"); } diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProfileAttachmentOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProfileAttachmentOptionsTest.java index ac75b2b5..13169d1f 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProfileAttachmentOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProfileAttachmentOptionsTest.java @@ -33,12 +33,12 @@ public class DeleteProfileAttachmentOptionsTest { public void testDeleteProfileAttachmentOptions() throws Throwable { DeleteProfileAttachmentOptions deleteProfileAttachmentOptionsModel = new DeleteProfileAttachmentOptions.Builder() .attachmentId("testString") - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .build(); assertEquals(deleteProfileAttachmentOptionsModel.attachmentId(), "testString"); - assertEquals(deleteProfileAttachmentOptionsModel.profilesId(), "testString"); + assertEquals(deleteProfileAttachmentOptionsModel.profileId(), "testString"); assertEquals(deleteProfileAttachmentOptionsModel.xCorrelationId(), "testString"); assertEquals(deleteProfileAttachmentOptionsModel.xRequestId(), "testString"); } diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsTest.java index 120621a9..da030a22 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsTest.java @@ -33,15 +33,15 @@ public class EventNotificationsTest { @Test public void testEventNotifications() throws Throwable { EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .instanceCrn("crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") + .instanceCrn("crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .sourceId("crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::") + .sourceId("crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::") .sourceDescription("This source is used for integration with IBM Cloud Security and Compliance Center.") .sourceName("compliance") .build(); - assertEquals(eventNotificationsModel.instanceCrn(), "crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::"); + assertEquals(eventNotificationsModel.instanceCrn(), "crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::"); assertEquals(eventNotificationsModel.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(eventNotificationsModel.sourceId(), "crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::"); + assertEquals(eventNotificationsModel.sourceId(), "crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::"); assertEquals(eventNotificationsModel.sourceDescription(), "This source is used for integration with IBM Cloud Security and Compliance Center."); assertEquals(eventNotificationsModel.sourceName(), "compliance"); @@ -49,9 +49,9 @@ public void testEventNotifications() throws Throwable { EventNotifications eventNotificationsModelNew = TestUtilities.deserialize(json, EventNotifications.class); assertTrue(eventNotificationsModelNew instanceof EventNotifications); - assertEquals(eventNotificationsModelNew.instanceCrn(), "crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::"); + assertEquals(eventNotificationsModelNew.instanceCrn(), "crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::"); assertEquals(eventNotificationsModelNew.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(eventNotificationsModelNew.sourceId(), "crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::"); + assertEquals(eventNotificationsModelNew.sourceId(), "crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::"); assertEquals(eventNotificationsModelNew.sourceDescription(), "This source is used for integration with IBM Cloud Security and Compliance Center."); assertEquals(eventNotificationsModelNew.sourceName(), "compliance"); } diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileAttachmentOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileAttachmentOptionsTest.java index bdef3998..82b3745f 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileAttachmentOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileAttachmentOptionsTest.java @@ -33,12 +33,12 @@ public class GetProfileAttachmentOptionsTest { public void testGetProfileAttachmentOptions() throws Throwable { GetProfileAttachmentOptions getProfileAttachmentOptionsModel = new GetProfileAttachmentOptions.Builder() .attachmentId("testString") - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .build(); assertEquals(getProfileAttachmentOptionsModel.attachmentId(), "testString"); - assertEquals(getProfileAttachmentOptionsModel.profilesId(), "testString"); + assertEquals(getProfileAttachmentOptionsModel.profileId(), "testString"); assertEquals(getProfileAttachmentOptionsModel.xCorrelationId(), "testString"); assertEquals(getProfileAttachmentOptionsModel.xRequestId(), "testString"); } diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileOptionsTest.java index 73923e46..058b78a7 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProfileOptionsTest.java @@ -32,11 +32,11 @@ public class GetProfileOptionsTest { @Test public void testGetProfileOptions() throws Throwable { GetProfileOptions getProfileOptionsModel = new GetProfileOptions.Builder() - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .build(); - assertEquals(getProfileOptionsModel.profilesId(), "testString"); + assertEquals(getProfileOptionsModel.profileId(), "testString"); assertEquals(getProfileOptionsModel.xCorrelationId(), "testString"); assertEquals(getProfileOptionsModel.xRequestId(), "testString"); } diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListAttachmentsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListAttachmentsOptionsTest.java index 88fbfc01..77bb486e 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListAttachmentsOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListAttachmentsOptionsTest.java @@ -32,13 +32,13 @@ public class ListAttachmentsOptionsTest { @Test public void testListAttachmentsOptions() throws Throwable { ListAttachmentsOptions listAttachmentsOptionsModel = new ListAttachmentsOptions.Builder() - .profilesId("testString") + .profileId("testString") .xCorrelationId("testString") .xRequestId("testString") .limit(Long.valueOf("50")) .start("testString") .build(); - assertEquals(listAttachmentsOptionsModel.profilesId(), "testString"); + assertEquals(listAttachmentsOptionsModel.profileId(), "testString"); assertEquals(listAttachmentsOptionsModel.xCorrelationId(), "testString"); assertEquals(listAttachmentsOptionsModel.xRequestId(), "testString"); assertEquals(listAttachmentsOptionsModel.limit(), Long.valueOf("50")); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportEvaluationsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportEvaluationsOptionsTest.java index 419079ca..f39a4cd4 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportEvaluationsOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportEvaluationsOptionsTest.java @@ -36,8 +36,10 @@ public void testListReportEvaluationsOptions() throws Throwable { .xCorrelationId("testString") .xRequestId("testString") .assessmentId("testString") + .assessmentMethod("testString") .componentId("testString") .targetId("testString") + .targetEnv("testString") .targetName("testString") .status("failure") .start("testString") @@ -47,8 +49,10 @@ public void testListReportEvaluationsOptions() throws Throwable { assertEquals(listReportEvaluationsOptionsModel.xCorrelationId(), "testString"); assertEquals(listReportEvaluationsOptionsModel.xRequestId(), "testString"); assertEquals(listReportEvaluationsOptionsModel.assessmentId(), "testString"); + assertEquals(listReportEvaluationsOptionsModel.assessmentMethod(), "testString"); assertEquals(listReportEvaluationsOptionsModel.componentId(), "testString"); assertEquals(listReportEvaluationsOptionsModel.targetId(), "testString"); + assertEquals(listReportEvaluationsOptionsModel.targetEnv(), "testString"); assertEquals(listReportEvaluationsOptionsModel.targetName(), "testString"); assertEquals(listReportEvaluationsOptionsModel.status(), "failure"); assertEquals(listReportEvaluationsOptionsModel.start(), "testString"); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributesTest.java similarity index 56% rename from modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrTest.java rename to modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributesTest.java index 3034157a..ed4a99d0 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributesTest.java @@ -14,7 +14,7 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceAttributes; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -23,23 +23,15 @@ import static org.testng.Assert.*; /** - * Unit test class for the RequiredConfigItemsRequiredConfigOr model. + * Unit test class for the ProviderTypeInstanceAttributes model. */ -public class RequiredConfigItemsRequiredConfigOrTest { +public class ProviderTypeInstanceAttributesTest { final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); @Test - public void testRequiredConfigItemsRequiredConfigOr() throws Throwable { - RequiredConfigItemsRequiredConfigOr requiredConfigItemsRequiredConfigOrModel = new RequiredConfigItemsRequiredConfigOr.Builder() - .description("testString") - .build(); - assertEquals(requiredConfigItemsRequiredConfigOrModel.description(), "testString"); - - String json = TestUtilities.serialize(requiredConfigItemsRequiredConfigOrModel); - - RequiredConfigItemsRequiredConfigOr requiredConfigItemsRequiredConfigOrModelNew = TestUtilities.deserialize(json, RequiredConfigItemsRequiredConfigOr.class); - assertTrue(requiredConfigItemsRequiredConfigOrModelNew instanceof RequiredConfigItemsRequiredConfigOr); - assertEquals(requiredConfigItemsRequiredConfigOrModelNew.description(), "testString"); + public void testProviderTypeInstanceAttributes() throws Throwable { + ProviderTypeInstanceAttributes providerTypeInstanceAttributesModel = new ProviderTypeInstanceAttributes(); + assertNotNull(providerTypeInstanceAttributesModel); } } \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceItemTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceItemTest.java index 43f490e8..cacbb9c8 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceItemTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceItemTest.java @@ -14,6 +14,7 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceAttributes; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceItem; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstancesResponseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstancesResponseTest.java index 7d94ee45..45043cc7 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstancesResponseTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstancesResponseTest.java @@ -15,6 +15,7 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceAttributes; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceItem; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstancesResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypesInstancesResponseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypesInstancesResponseTest.java index 841ae8f2..2e1a927c 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypesInstancesResponseTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypesInstancesResponseTest.java @@ -15,6 +15,7 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceAttributes; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceItem; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypesInstancesResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceCustomControlLibraryOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceCustomControlLibraryOptionsTest.java index fb24cac2..12f51158 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceCustomControlLibraryOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceCustomControlLibraryOptionsTest.java @@ -67,7 +67,7 @@ public void testReplaceCustomControlLibraryOptions() throws Throwable { .controlSpecificationId("f3517159-889e-4781-819a-89d89b747c85") .responsibility("user") .componentId("f3517159-889e-4781-819a-89d89b747c85") - .componenetName("testString") + .componentName("testString") .environment("testString") .controlSpecificationDescription("testString") .assessmentsCount(Long.valueOf("26")) @@ -76,7 +76,7 @@ public void testReplaceCustomControlLibraryOptions() throws Throwable { assertEquals(controlSpecificationsModel.controlSpecificationId(), "f3517159-889e-4781-819a-89d89b747c85"); assertEquals(controlSpecificationsModel.responsibility(), "user"); assertEquals(controlSpecificationsModel.componentId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModel.componenetName(), "testString"); + assertEquals(controlSpecificationsModel.componentName(), "testString"); assertEquals(controlSpecificationsModel.environment(), "testString"); assertEquals(controlSpecificationsModel.controlSpecificationDescription(), "testString"); assertEquals(controlSpecificationsModel.assessmentsCount(), Long.valueOf("26")); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileAttachmentOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileAttachmentOptionsTest.java index 862b5138..031b2742 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileAttachmentOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileAttachmentOptionsTest.java @@ -92,7 +92,6 @@ public void testReplaceProfileAttachmentOptions() throws Throwable { ReplaceProfileAttachmentOptions replaceProfileAttachmentOptionsModel = new ReplaceProfileAttachmentOptions.Builder() .attachmentId("testString") - .profilesId("testString") .id("130003ea8bfa43c5aacea07a86da3000") .profileId("7ec45986-54fc-4b66-a303-d9577b078c65") .accountId("130003ea8bfa43c5aacea07a86da3000") @@ -114,7 +113,6 @@ public void testReplaceProfileAttachmentOptions() throws Throwable { .xRequestId("testString") .build(); assertEquals(replaceProfileAttachmentOptionsModel.attachmentId(), "testString"); - assertEquals(replaceProfileAttachmentOptionsModel.profilesId(), "testString"); assertEquals(replaceProfileAttachmentOptionsModel.id(), "130003ea8bfa43c5aacea07a86da3000"); assertEquals(replaceProfileAttachmentOptionsModel.profileId(), "7ec45986-54fc-4b66-a303-d9577b078c65"); assertEquals(replaceProfileAttachmentOptionsModel.accountId(), "130003ea8bfa43c5aacea07a86da3000"); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileOptionsTest.java index 6a78d864..b3b71f15 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileOptionsTest.java @@ -56,7 +56,7 @@ public void testReplaceProfileOptions() throws Throwable { assertEquals(defaultParametersPrototypeModel.parameterType(), "string"); ReplaceProfileOptions replaceProfileOptionsModel = new ReplaceProfileOptions.Builder() - .profilesId("testString") + .profileId("testString") .profileName("testString") .profileDescription("testString") .profileType("predefined") @@ -65,7 +65,6 @@ public void testReplaceProfileOptions() throws Throwable { .xCorrelationId("testString") .xRequestId("testString") .build(); - assertEquals(replaceProfileOptionsModel.profilesId(), "testString"); assertEquals(replaceProfileOptionsModel.profileName(), "testString"); assertEquals(replaceProfileOptionsModel.profileDescription(), "testString"); assertEquals(replaceProfileOptionsModel.profileType(), "predefined"); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceRuleOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceRuleOptionsTest.java index d90b030d..8842b0b6 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceRuleOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceRuleOptionsTest.java @@ -18,9 +18,10 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.Import; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceRuleOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigAnd; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Target; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -46,23 +47,34 @@ public void testReplaceRuleOptions() throws Throwable { assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); assertEquals(additionalTargetAttributeModel.value(), "testString"); - Target targetModel = new Target.Builder() + TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() .serviceName("testString") - .serviceDisplayName("testString") .resourceKind("testString") .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) .build(); - assertEquals(targetModel.serviceName(), "testString"); - assertEquals(targetModel.serviceDisplayName(), "testString"); - assertEquals(targetModel.resourceKind(), "testString"); - assertEquals(targetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(targetPrototypeModel.serviceName(), "testString"); + assertEquals(targetPrototypeModel.resourceKind(), "testString"); + assertEquals(targetPrototypeModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); - RequiredConfigItemsRequiredConfigOr requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigOr.Builder() + RequiredConfigBase requiredConfigBaseModel = new RequiredConfigBase.Builder() .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(requiredConfigBaseModel.description(), "testString"); + assertEquals(requiredConfigBaseModel.property(), "testString"); + assertEquals(requiredConfigBaseModel.operator(), "string_equals"); + assertEquals(requiredConfigBaseModel.value(), "testString"); + + RequiredConfigItemsRequiredConfigOrDepth1 requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigOrDepth1.Builder() + .description("testString") + .or(java.util.Arrays.asList(requiredConfigBaseModel)) .build(); assertEquals(requiredConfigItemsModel.description(), "testString"); + assertEquals(requiredConfigItemsModel.or(), java.util.Arrays.asList(requiredConfigBaseModel)); - RequiredConfigRequiredConfigAnd requiredConfigModel = new RequiredConfigRequiredConfigAnd.Builder() + RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() .description("testString") .and(java.util.Arrays.asList(requiredConfigItemsModel)) .build(); @@ -89,9 +101,8 @@ public void testReplaceRuleOptions() throws Throwable { .ruleId("testString") .ifMatch("testString") .description("testString") - .target(targetModel) + .target(targetPrototypeModel) .requiredConfig(requiredConfigModel) - .type("user_defined") .version("testString") .xImport(importModel) .labels(java.util.Arrays.asList("testString")) @@ -101,9 +112,8 @@ public void testReplaceRuleOptions() throws Throwable { assertEquals(replaceRuleOptionsModel.ruleId(), "testString"); assertEquals(replaceRuleOptionsModel.ifMatch(), "testString"); assertEquals(replaceRuleOptionsModel.description(), "testString"); - assertEquals(replaceRuleOptionsModel.target(), targetModel); + assertEquals(replaceRuleOptionsModel.target(), targetPrototypeModel); assertEquals(replaceRuleOptionsModel.requiredConfig(), requiredConfigModel); - assertEquals(replaceRuleOptionsModel.type(), "user_defined"); assertEquals(replaceRuleOptionsModel.version(), "testString"); assertEquals(replaceRuleOptionsModel.xImport(), importModel); assertEquals(replaceRuleOptionsModel.labels(), java.util.Arrays.asList("testString")); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAndTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAndTest.java new file mode 100644 index 00000000..fa690bef --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAndTest.java @@ -0,0 +1,67 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; +import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the RequiredConfigAnd model. + */ +public class RequiredConfigAndTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigAnd() throws Throwable { + RequiredConfigBase requiredConfigBaseModel = new RequiredConfigBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(requiredConfigBaseModel.description(), "testString"); + assertEquals(requiredConfigBaseModel.property(), "testString"); + assertEquals(requiredConfigBaseModel.operator(), "string_equals"); + assertEquals(requiredConfigBaseModel.value(), "testString"); + + RequiredConfigItemsRequiredConfigOrDepth1 requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigOrDepth1.Builder() + .description("testString") + .or(java.util.Arrays.asList(requiredConfigBaseModel)) + .build(); + assertEquals(requiredConfigItemsModel.description(), "testString"); + assertEquals(requiredConfigItemsModel.or(), java.util.Arrays.asList(requiredConfigBaseModel)); + + RequiredConfigAnd requiredConfigAndModel = new RequiredConfigAnd.Builder() + .description("testString") + .and(java.util.Arrays.asList(requiredConfigItemsModel)) + .build(); + assertEquals(requiredConfigAndModel.description(), "testString"); + assertEquals(requiredConfigAndModel.and(), java.util.Arrays.asList(requiredConfigItemsModel)); + + String json = TestUtilities.serialize(requiredConfigAndModel); + + RequiredConfigAnd requiredConfigAndModelNew = TestUtilities.deserialize(json, RequiredConfigAnd.class); + assertTrue(requiredConfigAndModelNew instanceof RequiredConfigAnd); + assertEquals(requiredConfigAndModelNew.description(), "testString"); + } +} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigBaseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigBaseTest.java new file mode 100644 index 00000000..edae6239 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigBaseTest.java @@ -0,0 +1,60 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the RequiredConfigBase model. + */ +public class RequiredConfigBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigBase() throws Throwable { + RequiredConfigBase requiredConfigBaseModel = new RequiredConfigBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(requiredConfigBaseModel.description(), "testString"); + assertEquals(requiredConfigBaseModel.property(), "testString"); + assertEquals(requiredConfigBaseModel.operator(), "string_equals"); + assertEquals(requiredConfigBaseModel.value(), "testString"); + + String json = TestUtilities.serialize(requiredConfigBaseModel); + + RequiredConfigBase requiredConfigBaseModelNew = TestUtilities.deserialize(json, RequiredConfigBase.class); + assertTrue(requiredConfigBaseModelNew instanceof RequiredConfigBase); + assertEquals(requiredConfigBaseModelNew.description(), "testString"); + assertEquals(requiredConfigBaseModelNew.property(), "testString"); + assertEquals(requiredConfigBaseModelNew.operator(), "string_equals"); + assertEquals(requiredConfigBaseModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRequiredConfigBaseError() throws Throwable { + new RequiredConfigBase.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndDepth1Test.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndDepth1Test.java new file mode 100644 index 00000000..9e19f55a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndDepth1Test.java @@ -0,0 +1,59 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigAndDepth1; +import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the RequiredConfigItemsRequiredConfigAndDepth1 model. + */ +public class RequiredConfigItemsRequiredConfigAndDepth1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigItemsRequiredConfigAndDepth1() throws Throwable { + RequiredConfigBase requiredConfigBaseModel = new RequiredConfigBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(requiredConfigBaseModel.description(), "testString"); + assertEquals(requiredConfigBaseModel.property(), "testString"); + assertEquals(requiredConfigBaseModel.operator(), "string_equals"); + assertEquals(requiredConfigBaseModel.value(), "testString"); + + RequiredConfigItemsRequiredConfigAndDepth1 requiredConfigItemsRequiredConfigAndDepth1Model = new RequiredConfigItemsRequiredConfigAndDepth1.Builder() + .description("testString") + .and(java.util.Arrays.asList(requiredConfigBaseModel)) + .build(); + assertEquals(requiredConfigItemsRequiredConfigAndDepth1Model.description(), "testString"); + assertEquals(requiredConfigItemsRequiredConfigAndDepth1Model.and(), java.util.Arrays.asList(requiredConfigBaseModel)); + + String json = TestUtilities.serialize(requiredConfigItemsRequiredConfigAndDepth1Model); + + RequiredConfigItemsRequiredConfigAndDepth1 requiredConfigItemsRequiredConfigAndDepth1ModelNew = TestUtilities.deserialize(json, RequiredConfigItemsRequiredConfigAndDepth1.class); + assertTrue(requiredConfigItemsRequiredConfigAndDepth1ModelNew instanceof RequiredConfigItemsRequiredConfigAndDepth1); + assertEquals(requiredConfigItemsRequiredConfigAndDepth1ModelNew.description(), "testString"); + } +} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrDepth1Test.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrDepth1Test.java new file mode 100644 index 00000000..03b4c2c2 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigOrDepth1Test.java @@ -0,0 +1,59 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; +import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the RequiredConfigItemsRequiredConfigOrDepth1 model. + */ +public class RequiredConfigItemsRequiredConfigOrDepth1Test { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigItemsRequiredConfigOrDepth1() throws Throwable { + RequiredConfigBase requiredConfigBaseModel = new RequiredConfigBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(requiredConfigBaseModel.description(), "testString"); + assertEquals(requiredConfigBaseModel.property(), "testString"); + assertEquals(requiredConfigBaseModel.operator(), "string_equals"); + assertEquals(requiredConfigBaseModel.value(), "testString"); + + RequiredConfigItemsRequiredConfigOrDepth1 requiredConfigItemsRequiredConfigOrDepth1Model = new RequiredConfigItemsRequiredConfigOrDepth1.Builder() + .description("testString") + .or(java.util.Arrays.asList(requiredConfigBaseModel)) + .build(); + assertEquals(requiredConfigItemsRequiredConfigOrDepth1Model.description(), "testString"); + assertEquals(requiredConfigItemsRequiredConfigOrDepth1Model.or(), java.util.Arrays.asList(requiredConfigBaseModel)); + + String json = TestUtilities.serialize(requiredConfigItemsRequiredConfigOrDepth1Model); + + RequiredConfigItemsRequiredConfigOrDepth1 requiredConfigItemsRequiredConfigOrDepth1ModelNew = TestUtilities.deserialize(json, RequiredConfigItemsRequiredConfigOrDepth1.class); + assertTrue(requiredConfigItemsRequiredConfigOrDepth1ModelNew instanceof RequiredConfigItemsRequiredConfigOrDepth1); + assertEquals(requiredConfigItemsRequiredConfigOrDepth1ModelNew.description(), "testString"); + } +} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsTest.java index fcf12658..2680cbb8 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsTest.java @@ -14,6 +14,7 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItems; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOrTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOrTest.java new file mode 100644 index 00000000..561072c4 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOrTest.java @@ -0,0 +1,67 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigOr; +import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the RequiredConfigOr model. + */ +public class RequiredConfigOrTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigOr() throws Throwable { + RequiredConfigBase requiredConfigBaseModel = new RequiredConfigBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(requiredConfigBaseModel.description(), "testString"); + assertEquals(requiredConfigBaseModel.property(), "testString"); + assertEquals(requiredConfigBaseModel.operator(), "string_equals"); + assertEquals(requiredConfigBaseModel.value(), "testString"); + + RequiredConfigItemsRequiredConfigOrDepth1 requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigOrDepth1.Builder() + .description("testString") + .or(java.util.Arrays.asList(requiredConfigBaseModel)) + .build(); + assertEquals(requiredConfigItemsModel.description(), "testString"); + assertEquals(requiredConfigItemsModel.or(), java.util.Arrays.asList(requiredConfigBaseModel)); + + RequiredConfigOr requiredConfigOrModel = new RequiredConfigOr.Builder() + .description("testString") + .or(java.util.Arrays.asList(requiredConfigItemsModel)) + .build(); + assertEquals(requiredConfigOrModel.description(), "testString"); + assertEquals(requiredConfigOrModel.or(), java.util.Arrays.asList(requiredConfigItemsModel)); + + String json = TestUtilities.serialize(requiredConfigOrModel); + + RequiredConfigOr requiredConfigOrModelNew = TestUtilities.deserialize(json, RequiredConfigOr.class); + assertTrue(requiredConfigOrModelNew instanceof RequiredConfigOr); + assertEquals(requiredConfigOrModelNew.description(), "testString"); + } +} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigAndTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigAndTest.java deleted file mode 100644 index cd92e335..00000000 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigAndTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.cloud.security_and_compliance_center_api.v3.model; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigAnd; -import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; -import static org.testng.Assert.*; - -/** - * Unit test class for the RequiredConfigRequiredConfigAnd model. - */ -public class RequiredConfigRequiredConfigAndTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRequiredConfigRequiredConfigAnd() throws Throwable { - RequiredConfigItemsRequiredConfigOr requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigOr.Builder() - .description("testString") - .build(); - assertEquals(requiredConfigItemsModel.description(), "testString"); - - RequiredConfigRequiredConfigAnd requiredConfigRequiredConfigAndModel = new RequiredConfigRequiredConfigAnd.Builder() - .description("testString") - .and(java.util.Arrays.asList(requiredConfigItemsModel)) - .build(); - assertEquals(requiredConfigRequiredConfigAndModel.description(), "testString"); - assertEquals(requiredConfigRequiredConfigAndModel.and(), java.util.Arrays.asList(requiredConfigItemsModel)); - - String json = TestUtilities.serialize(requiredConfigRequiredConfigAndModel); - - RequiredConfigRequiredConfigAnd requiredConfigRequiredConfigAndModelNew = TestUtilities.deserialize(json, RequiredConfigRequiredConfigAnd.class); - assertTrue(requiredConfigRequiredConfigAndModelNew instanceof RequiredConfigRequiredConfigAnd); - assertEquals(requiredConfigRequiredConfigAndModelNew.description(), "testString"); - } -} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigOrTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigOrTest.java deleted file mode 100644 index 24f44889..00000000 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigRequiredConfigOrTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.cloud.security_and_compliance_center_api.v3.model; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigOr; -import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; -import static org.testng.Assert.*; - -/** - * Unit test class for the RequiredConfigRequiredConfigOr model. - */ -public class RequiredConfigRequiredConfigOrTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRequiredConfigRequiredConfigOr() throws Throwable { - RequiredConfigItemsRequiredConfigOr requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigOr.Builder() - .description("testString") - .build(); - assertEquals(requiredConfigItemsModel.description(), "testString"); - - RequiredConfigRequiredConfigOr requiredConfigRequiredConfigOrModel = new RequiredConfigRequiredConfigOr.Builder() - .description("testString") - .or(java.util.Arrays.asList(requiredConfigItemsModel)) - .build(); - assertEquals(requiredConfigRequiredConfigOrModel.description(), "testString"); - assertEquals(requiredConfigRequiredConfigOrModel.or(), java.util.Arrays.asList(requiredConfigItemsModel)); - - String json = TestUtilities.serialize(requiredConfigRequiredConfigOrModel); - - RequiredConfigRequiredConfigOr requiredConfigRequiredConfigOrModelNew = TestUtilities.deserialize(json, RequiredConfigRequiredConfigOr.class); - assertTrue(requiredConfigRequiredConfigOrModelNew instanceof RequiredConfigRequiredConfigOr); - assertEquals(requiredConfigRequiredConfigOrModelNew.description(), "testString"); - } -} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigTest.java index 60efce86..34309d65 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigTest.java @@ -15,7 +15,8 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfig; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTest.java index f2ec5d84..cef72dce 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTest.java @@ -17,8 +17,9 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalTargetAttribute; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Import; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Rule; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Target; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulesPageBaseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulesPageBaseTest.java index 8732fc1c..c8576153 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulesPageBaseTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulesPageBaseTest.java @@ -20,8 +20,9 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.PageHRefFirst; import com.ibm.cloud.security_and_compliance_center_api.v3.model.PageHRefNext; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOr; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigRequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigOrDepth1; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Rule; import com.ibm.cloud.security_and_compliance_center_api.v3.model.RulesPageBase; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Target; diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SettingsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SettingsTest.java index 7fe184e2..37ab06ca 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SettingsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SettingsTest.java @@ -35,15 +35,15 @@ public class SettingsTest { @Test public void testSettings() throws Throwable { EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .instanceCrn("crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") + .instanceCrn("crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") .updatedOn(DateUtils.parseAsDateTime("2000-01-23T04:56:07.000+00:00")) - .sourceId("crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::") + .sourceId("crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::") .sourceDescription("This source is used for integration with IBM Cloud Security and Compliance Center.") .sourceName("compliance") .build(); - assertEquals(eventNotificationsModel.instanceCrn(), "crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::"); + assertEquals(eventNotificationsModel.instanceCrn(), "crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::"); assertEquals(eventNotificationsModel.updatedOn(), DateUtils.parseAsDateTime("2000-01-23T04:56:07.000+00:00")); - assertEquals(eventNotificationsModel.sourceId(), "crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::"); + assertEquals(eventNotificationsModel.sourceId(), "crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::"); assertEquals(eventNotificationsModel.sourceDescription(), "This source is used for integration with IBM Cloud Security and Compliance Center."); assertEquals(eventNotificationsModel.sourceName(), "compliance"); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototypeTest.java new file mode 100644 index 00000000..6d0e5dfa --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototypeTest.java @@ -0,0 +1,66 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalTargetAttribute; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the TargetPrototype model. + */ +public class TargetPrototypeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTargetPrototype() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("name") + .operator("string_equals") + .value("value") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "name"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "value"); + + TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() + .serviceName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .build(); + assertEquals(targetPrototypeModel.serviceName(), "testString"); + assertEquals(targetPrototypeModel.resourceKind(), "testString"); + assertEquals(targetPrototypeModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + + String json = TestUtilities.serialize(targetPrototypeModel); + + TargetPrototype targetPrototypeModelNew = TestUtilities.deserialize(json, TargetPrototype.class); + assertTrue(targetPrototypeModelNew instanceof TargetPrototype); + assertEquals(targetPrototypeModelNew.serviceName(), "testString"); + assertEquals(targetPrototypeModelNew.resourceKind(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testTargetPrototypeError() throws Throwable { + new TargetPrototype.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetTest.java index e4f584dd..54af5e1e 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetTest.java @@ -32,38 +32,10 @@ public class TargetTest { @Test public void testTarget() throws Throwable { - AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() - .name("name") - .operator("string_equals") - .value("value") - .build(); - assertEquals(additionalTargetAttributeModel.name(), "name"); - assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); - assertEquals(additionalTargetAttributeModel.value(), "value"); - - Target targetModel = new Target.Builder() - .serviceName("testString") - .serviceDisplayName("testString") - .resourceKind("testString") - .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) - .build(); - assertEquals(targetModel.serviceName(), "testString"); - assertEquals(targetModel.serviceDisplayName(), "testString"); - assertEquals(targetModel.resourceKind(), "testString"); - assertEquals(targetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); - - String json = TestUtilities.serialize(targetModel); - - Target targetModelNew = TestUtilities.deserialize(json, Target.class); - assertTrue(targetModelNew instanceof Target); - assertEquals(targetModelNew.serviceName(), "testString"); - assertEquals(targetModelNew.serviceDisplayName(), "testString"); - assertEquals(targetModelNew.resourceKind(), "testString"); + Target targetModel = new Target(); + assertNull(targetModel.getServiceName()); + assertNull(targetModel.getServiceDisplayName()); + assertNull(targetModel.getResourceKind()); + assertNull(targetModel.getAdditionalTargetAttributes()); } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTargetError() throws Throwable { - new Target.Builder().build(); - } - } \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceOptionsTest.java index 57481521..837d1bea 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceOptionsTest.java @@ -15,6 +15,7 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -31,18 +32,21 @@ public class UpdateProviderTypeInstanceOptionsTest { @Test public void testUpdateProviderTypeInstanceOptions() throws Throwable { + UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName updateProviderTypeInstanceRequestModel = new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.Builder() + .name("workload-protection-instance-1") + .build(); + assertEquals(updateProviderTypeInstanceRequestModel.name(), "workload-protection-instance-1"); + UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptionsModel = new UpdateProviderTypeInstanceOptions.Builder() .providerTypeId("testString") .providerTypeInstanceId("testString") - .name("workload-protection-instance-1") - .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) + .updateProviderTypeInstanceRequest(updateProviderTypeInstanceRequestModel) .xCorrelationId("testString") .xRequestId("testString") .build(); assertEquals(updateProviderTypeInstanceOptionsModel.providerTypeId(), "testString"); assertEquals(updateProviderTypeInstanceOptionsModel.providerTypeInstanceId(), "testString"); - assertEquals(updateProviderTypeInstanceOptionsModel.name(), "workload-protection-instance-1"); - assertEquals(updateProviderTypeInstanceOptionsModel.attributes(), java.util.Collections.singletonMap("anyKey", "anyValue")); + assertEquals(updateProviderTypeInstanceOptionsModel.updateProviderTypeInstanceRequest(), updateProviderTypeInstanceRequestModel); assertEquals(updateProviderTypeInstanceOptionsModel.xCorrelationId(), "testString"); assertEquals(updateProviderTypeInstanceOptionsModel.xRequestId(), "testString"); } diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesTest.java new file mode 100644 index 00000000..d8405175 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes; +import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes model. + */ +public class UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes() throws Throwable { + UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesModel = new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes.Builder() + .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) + .build(); + assertEquals(updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesModel.attributes(), java.util.Collections.singletonMap("anyKey", "anyValue")); + + String json = TestUtilities.serialize(updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesModel); + + UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesModelNew = TestUtilities.deserialize(json, UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes.class); + assertTrue(updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesModelNew instanceof UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes); + assertEquals(updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesModelNew.attributes().toString(), java.util.Collections.singletonMap("anyKey", "anyValue").toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributesError() throws Throwable { + new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingAttributes.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameTest.java new file mode 100644 index 00000000..bc8e06bb --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2023. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package com.ibm.cloud.security_and_compliance_center_api.v3.model; + +import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName; +import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Unit test class for the UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName model. + */ +public class UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName() throws Throwable { + UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameModel = new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.Builder() + .name("workload-protection-instance-1") + .build(); + assertEquals(updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameModel.name(), "workload-protection-instance-1"); + + String json = TestUtilities.serialize(updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameModel); + + UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameModelNew = TestUtilities.deserialize(json, UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.class); + assertTrue(updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameModelNew instanceof UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName); + assertEquals(updateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameModelNew.name(), "workload-protection-instance-1"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingNameError() throws Throwable { + new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.Builder().build(); + } + +} \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestTest.java similarity index 55% rename from modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndTest.java rename to modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestTest.java index fec2b590..b9ea0a06 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigItemsRequiredConfigAndTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateProviderTypeInstanceRequestTest.java @@ -14,7 +14,7 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateProviderTypeInstanceRequest; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -23,23 +23,16 @@ import static org.testng.Assert.*; /** - * Unit test class for the RequiredConfigItemsRequiredConfigAnd model. + * Unit test class for the UpdateProviderTypeInstanceRequest model. */ -public class RequiredConfigItemsRequiredConfigAndTest { +public class UpdateProviderTypeInstanceRequestTest { final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + // TODO: Add tests for models that are abstract @Test - public void testRequiredConfigItemsRequiredConfigAnd() throws Throwable { - RequiredConfigItemsRequiredConfigAnd requiredConfigItemsRequiredConfigAndModel = new RequiredConfigItemsRequiredConfigAnd.Builder() - .description("testString") - .build(); - assertEquals(requiredConfigItemsRequiredConfigAndModel.description(), "testString"); - - String json = TestUtilities.serialize(requiredConfigItemsRequiredConfigAndModel); - - RequiredConfigItemsRequiredConfigAnd requiredConfigItemsRequiredConfigAndModelNew = TestUtilities.deserialize(json, RequiredConfigItemsRequiredConfigAnd.class); - assertTrue(requiredConfigItemsRequiredConfigAndModelNew instanceof RequiredConfigItemsRequiredConfigAnd); - assertEquals(requiredConfigItemsRequiredConfigAndModelNew.description(), "testString"); + public void testUpdateProviderTypeInstanceRequest() throws Throwable { + UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequestModel = new UpdateProviderTypeInstanceRequest(); + assertNotNull(updateProviderTypeInstanceRequestModel); } } \ No newline at end of file diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSettingsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSettingsOptionsTest.java index 737a867b..8d376241 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSettingsOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSettingsOptionsTest.java @@ -35,15 +35,15 @@ public class UpdateSettingsOptionsTest { @Test public void testUpdateSettingsOptions() throws Throwable { EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .instanceCrn("crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") + .instanceCrn("crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .sourceId("crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::") + .sourceId("crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::") .sourceDescription("This source is used for integration with IBM Cloud Security and Compliance Center.") .sourceName("compliance") .build(); - assertEquals(eventNotificationsModel.instanceCrn(), "crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::"); + assertEquals(eventNotificationsModel.instanceCrn(), "crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::"); assertEquals(eventNotificationsModel.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(eventNotificationsModel.sourceId(), "crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::"); + assertEquals(eventNotificationsModel.sourceId(), "crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::"); assertEquals(eventNotificationsModel.sourceDescription(), "This source is used for integration with IBM Cloud Security and Compliance Center."); assertEquals(eventNotificationsModel.sourceName(), "compliance");