From bbb6fb1266cce5b9d4222932687917bc5189215a Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:02:42 -0400 Subject: [PATCH 01/13] BREAKING CHANGE: Add access control segmentation Signed-off-by: Bryan Bosely --- ...ecurityAndComplianceCenterApiExamples.java | 1794 +++++++ .../v3/SecurityAndComplianceCenterApi.java | 2660 ++++++---- .../v3/model/Account.java | 92 +- .../v3/model/AdditionalDetails.java | 66 + .../v3/model/AdditionalProperty.java | 3 +- .../v3/model/AdditionalTargetAttribute.java | 24 +- .../v3/model/Assessment.java | 171 +- .../v3/model/AssessmentPrototype.java | 122 + .../v3/model/AssessmentWithStats.java | 171 + .../v3/model/Attachment.java | 35 +- .../v3/model/AttachmentNotifications.java | 119 + .../AttachmentNotificationsControls.java | 153 + .../ComparePredefinedProfilesResponse.java | 79 + .../v3/model/CompareProfileResponse.java | 193 + .../v3/model/CompareProfilesOptions.java | 160 + .../v3/model/ComplianceScore.java | 3 +- .../v3/model/ComplianceStats.java | 18 +- .../ComplianceStatsWithNonCompliant.java | 148 + .../v3/model/ConditionItem.java | 208 + .../v3/model/ConditionItemConditionBase.java | 188 + .../v3/model/ConditionItemConditionList.java | 28 + ...onditionListConditionListConditionAnd.java | 113 + ...ConditionListConditionListConditionOr.java | 113 + .../model/ConditionItemConditionSubRule.java | 30 + ...onSubRuleConditionSubRuleConditionAll.java | 79 + ...SubRuleConditionSubRuleConditionAllIf.java | 79 + ...onSubRuleConditionSubRuleConditionAny.java | 79 + ...SubRuleConditionSubRuleConditionAnyIf.java | 79 + .../model/ConfigurationInformationPoints.java | 52 + .../v3/model/Control.java | 159 + .../v3/model/ControlChanges.java | 104 + .../v3/model/ControlChangesUpdated.java | 50 + .../v3/model/ControlDoc.java | 122 + .../v3/model/ControlLibrariesPager.java | 15 +- .../v3/model/ControlLibrary.java | 448 +- .../v3/model/ControlLibraryCollection.java | 45 +- .../v3/model/ControlPrototype.java | 330 ++ .../v3/model/ControlSpecification.java | 337 ++ .../model/ControlSpecificationPrototype.java | 229 + .../model/ControlSpecificationWithStats.java | 49 +- .../v3/model/ControlSummary.java | 65 + .../v3/model/ControlWithStats.java | 68 +- .../v3/model/CreateControlLibraryOptions.java | 308 ++ .../model/CreateProfileAttachmentOptions.java | 236 + .../v3/model/CreateProfileOptions.java | 233 +- .../CreateProviderTypeInstanceOptions.java | 99 +- .../v3/model/CreateRuleOptions.java | 105 +- .../v3/model/CreateScanOptions.java | 87 +- ...eAttributes.java => CreateScanReport.java} | 25 +- .../v3/model/CreateScanReportOptions.java | 226 + .../v3/model/CreateScanResponse.java | 143 + .../v3/model/CreateScopeOptions.java | 228 + .../v3/model/CreateSubscopeOptions.java | 184 + .../v3/model/CreateTargetOptions.java | 240 + .../v3/model/Credential.java | 156 + .../v3/model/CredentialResponse.java | 79 + .../v3/model/DateRange.java | 139 + .../v3/model/DefaultParameters.java | 230 + .../v3/model/DefaultParametersChanges.java | 104 + .../v3/model/DefaultParametersDifference.java | 50 + .../DeleteCustomControlLibraryOptions.java | 99 +- .../v3/model/DeleteCustomProfileOptions.java | 83 +- .../model/DeleteProfileAttachmentOptions.java | 99 +- .../DeleteProviderTypeInstanceOptions.java | 91 +- .../v3/model/DeleteRuleOptions.java | 83 +- .../v3/model/DeleteScopeOptions.java | 134 + .../v3/model/DeleteSubscopeOptions.java | 164 + .../v3/model/DeleteTargetOptions.java | 134 + .../v3/model/Endpoint.java | 76 + .../v3/model/EvalStats.java | 18 +- .../v3/model/Evaluation.java | 62 +- .../v3/model/EvaluationDetails.java | 55 + .../v3/model/EvaluationPage.java | 65 +- .../v3/model/EvaluationProperty.java | 142 + .../v3/model/EvaluationProviderInfo.java | 40 + .../v3/model/EventNotifications.java | 124 +- .../v3/model/EventNotificationsPrototype.java | 149 + .../v3/model/GetControlLibraryOptions.java | 99 +- .../v3/model/GetLatestReportsOptions.java | 83 +- .../v3/model/GetProfileAttachmentOptions.java | 99 +- .../v3/model/GetProfileOptions.java | 83 +- .../v3/model/GetProviderTypeByIdOptions.java | 83 +- .../model/GetProviderTypeInstanceOptions.java | 91 +- .../v3/model/GetReportControlsOptions.java | 137 +- .../model/GetReportDownloadFileOptions.java | 186 + .../v3/model/GetReportOptions.java | 91 +- .../v3/model/GetReportRuleOptions.java | 93 +- .../v3/model/GetReportSummaryOptions.java | 83 +- .../v3/model/GetReportTagsOptions.java | 83 +- .../GetReportViolationsDriftOptions.java | 109 +- .../v3/model/GetRuleOptions.java | 83 +- .../GetScanReportDownloadFileOptions.java | 190 + .../v3/model/GetScanReportOptions.java | 164 + .../v3/model/GetScopeOptions.java | 134 + .../v3/model/GetServiceOptions.java | 104 + .../v3/model/GetSettingsOptions.java | 68 +- .../v3/model/GetSubscopeOptions.java | 164 + .../v3/model/GetTargetOptions.java | 134 + .../v3/model/Import.java | 19 +- .../v3/model/InstanceAttachmentsPager.java | 108 + .../v3/model/LabelType.java | 3 +- .../v3/model/LastScan.java | 110 +- .../v3/model/Link.java | 48 + .../v3/model/ListControlLibrariesOptions.java | 98 +- .../model/ListInstanceAttachmentsOptions.java | 283 ++ .../model/ListProfileAttachmentsOptions.java | 160 + .../model/ListProfileParametersOptions.java | 134 + .../v3/model/ListProfilesOptions.java | 96 +- .../ListProviderTypeInstancesOptions.java | 83 +- .../v3/model/ListProviderTypesOptions.java | 68 +- .../model/ListReportEvaluationsOptions.java | 179 +- .../v3/model/ListReportResourcesOptions.java | 141 +- .../v3/model/ListReportsOptions.java | 137 +- .../v3/model/ListRulesOptions.java | 146 +- .../v3/model/ListScanReportsOptions.java | 226 + .../v3/model/ListScopesOptions.java | 234 + .../v3/model/ListServicesOptions.java | 29 + .../v3/model/ListSubscopesOptions.java | 264 + .../v3/model/ListTargetsOptions.java | 104 + .../v3/model/MultiCloudScopePayload.java | 82 + .../v3/model/MultiCloudScopePayloadById.java | 79 + .../MultiCloudScopePayloadByProperties.java | 138 + .../v3/model/ObjectStorage.java | 124 +- .../v3/model/ObjectStoragePrototype.java | 121 + .../v3/model/PageHRefFirst.java | 5 +- .../v3/model/PageHRefNext.java | 7 +- .../v3/model/Parameter.java | 188 +- .../v3/model/PostTestEventOptions.java | 68 +- .../v3/model/Profile.java | 469 +- .../v3/model/ProfileAttachment.java | 279 + .../v3/model/ProfileAttachmentBase.java | 372 ++ .../v3/model/ProfileAttachmentCollection.java | 90 + .../v3/model/ProfileAttachmentResponse.java | 54 + .../v3/model/ProfileCollection.java | 45 +- .../v3/model/ProfileControls.java | 315 +- .../v3/model/ProfileControlsPrototype.java | 3 +- .../ProfileDefaultParametersResponse.java | 152 + .../v3/model/ProfileInfo.java | 3 +- .../v3/model/ProfilesPager.java | 15 +- .../v3/model/ProviderType.java | 195 + .../v3/model/ProviderTypeCollection.java | 42 + .../v3/model/ProviderTypeInstance.java | 104 + .../model/ProviderTypeInstanceCollection.java | 42 + .../ReplaceCustomControlLibraryOptions.java | 460 +- .../ReplaceProfileAttachmentOptions.java | 595 +-- .../v3/model/ReplaceProfileOptions.java | 609 ++- .../ReplaceProfileParametersOptions.java | 248 + .../v3/model/ReplaceRuleOptions.java | 107 +- .../v3/model/ReplaceTargetOptions.java | 270 + .../v3/model/Report.java | 107 +- .../v3/model/ReportCollection.java | 103 + .../v3/model/ReportControls.java | 108 +- .../v3/model/ReportEvaluationsPager.java | 9 +- .../v3/model/ReportLatest.java | 3 +- .../v3/model/ReportResourcesPager.java | 9 +- .../v3/model/ReportScope.java | 74 + .../v3/model/ReportSummary.java | 37 +- .../v3/model/ReportTags.java | 3 +- .../v3/model/ReportViolationDataPoint.java | 14 +- .../v3/model/ReportViolationsDrift.java | 17 +- .../v3/model/ReportsPager.java | 11 +- .../v3/model/RequiredConfig.java | 110 +- .../v3/model/RequiredConfigConditionBase.java | 188 + .../v3/model/RequiredConfigConditionList.java | 28 + ...onditionListConditionListConditionAnd.java | 113 + ...ConditionListConditionListConditionOr.java | 113 + .../model/RequiredConfigConditionSubRule.java | 30 + ...onSubRuleConditionSubRuleConditionAll.java | 79 + ...SubRuleConditionSubRuleConditionAllIf.java | 79 + ...onSubRuleConditionSubRuleConditionAny.java | 79 + ...SubRuleConditionSubRuleConditionAnyIf.java | 79 + .../v3/model/Resource.java | 420 +- .../v3/model/ResourcePage.java | 65 +- .../v3/model/ResourceSummary.java | 18 +- .../v3/model/ResourceSummaryItem.java | 65 +- .../v3/model/Rule.java | 9 +- .../v3/model/RuleCollection.java | 91 + .../v3/model/RuleInfo.java | 12 +- .../v3/model/RuleParameter.java | 204 + .../v3/model/RuleProperty.java | 82 + .../v3/model/RuleTarget.java | 237 + ...rototype.java => RuleTargetPrototype.java} | 43 +- .../v3/model/RulesPager.java | 108 + .../v3/model/ScanReport.java | 168 + .../v3/model/ScanReportCollection.java | 117 + .../v3/model/Scope.java | 183 + .../v3/model/ScopeCollection.java | 90 + .../v3/model/ScopeID.java | 51 + .../v3/model/ScopeProperty.java | 21 +- .../v3/model/ScopePropertyExclusionItem.java | 161 + .../v3/model/ScopePropertyExclusions.java | 136 + .../v3/model/ScopePropertyScopeAny.java | 108 + .../v3/model/ScopePropertyScopeId.java | 117 + .../v3/model/ScopePropertyScopeType.java | 139 + .../v3/model/ScopePrototype.java | 193 + .../v3/model/ScopesPager.java | 108 + .../v3/model/Service.java | 185 + .../v3/model/ServiceCollection.java | 40 + .../v3/model/Settings.java | 76 +- .../v3/model/SubRule.java | 121 + .../v3/model/SubScope.java | 91 + .../v3/model/SubScopeCollection.java | 90 + .../v3/model/SubScopeResponse.java | 40 + .../v3/model/SubscopesPager.java | 108 + .../v3/model/SupportedConfigs.java | 132 + .../v3/model/Tags.java | 144 +- .../v3/model/Target.java | 124 +- .../v3/model/TargetCollection.java | 90 + .../v3/model/TargetInfo.java | 42 +- .../v3/model/TestEvent.java | 3 +- .../UpdateProviderTypeInstanceOptions.java | 123 +- .../v3/model/UpdateScopeOptions.java | 186 + .../v3/model/UpdateSettingsOptions.java | 118 +- .../v3/model/UpdateSubscopeOptions.java | 216 + .../v3/model/UpgradeAttachmentOptions.java | 240 + .../v3/package-info.java | 3 +- .../v3/SecurityAndComplianceCenterApiIT.java | 2551 +++++++--- .../SecurityAndComplianceCenterApiTest.java | 4481 ++++++++++++----- .../v3/model/AccountTest.java | 22 +- .../v3/model/AdditionalDetailsTest.java | 40 + .../v3/model/AdditionalPropertyTest.java | 2 +- .../model/AdditionalTargetAttributeTest.java | 8 +- .../v3/model/AssessmentPrototypeTest.java | 48 + .../v3/model/AssessmentTest.java | 56 +- .../v3/model/AssessmentWithStatsTest.java | 48 + .../AttachmentNotificationsControlsTest.java | 53 + .../v3/model/AttachmentNotificationsTest.java | 56 + .../v3/model/AttachmentTest.java | 11 +- ...ComparePredefinedProfilesResponseTest.java | 52 + .../v3/model/CompareProfileResponseTest.java | 48 + .../v3/model/CompareProfilesOptionsTest.java | 49 + .../v3/model/ComplianceScoreTest.java | 2 +- .../v3/model/ComplianceStatsTest.java | 3 +- .../ComplianceStatsWithNonCompliantTest.java | 45 + .../model/ConditionItemConditionBaseTest.java | 60 + ...tionListConditionListConditionAndTest.java | 59 + ...itionListConditionListConditionOrTest.java | 59 + .../model/ConditionItemConditionListTest.java | 39 + ...uleConditionSubRuleConditionAllIfTest.java | 75 + ...bRuleConditionSubRuleConditionAllTest.java | 75 + ...uleConditionSubRuleConditionAnyIfTest.java | 75 + ...bRuleConditionSubRuleConditionAnyTest.java | 75 + .../ConditionItemConditionSubRuleTest.java | 41 + ...ibutesTest.java => ConditionItemTest.java} | 15 +- .../ConfigurationInformationPointsTest.java | 39 + .../v3/model/ControlChangesTest.java | 48 + .../v3/model/ControlChangesUpdatedTest.java | 43 + .../v3/model/ControlDocTest.java | 48 + .../model/ControlLibraryCollectionTest.java | 15 +- .../v3/model/ControlLibraryTest.java | 159 +- .../v3/model/ControlPrototypeTest.java | 101 + .../ControlSpecificationPrototypeTest.java | 64 + .../v3/model/ControlSpecificationTest.java | 106 + .../ControlSpecificationWithStatsTest.java | 10 +- .../v3/model/ControlSummaryTest.java | 39 + .../v3/model/ControlTest.java | 50 + .../v3/model/ControlWithStatsTest.java | 12 +- .../CreateControlLibraryOptionsTest.java | 107 + .../CreateProfileAttachmentOptionsTest.java | 120 + .../v3/model/CreateProfileOptionsTest.java | 56 +- ...CreateProviderTypeInstanceOptionsTest.java | 12 +- .../v3/model/CreateRuleOptionsTest.java | 64 +- .../v3/model/CreateScanOptionsTest.java | 10 +- .../v3/model/CreateScanReportOptionsTest.java | 53 + .../v3/model/CreateScanReportTest.java | 37 + .../v3/model/CreateScanResponseTest.java | 45 + .../v3/model/CreateScopeOptionsTest.java | 61 + .../v3/model/CreateSubscopeOptionsTest.java | 69 + .../v3/model/CreateTargetOptionsTest.java | 121 + .../v3/model/CredentialResponseTest.java | 43 + .../v3/model/CredentialTest.java | 113 + .../v3/model/DateRangeTest.java | 55 + .../model/DefaultParametersChangesTest.java | 44 + .../DefaultParametersDifferenceTest.java | 39 + .../v3/model/DefaultParametersTest.java | 60 + ...DeleteCustomControlLibraryOptionsTest.java | 14 +- .../model/DeleteCustomProfileOptionsTest.java | 10 +- .../DeleteProfileAttachmentOptionsTest.java | 14 +- ...DeleteProviderTypeInstanceOptionsTest.java | 12 +- .../v3/model/DeleteRuleOptionsTest.java | 8 +- .../v3/model/DeleteScopeOptionsTest.java | 47 + .../v3/model/DeleteSubscopeOptionsTest.java | 49 + .../v3/model/DeleteTargetOptionsTest.java | 47 + .../v3/model/EndpointTest.java | 40 + .../v3/model/EvalStatsTest.java | 3 +- .../v3/model/EvaluationDetailsTest.java | 40 + .../v3/model/EvaluationPageTest.java | 18 +- .../v3/model/EvaluationPropertyTest.java | 41 + .../v3/model/EvaluationProviderInfoTest.java | 37 + .../v3/model/EvaluationTest.java | 15 +- .../EventNotificationsPrototypeTest.java | 51 + .../v3/model/EventNotificationsTest.java | 31 +- .../model/GetControlLibraryOptionsTest.java | 14 +- .../v3/model/GetLatestReportsOptionsTest.java | 14 +- .../GetProfileAttachmentOptionsTest.java | 14 +- .../v3/model/GetProfileOptionsTest.java | 10 +- .../model/GetProviderTypeByIdOptionsTest.java | 12 +- .../GetProviderTypeInstanceOptionsTest.java | 12 +- .../model/GetReportControlsOptionsTest.java | 12 +- .../GetReportDownloadFileOptionsTest.java | 51 + .../v3/model/GetReportOptionsTest.java | 12 +- .../v3/model/GetReportRuleOptionsTest.java | 12 +- .../v3/model/GetReportSummaryOptionsTest.java | 8 +- .../v3/model/GetReportTagsOptionsTest.java | 8 +- .../GetReportViolationsDriftOptionsTest.java | 12 +- .../v3/model/GetRuleOptionsTest.java | 8 +- .../GetScanReportDownloadFileOptionsTest.java | 51 + .../v3/model/GetScanReportOptionsTest.java | 49 + .../v3/model/GetScopeOptionsTest.java | 47 + .../v3/model/GetServiceOptionsTest.java | 45 + .../v3/model/GetSettingsOptionsTest.java | 14 +- .../v3/model/GetSubscopeOptionsTest.java | 49 + .../v3/model/GetTargetOptionsTest.java | 47 + .../v3/model/ImportTest.java | 24 +- .../v3/model/LabelTypeTest.java | 2 +- .../v3/model/LastScanTest.java | 23 +- .../v3/model/LinkTest.java | 38 + .../ListControlLibrariesOptionsTest.java | 18 +- .../ListInstanceAttachmentsOptionsTest.java | 57 + .../ListProfileAttachmentsOptionsTest.java | 49 + .../ListProfileParametersOptionsTest.java | 47 + .../v3/model/ListProfilesOptionsTest.java | 18 +- .../ListProviderTypeInstancesOptionsTest.java | 12 +- .../model/ListProviderTypesOptionsTest.java | 14 +- .../ListReportEvaluationsOptionsTest.java | 14 +- .../model/ListReportResourcesOptionsTest.java | 12 +- .../v3/model/ListReportsOptionsTest.java | 22 +- .../v3/model/ListRulesOptionsTest.java | 20 +- .../v3/model/ListScanReportsOptionsTest.java | 53 + .../v3/model/ListScopesOptionsTest.java | 55 + .../v3/model/ListServicesOptionsTest.java | 37 + .../v3/model/ListSubscopesOptionsTest.java | 57 + .../v3/model/ListTargetsOptionsTest.java | 45 + .../model/MultiCloudScopePayloadByIdTest.java | 45 + ...ultiCloudScopePayloadByPropertiesTest.java | 64 + .../v3/model/MultiCloudScopePayloadTest.java | 38 + .../v3/model/ObjectStoragePrototypeTest.java | 48 + .../v3/model/ObjectStorageTest.java | 31 +- .../v3/model/PageHRefFirstTest.java | 2 +- .../v3/model/PageHRefNextTest.java | 2 +- .../v3/model/ParameterTest.java | 32 +- .../v3/model/PostTestEventOptionsTest.java | 14 +- .../v3/model/ProfileAttachmentBaseTest.java | 117 + .../ProfileAttachmentCollectionTest.java | 51 + .../model/ProfileAttachmentResponseTest.java | 46 + .../v3/model/ProfileAttachmentTest.java | 61 + .../v3/model/ProfileCollectionTest.java | 16 +- .../model/ProfileControlsPrototypeTest.java | 14 +- .../v3/model/ProfileControlsTest.java | 125 +- .../ProfileDefaultParametersResponseTest.java | 69 + .../v3/model/ProfileInfoTest.java | 2 +- .../v3/model/ProfileTest.java | 192 +- .../v3/model/ProviderTypeCollectionTest.java | 41 + .../ProviderTypeInstanceCollectionTest.java | 39 + .../v3/model/ProviderTypeInstanceTest.java | 42 + .../v3/model/ProviderTypeTest.java | 51 + ...eplaceCustomControlLibraryOptionsTest.java | 141 +- .../ReplaceProfileAttachmentOptionsTest.java | 140 +- .../v3/model/ReplaceProfileOptionsTest.java | 166 +- .../ReplaceProfileParametersOptionsTest.java | 69 + .../v3/model/ReplaceRuleOptionsTest.java | 64 +- .../v3/model/ReplaceTargetOptionsTest.java | 123 + .../v3/model/ReportCollectionTest.java | 61 + .../v3/model/ReportControlsTest.java | 15 +- .../v3/model/ReportLatestTest.java | 16 +- .../v3/model/ReportScopeTest.java | 40 + .../v3/model/ReportSummaryTest.java | 6 +- .../v3/model/ReportTagsTest.java | 2 +- .../v3/model/ReportTest.java | 25 +- .../model/ReportViolationDataPointTest.java | 4 +- .../v3/model/ReportViolationsDriftTest.java | 4 +- .../RequiredConfigConditionBaseTest.java | 60 + ...tionListConditionListConditionAndTest.java | 59 + ...itionListConditionListConditionOrTest.java | 59 + .../RequiredConfigConditionListTest.java | 39 + ...uleConditionSubRuleConditionAllIfTest.java | 75 + ...bRuleConditionSubRuleConditionAllTest.java | 75 + ...uleConditionSubRuleConditionAnyIfTest.java | 75 + ...bRuleConditionSubRuleConditionAnyTest.java | 75 + .../RequiredConfigConditionSubRuleTest.java | 41 + .../v3/model/RequiredConfigTest.java | 4 +- .../v3/model/ResourcePageTest.java | 11 +- .../v3/model/ResourceSummaryItemTest.java | 8 +- .../v3/model/ResourceSummaryTest.java | 3 +- .../v3/model/ResourceTest.java | 101 +- .../v3/model/RuleCollectionTest.java | 50 + .../v3/model/RuleInfoTest.java | 2 +- .../v3/model/RuleParameterTest.java | 60 + .../v3/model/RulePropertyTest.java | 39 + ...Test.java => RuleTargetPrototypeTest.java} | 40 +- .../v3/model/RuleTargetTest.java | 72 + .../v3/model/RuleTest.java | 10 +- .../v3/model/ScanReportCollectionTest.java | 47 + .../v3/model/ScanReportTest.java | 45 + .../v3/model/ScopeCollectionTest.java | 46 + .../v3/model/ScopeIDTest.java | 38 + .../model/ScopePropertyExclusionItemTest.java | 54 + .../v3/model/ScopePropertyExclusionsTest.java | 61 + .../v3/model/ScopePropertyScopeAnyTest.java | 54 + .../v3/model/ScopePropertyScopeIdTest.java | 54 + .../v3/model/ScopePropertyScopeTypeTest.java | 54 + .../v3/model/ScopePropertyTest.java | 6 +- .../v3/model/ScopePrototypeTest.java | 61 + .../v3/model/ScopeTest.java | 49 + .../v3/model/ServiceCollectionTest.java | 44 + .../v3/model/ServiceTest.java | 53 + .../v3/model/SettingsTest.java | 44 +- .../v3/model/SubRuleTest.java | 69 + .../v3/model/SubScopeCollectionTest.java | 45 + .../v3/model/SubScopeResponseTest.java | 39 + .../v3/model/SubScopeTest.java | 42 + .../v3/model/SupportedConfigsTest.java | 46 + .../v3/model/TagsTest.java | 19 +- .../v3/model/TargetCollectionTest.java | 49 + .../v3/model/TargetInfoTest.java | 7 +- .../v3/model/TargetTest.java | 20 +- .../v3/model/TestEventTest.java | 2 +- ...UpdateProviderTypeInstanceOptionsTest.java | 24 +- .../v3/model/UpdateScopeOptionsTest.java | 51 + .../v3/model/UpdateSettingsOptionsTest.java | 59 +- .../v3/model/UpdateSubscopeOptionsTest.java | 53 + .../model/UpgradeAttachmentOptionsTest.java | 69 + .../v3/utils/TestUtilities.java | 8 +- pom.xml | 47 +- 424 files changed, 37663 insertions(+), 8651 deletions(-) create mode 100644 modules/examples/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiExamples.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalDetails.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentPrototype.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentWithStats.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotifications.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsControls.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComparePredefinedProfilesResponse.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfileResponse.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfilesOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsWithNonCompliant.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItem.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionBase.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionList.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionAnd.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionOr.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRule.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAll.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAllIf.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAny.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConfigurationInformationPoints.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Control.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChanges.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesUpdated.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlDoc.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlPrototype.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecification.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationPrototype.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSummary.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateControlLibraryOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileAttachmentOptions.java rename modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{ProviderTypeInstanceAttributes.java => CreateScanReport.java} (64%) create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanResponse.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScopeOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateSubscopeOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateTargetOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Credential.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialResponse.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DateRange.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParameters.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersChanges.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersDifference.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteScopeOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteSubscopeOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteTargetOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Endpoint.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationDetails.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProperty.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProviderInfo.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsPrototype.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportDownloadFileOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportDownloadFileOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScopeOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetServiceOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSubscopeOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetTargetOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/InstanceAttachmentsPager.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Link.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListInstanceAttachmentsOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileAttachmentsOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileParametersOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScanReportsOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScopesOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListServicesOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListSubscopesOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListTargetsOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayload.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadById.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadByProperties.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStoragePrototype.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachment.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentBase.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentResponse.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileDefaultParametersResponse.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderType.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstance.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileParametersOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceTargetOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportScope.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionBase.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionList.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionAnd.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionOr.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRule.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAll.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAny.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleParameter.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleProperty.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTarget.java rename modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{TargetPrototype.java => RuleTargetPrototype.java} (78%) create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulesPager.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReport.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Scope.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeID.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusionItem.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeAny.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeId.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeType.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePrototype.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopesPager.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Service.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubRule.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScope.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeResponse.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubscopesPager.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SupportedConfigs.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetCollection.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateScopeOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSubscopeOptions.java create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpgradeAttachmentOptions.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalDetailsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentPrototypeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentWithStatsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsControlsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComparePredefinedProfilesResponseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfileResponseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfilesOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsWithNonCompliantTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionBaseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionAndTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionOrTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAllIfTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAllTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAnyIfTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAnyTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleTest.java rename modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{ProviderTypeInstanceAttributesTest.java => ConditionItemTest.java} (74%) create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConfigurationInformationPointsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesUpdatedTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlDocTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlPrototypeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationPrototypeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSummaryTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateControlLibraryOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileAttachmentOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanResponseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScopeOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateSubscopeOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateTargetOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialResponseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DateRangeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersChangesTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersDifferenceTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteScopeOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteSubscopeOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteTargetOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EndpointTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationDetailsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPropertyTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProviderInfoTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsPrototypeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportDownloadFileOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportDownloadFileOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScopeOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetServiceOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSubscopeOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetTargetOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LinkTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListInstanceAttachmentsOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileAttachmentsOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileParametersOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScanReportsOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScopesOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListServicesOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListSubscopesOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListTargetsOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadByIdTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadByPropertiesTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStoragePrototypeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentBaseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentResponseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileDefaultParametersResponseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileParametersOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceTargetOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportScopeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionBaseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionAndTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionOrTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAllIfTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAllTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIfTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleParameterTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulePropertyTest.java rename modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/{TargetPrototypeTest.java => RuleTargetPrototypeTest.java} (58%) create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTargetTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeIDTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusionItemTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeAnyTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeIdTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeTypeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePrototypeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubRuleTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeResponseTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SupportedConfigsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetCollectionTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateScopeOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSubscopeOptionsTest.java create mode 100644 modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpgradeAttachmentOptionsTest.java diff --git a/modules/examples/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiExamples.java b/modules/examples/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiExamples.java new file mode 100644 index 00000000..0f2ad930 --- /dev/null +++ b/modules/examples/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/SecurityAndComplianceCenterApiExamples.java @@ -0,0 +1,1794 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +import com.ibm.cloud.sdk.core.http.Response; +import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException; +import com.ibm.cloud.sdk.core.util.CredentialUtils; +import com.ibm.cloud.sdk.core.util.GsonSingleton; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalTargetAttribute; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AssessmentPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComparePredefinedProfilesResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CompareProfilesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrariesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrary; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileAttachmentOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProviderTypeInstanceOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanReport; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanReportOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteCustomControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteCustomProfileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteProfileAttachmentOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteProviderTypeInstanceOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Evaluation; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EventNotificationsPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetLatestReportsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProfileAttachmentOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProfileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypeByIdOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypeInstanceOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportControlsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportDownloadFileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportSummaryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportTagsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportViolationsDriftOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScanReportDownloadFileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScanReportOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetServiceOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetSettingsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Import; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.InstanceAttachmentsPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListControlLibrariesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListInstanceAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfileAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfileParametersOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfilesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProviderTypeInstancesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProviderTypesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListReportEvaluationsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListReportResourcesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListReportsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListRulesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListScanReportsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListScopesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListServicesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListSubscopesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListTargetsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadById; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ObjectStoragePrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.PostTestEventOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Profile; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControlsPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileDefaultParametersResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfilesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderType; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstance; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceCustomControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileAttachmentOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileParametersOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Report; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportEvaluationsPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportLatest; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportResourcesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportSummary; +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.RequiredConfigConditionListConditionListConditionAnd; +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.RuleParameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTargetPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RulesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScanReport; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScanReportCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Service; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ServiceCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Settings; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScopeResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubscopesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Target; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetCollection; +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.UpdateScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSettingsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpgradeAttachmentOptions; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class contains examples of how to use the Security and Compliance Center API service. + * + * The following configuration properties are assumed to be defined: + * SECURITY_AND_COMPLIANCE_CENTER_API_URL=<service base url> + * SECURITY_AND_COMPLIANCE_CENTER_API_AUTH_TYPE=iam + * SECURITY_AND_COMPLIANCE_CENTER_API_APIKEY=<IAM apikey> + * SECURITY_AND_COMPLIANCE_CENTER_API_AUTH_URL=<IAM token service base URL - omit this if using the production environment> + * + * These configuration properties can be exported as environment variables, or stored + * in a configuration file and then: + * export IBM_CREDENTIALS_FILE=<name of configuration file> + */ +public class SecurityAndComplianceCenterApiExamples { + private static final Logger logger = LoggerFactory.getLogger(SecurityAndComplianceCenterApiExamples.class); + protected SecurityAndComplianceCenterApiExamples() { } + + static { + System.setProperty("IBM_CREDENTIALS_FILE", "../../security_and_compliance_center_api_v3.env"); + } + + /** + * The main() function invokes operations of the Security and Compliance Center API service. + * @param args command-line arguments + * @throws Exception an error occurred + */ + @SuppressWarnings("checkstyle:methodlength") + public static void main(String[] args) throws Exception { + SecurityAndComplianceCenterApi securityAndComplianceCenterApiService = SecurityAndComplianceCenterApi.newInstance(); + + // Load up our test-specific config properties. + Map testConfigProperties = CredentialUtils.getServiceProperties(SecurityAndComplianceCenterApi.DEFAULT_SERVICE_NAME); + + // Variables to hold link values + String accountIdForReportLink = null; + String attachmentIdForReportLink = null; + String attachmentIdLink = null; + String controlLibraryIdLink = null; + String eTagLink = null; + String eventNotificationsCrnForUpdateSettingsLink = null; + String groupIdForReportLink = null; + String objectStorageBucketForUpdateSettingsLink = null; + String objectStorageCrnForUpdateSettingsLink = null; + String objectStorageLocationForUpdateSettingsLink = null; + String profileIdForReportLink = null; + String profileIdLink = null; + String providerTypeInstanceIdLink = null; + String reportIdForReportLink = null; + String ruleIdLink = null; + String scanIdForScanReportLink = null; + String scopeIdLink = null; + String subScopeIdLink = null; + String targetIdLink = null; + String typeForReportLink = null; + + try { + System.out.println("getSettings() result:"); + // begin-get_settings + GetSettingsOptions getSettingsOptions = new GetSettingsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .build(); + + Response response = securityAndComplianceCenterApiService.getSettings(getSettingsOptions).execute(); + Settings settings = response.getResult(); + + System.out.println(settings); + // end-get_settings + + eventNotificationsCrnForUpdateSettingsLink = settings.getEventNotifications().getInstanceCrn(); + objectStorageCrnForUpdateSettingsLink = settings.getObjectStorage().getInstanceCrn(); + objectStorageBucketForUpdateSettingsLink = settings.getObjectStorage().getBucket(); + objectStorageLocationForUpdateSettingsLink = settings.getObjectStorage().getBucketLocation(); + } 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 + ObjectStoragePrototype objectStoragePrototypeModel = new ObjectStoragePrototype.Builder() + .bucket("px-scan-results") + .instanceCrn("crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") + .build(); + EventNotificationsPrototype eventNotificationsPrototypeModel = new EventNotificationsPrototype.Builder() + .instanceCrn("crn:v1:staging: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("scc-sdk-integration") + .build(); + UpdateSettingsOptions updateSettingsOptions = new UpdateSettingsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .objectStorage(objectStoragePrototypeModel) + .eventNotifications(eventNotificationsPrototypeModel) + .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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .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("listInstanceAttachments() result:"); + // begin-list_instance_attachments + ListInstanceAttachmentsOptions listInstanceAttachmentsOptions = new ListInstanceAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId(accountIdForReportLink) + .versionGroupLabel("6702d85a-6437-4d6f-8701-c0146648787b") + .limit(Long.valueOf("10")) + .sort("created_on") + .direction("desc") + .build(); + + InstanceAttachmentsPager pager = new InstanceAttachmentsPager(securityAndComplianceCenterApiService, listInstanceAttachmentsOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } + + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // end-list_instance_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("createProfileAttachment() result:"); + // begin-create_profile_attachment + Parameter parameterModel = new Parameter.Builder() + .assessmentType("automated") + .assessmentId("rule-e16fcfea-fe21-4d30-a721-423611481fea") + .parameterName("tls_version") + .parameterDisplayName("IBM Cloud Internet Services TLS version") + .parameterType("string_list") + .parameterValue("[\"1.2\", \"1.3\"]") + .build(); + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList()) + .build(); + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() + .enabled(true) + .controls(attachmentNotificationsControlsModel) + .build(); + MultiCloudScopePayloadById multiCloudScopePayloadModel = new MultiCloudScopePayloadById.Builder() + .id("8baad3b5-2e69-4027-9967-efac19508e1c") + .build(); + ProfileAttachmentBase profileAttachmentBaseModel = new ProfileAttachmentBase.Builder() + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .description("This is a profile attachment targeting IBM CIS Foundation using a SDK") + .name("Profile Attachment for IBM CIS Foundation SDK test") + .notifications(attachmentNotificationsModel) + .schedule("daily") + .scope(java.util.Arrays.asList(multiCloudScopePayloadModel)) + .status("disabled") + .build(); + CreateProfileAttachmentOptions createProfileAttachmentOptions = new CreateProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .newAttachments(java.util.Arrays.asList(profileAttachmentBaseModel)) + .newProfileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3") + .build(); + + Response response = securityAndComplianceCenterApiService.createProfileAttachment(createProfileAttachmentOptions).execute(); + ProfileAttachmentResponse profileAttachmentResponse = response.getResult(); + + System.out.println(profileAttachmentResponse); + // end-create_profile_attachment + + attachmentIdLink = profileAttachmentResponse.getAttachments().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("getProfileAttachment() result:"); + // begin-get_profile_attachment + GetProfileAttachmentOptions getProfileAttachmentOptions = new GetProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId(attachmentIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getProfileAttachment(getProfileAttachmentOptions).execute(); + ProfileAttachment profileAttachment = response.getResult(); + + System.out.println(profileAttachment); + // 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("replaceProfileAttachment() result:"); + // begin-replace_profile_attachment + Parameter parameterModel = new Parameter.Builder() + .build(); + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() + .build(); + MultiCloudScopePayloadById multiCloudScopePayloadModel = new MultiCloudScopePayloadById.Builder() + .build(); + ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions = new ReplaceProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId(attachmentIdLink) + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .description("testString") + .name("testString") + .notifications(attachmentNotificationsModel) + .schedule("daily") + .scope(java.util.Arrays.asList(multiCloudScopePayloadModel)) + .status("enabled") + .build(); + + Response response = securityAndComplianceCenterApiService.replaceProfileAttachment(replaceProfileAttachmentOptions).execute(); + ProfileAttachment profileAttachment = response.getResult(); + + System.out.println(profileAttachment); + // 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("upgradeAttachment() result:"); + // begin-upgrade_attachment + Parameter parameterModel = new Parameter.Builder() + .build(); + UpgradeAttachmentOptions upgradeAttachmentOptions = new UpgradeAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId(attachmentIdLink) + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .build(); + + Response response = securityAndComplianceCenterApiService.upgradeAttachment(upgradeAttachmentOptions).execute(); + ProfileAttachment profileAttachment = response.getResult(); + + System.out.println(profileAttachment); + // end-upgrade_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("createScan() result:"); + // begin-create_scan + CreateScanOptions createScanOptions = new CreateScanOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .attachmentId("4deb572c-9f37-4126-9cc0-d550672533cb") + .build(); + + Response response = securityAndComplianceCenterApiService.createScan(createScanOptions).execute(); + CreateScanResponse createScanResponse = response.getResult(); + + System.out.println(createScanResponse); + // 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("createControlLibrary() result:"); + // begin-create_control_library + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e") + .assessmentDescription("This rule will check on regulation") + .build(); + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("apprapp") + .environment("ibm-cloud") + .controlSpecificationDescription("This field is used to describe a control specification") + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) + .build(); + ControlDoc controlDocModel = new ControlDoc.Builder() + .build(); + ControlPrototype controlPrototypeModel = new ControlPrototype.Builder() + .controlName("security") + .controlDescription("This is a description of a control") + .controlCategory("test-control") + .controlRequirement(true) + .controlSpecifications(java.util.Arrays.asList(controlSpecificationPrototypeModel)) + .controlDocs(controlDocModel) + .status("disabled") + .build(); + CreateControlLibraryOptions createControlLibraryOptions = new CreateControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryName("custom control library from SDK") + .controlLibraryDescription("This is a custom control library made from the SDK test framework") + .controlLibraryType("custom") + .controlLibraryVersion("0.0.1") + .controls(java.util.Arrays.asList(controlPrototypeModel)) + .build(); + + Response response = securityAndComplianceCenterApiService.createControlLibrary(createControlLibraryOptions).execute(); + ControlLibrary controlLibrary = response.getResult(); + + System.out.println(controlLibrary); + // end-create_control_library + + controlLibraryIdLink = controlLibrary.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("listControlLibraries() result:"); + // begin-list_control_libraries + ListControlLibrariesOptions listControlLibrariesOptions = new ListControlLibrariesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId(accountIdForReportLink) + .limit(Long.valueOf("10")) + .build(); + + ControlLibrariesPager pager = new ControlLibrariesPager(securityAndComplianceCenterApiService, listControlLibrariesOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } + + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // 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("replaceCustomControlLibrary() result:"); + // begin-replace_custom_control_library + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e") + .assessmentDescription("This rule will check on regulation") + .build(); + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("apprapp") + .environment("ibm-cloud") + .controlSpecificationDescription("This field is used to describe a control specification") + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) + .build(); + ControlDoc controlDocModel = new ControlDoc.Builder() + .build(); + ControlPrototype controlPrototypeModel = new ControlPrototype.Builder() + .controlName("security") + .controlDescription("This is a description of a control") + .controlCategory("test-control") + .controlRequirement(true) + .controlSpecifications(java.util.Arrays.asList(controlSpecificationPrototypeModel)) + .controlDocs(controlDocModel) + .status("disabled") + .build(); + ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptions = new ReplaceCustomControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId(controlLibraryIdLink) + .controlLibraryName("custom control library from SDK") + .controlLibraryDescription("This is a custom control library made from the SDK test framework") + .controlLibraryType("custom") + .controlLibraryVersion("0.0.2") + .controls(java.util.Arrays.asList(controlPrototypeModel)) + .build(); + + Response response = securityAndComplianceCenterApiService.replaceCustomControlLibrary(replaceCustomControlLibraryOptions).execute(); + ControlLibrary controlLibrary = response.getResult(); + + 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("getControlLibrary() result:"); + // begin-get_control_library + GetControlLibraryOptions getControlLibraryOptions = new GetControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId(controlLibraryIdLink) + .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("createProfile() result:"); + // begin-create_profile + ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() + .controlLibraryId("a046fb6b-aba5-4646-b190-a2c76241e7af") + .controlId("60dae3b5-6104-4b3e-bac7-26cc7b741aca") + .build(); + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("automated") + .assessmentId("rule-e16fcfea-fe21-4d30-a721-423611481fea") + .parameterName("tls_version") + .parameterDefaultValue("[\"1.2\",\"1.3\"]") + .parameterDisplayName("IBM Cloud Internet Services TLS version") + .parameterType("string_list") + .build(); + CreateProfileOptions createProfileOptions = new CreateProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileName("Example Profile") + .profileVersion("0.0.1") + .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .profileDescription("This profile is created as an example of the SDK gen") + .latest(true) + .build(); + + Response response = securityAndComplianceCenterApiService.createProfile(createProfileOptions).execute(); + Profile profile = response.getResult(); + + System.out.println(profile); + // end-create_profile + + profileIdLink = profile.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("listProfiles() result:"); + // begin-list_profiles + ListProfilesOptions listProfilesOptions = new ListProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId(accountIdForReportLink) + .limit(Long.valueOf("10")) + .build(); + + ProfilesPager pager = new ProfilesPager(securityAndComplianceCenterApiService, listProfilesOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } + + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // 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("replaceProfile() result:"); + // begin-replace_profile + Parameter parameterModel = new Parameter.Builder() + .build(); + Assessment assessmentModel = new Assessment.Builder() + .parameters(java.util.Arrays.asList(parameterModel)) + .build(); + ControlSpecification controlSpecificationModel = new ControlSpecification.Builder() + .assessments(java.util.Arrays.asList(assessmentModel)) + .build(); + ProfileControls profileControlsModel = new ProfileControls.Builder() + .controlLibraryId("a046fb6b-aba5-4646-b190-a2c76241e7af") + .controlId("60dae3b5-6104-4b3e-bac7-26cc7b741aca") + .controlSpecifications(java.util.Arrays.asList(controlSpecificationModel)) + .build(); + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("automated") + .assessmentId("rule-e16fcfea-fe21-4d30-a721-423611481fea") + .parameterName("tls_version") + .parameterDefaultValue("[\"1.2\",\"1.3\"]") + .parameterDisplayName("IBM Cloud Internet Services TLS version") + .parameterType("string_list") + .build(); + ReplaceProfileOptions replaceProfileOptions = new ReplaceProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) + .newProfileType("custom") + .newControls(java.util.Arrays.asList(profileControlsModel)) + .newDefaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .newProfileName("Example Profile Updated") + .newProfileDescription("This profile has been updated") + .newProfileVersion("0.0.2") + .newLatest(true) + .build(); + + Response response = securityAndComplianceCenterApiService.replaceProfile(replaceProfileOptions).execute(); + Profile profile = response.getResult(); + + 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("getProfile() result:"); + // begin-get_profile + GetProfileOptions getProfileOptions = new GetProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getProfile(getProfileOptions).execute(); + Profile profile = response.getResult(); + + 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("replaceProfileParameters() result:"); + // begin-replace_profile_parameters + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .build(); + ReplaceProfileParametersOptions replaceProfileParametersOptions = new ReplaceProfileParametersOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .build(); + + Response response = securityAndComplianceCenterApiService.replaceProfileParameters(replaceProfileParametersOptions).execute(); + ProfileDefaultParametersResponse profileDefaultParametersResponse = response.getResult(); + + System.out.println(profileDefaultParametersResponse); + // end-replace_profile_parameters + } 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("listProfileParameters() result:"); + // begin-list_profile_parameters + ListProfileParametersOptions listProfileParametersOptions = new ListProfileParametersOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.listProfileParameters(listProfileParametersOptions).execute(); + ProfileDefaultParametersResponse profileDefaultParametersResponse = response.getResult(); + + System.out.println(profileDefaultParametersResponse); + // end-list_profile_parameters + } 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("compareProfiles() result:"); + // begin-compare_profiles + CompareProfilesOptions compareProfilesOptions = new CompareProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("2f598907-970d-4d52-9071-5cc95912f55e") + .build(); + + Response response = securityAndComplianceCenterApiService.compareProfiles(compareProfilesOptions).execute(); + ComparePredefinedProfilesResponse comparePredefinedProfilesResponse = response.getResult(); + + System.out.println(comparePredefinedProfilesResponse); + // end-compare_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("listProfileAttachments() result:"); + // begin-list_profile_attachments + ListProfileAttachmentsOptions listProfileAttachmentsOptions = new ListProfileAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .build(); + + Response response = securityAndComplianceCenterApiService.listProfileAttachments(listProfileAttachmentsOptions).execute(); + ProfileAttachmentCollection profileAttachmentCollection = response.getResult(); + + System.out.println(profileAttachmentCollection); + // end-list_profile_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("createScope() result:"); + // begin-create_scope + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("scope_id") + .value("ff88f007f9ff4622aac4fbc0eda36255") + .build(); + CreateScopeOptions createScopeOptions = new CreateScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .name("ibm scope") + .description("The scope that is defined for IBM resources.") + .environment("ibm-cloud") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) + .build(); + + Response response = securityAndComplianceCenterApiService.createScope(createScopeOptions).execute(); + Scope scope = response.getResult(); + + System.out.println(scope); + // end-create_scope + + scopeIdLink = scope.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("listScopes() result:"); + // begin-list_scopes + ListScopesOptions listScopesOptions = new ListScopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .name("testString") + .description("testString") + .environment("testString") + .build(); + + ScopesPager pager = new ScopesPager(securityAndComplianceCenterApiService, listScopesOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } + + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // end-list_scopes + } 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("updateScope() result:"); + // begin-update_scope + UpdateScopeOptions updateScopeOptions = new UpdateScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .name("updated name of scope") + .description("updated scope description") + .build(); + + Response response = securityAndComplianceCenterApiService.updateScope(updateScopeOptions).execute(); + Scope scope = response.getResult(); + + System.out.println(scope); + // end-update_scope + } 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("getScope() result:"); + // begin-get_scope + GetScopeOptions getScopeOptions = new GetScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getScope(getScopeOptions).execute(); + Scope scope = response.getResult(); + + System.out.println(scope); + // end-get_scope + } 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("createSubscope() result:"); + // begin-create_subscope + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("scope_id") + .value("1f689f08ec9b47b885c2659c17029581") + .build(); + ScopePrototype scopePrototypeModel = new ScopePrototype.Builder() + .name("ibm subscope update") + .description("The subscope that is defined for IBM resources.") + .environment("ibm-cloud") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) + .build(); + CreateSubscopeOptions createSubscopeOptions = new CreateSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .subscopes(java.util.Arrays.asList(scopePrototypeModel)) + .build(); + + Response response = securityAndComplianceCenterApiService.createSubscope(createSubscopeOptions).execute(); + SubScopeResponse subScopeResponse = response.getResult(); + + System.out.println(subScopeResponse); + // end-create_subscope + + subScopeIdLink = subScopeResponse.getSubscopes().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("listSubscopes() result:"); + // begin-list_subscopes + ListSubscopesOptions listSubscopesOptions = new ListSubscopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .limit(Long.valueOf("10")) + .name("testString") + .description("testString") + .environment("testString") + .build(); + + SubscopesPager pager = new SubscopesPager(securityAndComplianceCenterApiService, listSubscopesOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } + + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // end-list_subscopes + } 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("getSubscope() result:"); + // begin-get_subscope + GetSubscopeOptions getSubscopeOptions = new GetSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .subscopeId(subScopeIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getSubscope(getSubscopeOptions).execute(); + SubScope subScope = response.getResult(); + + System.out.println(subScope); + // end-get_subscope + } 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("updateSubscope() result:"); + // begin-update_subscope + UpdateSubscopeOptions updateSubscopeOptions = new UpdateSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .subscopeId(subScopeIdLink) + .name("updated name of scope") + .description("updated scope description") + .build(); + + Response response = securityAndComplianceCenterApiService.updateSubscope(updateSubscopeOptions).execute(); + SubScope subScope = response.getResult(); + + System.out.println(subScope); + // end-update_subscope + } 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("createTarget() result:"); + // begin-create_target + CreateTargetOptions createTargetOptions = new CreateTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("62ecf99b240144dea9125666249edfcb") + .trustedProfileId("Profile-cb2c1829-9a8d-4218-b9cd-9f83fc814e54") + .name("Target for IBM account") + .build(); + + Response response = securityAndComplianceCenterApiService.createTarget(createTargetOptions).execute(); + Target target = response.getResult(); + + System.out.println(target); + // end-create_target + + targetIdLink = target.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("listTargets() result:"); + // begin-list_targets + ListTargetsOptions listTargetsOptions = new ListTargetsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .build(); + + Response response = securityAndComplianceCenterApiService.listTargets(listTargetsOptions).execute(); + TargetCollection targetCollection = response.getResult(); + + System.out.println(targetCollection); + // end-list_targets + } 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("getTarget() result:"); + // begin-get_target + GetTargetOptions getTargetOptions = new GetTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId(targetIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getTarget(getTargetOptions).execute(); + Target target = response.getResult(); + + System.out.println(target); + // end-get_target + } 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("replaceTarget() result:"); + // begin-replace_target + ReplaceTargetOptions replaceTargetOptions = new ReplaceTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId(targetIdLink) + .accountId("be200c80cabc456e91139e4152327823") + .trustedProfileId("Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3") + .name("Sample Target Name") + .build(); + + Response response = securityAndComplianceCenterApiService.replaceTarget(replaceTargetOptions).execute(); + Target target = response.getResult(); + + System.out.println(target); + // end-replace_target + } 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("createProviderTypeInstance() result:"); + // begin-create_provider_type_instance + CreateProviderTypeInstanceOptions createProviderTypeInstanceOptions = new CreateProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .build(); + + Response response = securityAndComplianceCenterApiService.createProviderTypeInstance(createProviderTypeInstanceOptions).execute(); + ProviderTypeInstance providerTypeInstance = response.getResult(); + + System.out.println(providerTypeInstance); + // end-create_provider_type_instance + + providerTypeInstanceIdLink = providerTypeInstance.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("listProviderTypeInstances() result:"); + // begin-list_provider_type_instances + ListProviderTypeInstancesOptions listProviderTypeInstancesOptions = new ListProviderTypeInstancesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .build(); + + Response response = securityAndComplianceCenterApiService.listProviderTypeInstances(listProviderTypeInstancesOptions).execute(); + ProviderTypeInstanceCollection providerTypeInstanceCollection = response.getResult(); + + System.out.println(providerTypeInstanceCollection); + // end-list_provider_type_instances + } 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("getProviderTypeInstance() result:"); + // begin-get_provider_type_instance + GetProviderTypeInstanceOptions getProviderTypeInstanceOptions = new GetProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .providerTypeInstanceId(providerTypeInstanceIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getProviderTypeInstance(getProviderTypeInstanceOptions).execute(); + ProviderTypeInstance providerTypeInstance = response.getResult(); + + System.out.println(providerTypeInstance); + // end-get_provider_type_instance + } 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("updateProviderTypeInstance() result:"); + // begin-update_provider_type_instance + UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptions = new UpdateProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .providerTypeInstanceId(providerTypeInstanceIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.updateProviderTypeInstance(updateProviderTypeInstanceOptions).execute(); + ProviderTypeInstance providerTypeInstance = response.getResult(); + + System.out.println(providerTypeInstance); + // end-update_provider_type_instance + } 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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .build(); + + Response response = securityAndComplianceCenterApiService.listProviderTypes(listProviderTypesOptions).execute(); + ProviderTypeCollection providerTypeCollection = response.getResult(); + + System.out.println(providerTypeCollection); + // end-list_provider_types + } 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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .build(); + + Response response = securityAndComplianceCenterApiService.getProviderTypeById(getProviderTypeByIdOptions).execute(); + ProviderType providerType = response.getResult(); + + System.out.println(providerType); + // 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("getLatestReports() result:"); + // begin-get_latest_reports + GetLatestReportsOptions getLatestReportsOptions = new GetLatestReportsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .build(); + + Response response = securityAndComplianceCenterApiService.getLatestReports(getLatestReportsOptions).execute(); + ReportLatest reportLatest = response.getResult(); + + System.out.println(reportLatest); + // end-get_latest_reports + + accountIdForReportLink = reportLatest.getReports().get(0).getAccount().id(); + 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); + } + + try { + System.out.println("listReports() result:"); + // begin-list_reports + ListReportsOptions listReportsOptions = new ListReportsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportAttachmentId(attachmentIdForReportLink) + .groupId(groupIdForReportLink) + .reportProfileId(profileIdForReportLink) + .type(typeForReportLink) + .limit(Long.valueOf("10")) + .sort("profile_name") + .build(); + + ReportsPager pager = new ReportsPager(securityAndComplianceCenterApiService, listReportsOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + 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) + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .build(); + + Response response = securityAndComplianceCenterApiService.getReport(getReportOptions).execute(); + Report report = response.getResult(); + + System.out.println(report); + // end-get_report + } 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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getReportSummary(getReportSummaryOptions).execute(); + ReportSummary reportSummary = response.getResult(); + + System.out.println(reportSummary); + // end-get_report_summary + } 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("getReportDownloadFile() result:"); + // begin-get_report_download_file + GetReportDownloadFileOptions getReportDownloadFileOptions = new GetReportDownloadFileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getReportDownloadFile(getReportDownloadFileOptions).execute(); + try (InputStream inputStream = response.getResult();) { + inputStream.transferTo(new java.io.FileOutputStream("result.out")); + } + // end-get_report_download_file + } 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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .status("compliant") + .build(); + + Response response = securityAndComplianceCenterApiService.getReportControls(getReportControlsOptions).execute(); + ReportControls reportControls = response.getResult(); + + System.out.println(reportControls); + // end-get_report_controls + } 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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .ruleId("rule-61fa114a-2bb9-43fd-8068-b873b48bdf79") + .build(); + + Response response = securityAndComplianceCenterApiService.getReportRule(getReportRuleOptions).execute(); + RuleInfo ruleInfo = response.getResult(); + + System.out.println(ruleInfo); + // end-get_report_rule + } 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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .assessmentId("testString") + .assessmentMethod("testString") + .componentId("testString") + .targetId("testString") + .targetEnv("testString") + .targetName("testString") + .status("failure") + .limit(Long.valueOf("10")) + .sort("assessment_id") + .scopeId("testString") + .subscopeId("testString") + .build(); + + ReportEvaluationsPager pager = new ReportEvaluationsPager(securityAndComplianceCenterApiService, listReportEvaluationsOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } + + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // 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("listReportResources() result:"); + // begin-list_report_resources + ListReportResourcesOptions listReportResourcesOptions = new ListReportResourcesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .id("testString") + .resourceName("testString") + .accountId(accountIdForReportLink) + .componentId("testString") + .status("compliant") + .sort("account_id") + .limit(Long.valueOf("10")) + .scopeId("testString") + .subscopeId("testString") + .build(); + + ReportResourcesPager pager = new ReportResourcesPager(securityAndComplianceCenterApiService, listReportResourcesOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } + + 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("getReportTags() result:"); + // begin-get_report_tags + GetReportTagsOptions getReportTagsOptions = new GetReportTagsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getReportTags(getReportTagsOptions).execute(); + ReportTags reportTags = response.getResult(); + + System.out.println(reportTags); + // end-get_report_tags + } 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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getReportViolationsDrift(getReportViolationsDriftOptions).execute(); + ReportViolationsDrift reportViolationsDrift = response.getResult(); + + System.out.println(reportViolationsDrift); + // end-get_report_violations_drift + } 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("listScanReports() result:"); + // begin-list_scan_reports + ListScanReportsOptions listScanReportsOptions = new ListScanReportsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .build(); + + Response response = securityAndComplianceCenterApiService.listScanReports(listScanReportsOptions).execute(); + ScanReportCollection scanReportCollection = response.getResult(); + + System.out.println(scanReportCollection); + // end-list_scan_reports + + scanIdForScanReportLink = scanReportCollection.getScanReports().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("createScanReport() result:"); + // begin-create_scan_report + CreateScanReportOptions createScanReportOptions = new CreateScanReportOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .format("csv") + .scopeId("132009ff-b982-412e-a110-ad8797e10f84") + .subscopeId("c7ddcbcc-6a43-4ab3-b6a7-b2d8f65cd54a") + .build(); + + Response response = securityAndComplianceCenterApiService.createScanReport(createScanReportOptions).execute(); + CreateScanReport createScanReport = response.getResult(); + + System.out.println(createScanReport); + // end-create_scan_report + } 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("getScanReport() result:"); + // begin-get_scan_report + GetScanReportOptions getScanReportOptions = new GetScanReportOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .jobId(scanIdForScanReportLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getScanReport(getScanReportOptions).execute(); + ScanReport scanReport = response.getResult(); + + System.out.println(scanReport); + // end-get_scan_report + } 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("getScanReportDownloadFile() result:"); + // begin-get_scan_report_download_file + GetScanReportDownloadFileOptions getScanReportDownloadFileOptions = new GetScanReportDownloadFileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .jobId(scanIdForScanReportLink) + .build(); + + Response response = securityAndComplianceCenterApiService.getScanReportDownloadFile(getScanReportDownloadFileOptions).execute(); + try (InputStream inputStream = response.getResult();) { + inputStream.transferTo(new java.io.FileOutputStream("result.out")); + } + // end-get_scan_report_download_file + } 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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .type("system_defined") + .search("testString") + .serviceName("testString") + .sort("updated_on") + .build(); + + RulesPager pager = new RulesPager(securityAndComplianceCenterApiService, listRulesOptions); + List allResults = new ArrayList<>(); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + allResults.addAll(nextPage); + } + + System.out.println(GsonSingleton.getGson().toJson(allResults)); + // 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("createRule() result:"); + // begin-create_rule + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("location") + .operator("string_equals") + .value("us-east") + .build(); + RuleTargetPrototype ruleTargetPrototypeModel = new RuleTargetPrototype.Builder() + .serviceName("cloud-object-storage") + .resourceKind("bucket") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .build(); + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .property("hard_quota") + .operator("num_equals") + .value("${hard_quota}") + .build(); + RequiredConfigConditionListConditionListConditionAnd requiredConfigModel = new RequiredConfigConditionListConditionListConditionAnd.Builder() + .description("The Cloud Object Storage rule.") + .and(java.util.Arrays.asList(conditionItemModel)) + .build(); + RuleParameter ruleParameterModel = new RuleParameter.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(ruleParameterModel)) + .build(); + CreateRuleOptions createRuleOptions = new CreateRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .description("Example rule") + .target(ruleTargetPrototypeModel) + .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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .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("replaceRule() result:"); + // begin-replace_rule + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("location") + .operator("string_equals") + .value("us-south") + .build(); + RuleTargetPrototype ruleTargetPrototypeModel = new RuleTargetPrototype.Builder() + .serviceName("cloud-object-storage") + .resourceKind("bucket") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .build(); + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .property("hard_quota") + .operator("num_equals") + .value("${hard_quota}") + .build(); + RequiredConfigConditionListConditionListConditionAnd requiredConfigModel = new RequiredConfigConditionListConditionListConditionAnd.Builder() + .description("The Cloud Object Storage rule.") + .and(java.util.Arrays.asList(conditionItemModel)) + .build(); + RuleParameter ruleParameterModel = new RuleParameter.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(ruleParameterModel)) + .build(); + ReplaceRuleOptions replaceRuleOptions = new ReplaceRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .ruleId(ruleIdLink) + .ifMatch(eTagLink) + .description("Example rule") + .target(ruleTargetPrototypeModel) + .requiredConfig(requiredConfigModel) + .version("1.0.1") + .xImport(importModel) + .labels(java.util.Arrays.asList()) + .build(); + + Response response = securityAndComplianceCenterApiService.replaceRule(replaceRuleOptions).execute(); + Rule rule = response.getResult(); + + System.out.println(rule); + // end-replace_rule + } 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("listServices() result:"); + // begin-list_services + ListServicesOptions listServicesOptions = new ListServicesOptions(); + + Response response = securityAndComplianceCenterApiService.listServices(listServicesOptions).execute(); + ServiceCollection serviceCollection = response.getResult(); + + System.out.println(serviceCollection); + // end-list_services + } 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("getService() result:"); + // begin-get_service + GetServiceOptions getServiceOptions = new GetServiceOptions.Builder() + .servicesName("cloud-object-storage") + .build(); + + Response response = securityAndComplianceCenterApiService.getService(getServiceOptions).execute(); + Service service = response.getResult(); + + System.out.println(service); + // end-get_service + } 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("deleteProfileAttachment() result:"); + // begin-delete_profile_attachment + DeleteProfileAttachmentOptions deleteProfileAttachmentOptions = new DeleteProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId(attachmentIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.deleteProfileAttachment(deleteProfileAttachmentOptions).execute(); + ProfileAttachment profileAttachment = response.getResult(); + + System.out.println(profileAttachment); + // end-delete_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("deleteCustomControlLibrary() result:"); + // begin-delete_custom_control_library + DeleteCustomControlLibraryOptions deleteCustomControlLibraryOptions = new DeleteCustomControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId(controlLibraryIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.deleteCustomControlLibrary(deleteCustomControlLibraryOptions).execute(); + ControlLibrary controlLibrary = response.getResult(); + + System.out.println(controlLibrary); + // end-delete_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("deleteCustomProfile() result:"); + // begin-delete_custom_profile + DeleteCustomProfileOptions deleteCustomProfileOptions = new DeleteCustomProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.deleteCustomProfile(deleteCustomProfileOptions).execute(); + Profile profile = response.getResult(); + + System.out.println(profile); + // end-delete_custom_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 { + // begin-delete_subscope + DeleteSubscopeOptions deleteSubscopeOptions = new DeleteSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .subscopeId(subScopeIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.deleteSubscope(deleteSubscopeOptions).execute(); + // end-delete_subscope + System.out.printf("deleteSubscope() response status code: %d%n", response.getStatusCode()); + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + + try { + // begin-delete_scope + DeleteScopeOptions deleteScopeOptions = new DeleteScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.deleteScope(deleteScopeOptions).execute(); + // end-delete_scope + System.out.printf("deleteScope() response status code: %d%n", response.getStatusCode()); + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + + try { + // begin-delete_target + DeleteTargetOptions deleteTargetOptions = new DeleteTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId(targetIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.deleteTarget(deleteTargetOptions).execute(); + // end-delete_target + System.out.printf("deleteTarget() response status code: %d%n", response.getStatusCode()); + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + + try { + // begin-delete_provider_type_instance + DeleteProviderTypeInstanceOptions deleteProviderTypeInstanceOptions = new DeleteProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .providerTypeInstanceId(providerTypeInstanceIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.deleteProviderTypeInstance(deleteProviderTypeInstanceOptions).execute(); + // end-delete_provider_type_instance + System.out.printf("deleteProviderTypeInstance() response status code: %d%n", response.getStatusCode()); + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + + try { + // begin-delete_rule + DeleteRuleOptions deleteRuleOptions = new DeleteRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .ruleId(ruleIdLink) + .build(); + + Response response = securityAndComplianceCenterApiService.deleteRule(deleteRuleOptions).execute(); + // end-delete_rule + System.out.printf("deleteRule() response status code: %d%n", response.getStatusCode()); + } catch (ServiceResponseException e) { + logger.error(String.format("Service returned status code %s: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e); + } + } +} diff --git a/modules/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 77fb49cf..9f665f59 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -12,13 +12,13 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.76.0-ad3e6f96-20230724-172814 + * IBM OpenAPI SDK Code Generator Version: 3.98.0-8be2046a-20241205-162752 */ package com.ibm.cloud.security_and_compliance_center_api.v3; import com.google.gson.JsonObject; -import com.ibm.cloud.security_and_compliance_center_api.common.SdkCommon; +import com.ibm.cloud.common.SdkCommon; import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; @@ -26,23 +26,30 @@ import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; import com.ibm.cloud.sdk.core.service.BaseService; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentItem; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComparePredefinedProfilesResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CompareProfilesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrary; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryDelete; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateAttachmentOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateCustomControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProviderTypeInstanceOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateRuleOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanReport; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanReportOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateTargetOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteCustomControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteCustomProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteProviderTypeInstanceOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteTargetOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationPage; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetLatestReportsOptions; @@ -50,19 +57,25 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypeByIdOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypeInstanceOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypesInstancesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportControlsOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportEvaluationOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportDownloadFileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportRuleOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportSummaryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportTagsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportViolationsDriftOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScanReportDownloadFileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScanReportOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetServiceOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetSettingsOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListAttachmentsAccountOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetTargetOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListControlLibrariesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListInstanceAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfileAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfileParametersOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfilesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProviderTypeInstancesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProviderTypesOptions; @@ -70,44 +83,66 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListReportResourcesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListReportsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListRulesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListScanReportsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListScopesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListServicesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListSubscopesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListTargetsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.PostTestEventOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Profile; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileCollection; -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; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypesCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypesInstancesResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileDefaultParametersResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderType; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstance; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceCustomControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileParametersOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceTargetOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Report; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportControls; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportLatest; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportPage; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportSummary; 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.ResourcePage; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Rule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleCollection; 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.ScanReport; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScanReportCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Service; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ServiceCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Settings; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScopeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScopeResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Target; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetCollection; 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.UpdateScopeOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSettingsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpgradeAttachmentOptions; import java.io.InputStream; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; /** - * Security and Compliance Center API - * . + * The Security and Compliance Center API reference. * - * API Version: 3.0.0 */ public class SecurityAndComplianceCenterApi extends BaseService { @@ -119,20 +154,33 @@ public class SecurityAndComplianceCenterApi extends BaseService { /** * Default service endpoint URL. */ - public static final String DEFAULT_SERVICE_URL = "https://us-south.compliance.cloud.ibm.com/instances/instance_id/v3"; + public static final String DEFAULT_SERVICE_URL = "https://us-south.compliance.cloud.ibm.com"; - /** - * The parameterized service endpoint URL. - */ - public static final String PARAMETERIZED_SERVICE_URL = "https://{region}.cloud.ibm.com/instances/{instance_id}/v3"; + private static final Map _regionalEndpoints; + static { + Map m = new HashMap<>(); + m.put("us-south", "https://us-south.compliance.cloud.ibm.com"); // Dallas region + + m.put("eu-de", "https://eu-de.compliance.cloud.ibm.com"); // Frankfurt region + + m.put("eu-fr2", "https://eu-fr2.compliance.cloud.ibm.com"); // Frankfurt region(Restricted) - private static final Map defaultUrlVariables = createDefaultUrlVariables(); + m.put("ca-tor", "https://ca-tor.compliance.cloud.ibm.com"); // Toronto region - private static Map createDefaultUrlVariables() { - Map map = new HashMap<>(); - map.put("region", "us-south.compliance"); - map.put("instance_id", "instance_id"); - return map; + m.put("au-syd", "https://au-syd.compliance.cloud.ibm.com"); // Sydney region + + m.put("eu-es", "https://eu-es.compliance.cloud.ibm.com"); // Madrid region + _regionalEndpoints = Collections.unmodifiableMap(m); + } + + /** + * Returns the service URL associated with the specified region. + * @param region a string representing the region + * @return the service URL associated with the specified region or null + * if no mapping for the region exists + */ + public static String getServiceUrlForRegion(String region) { + return _regionalEndpoints.get(region); } /** @@ -172,26 +220,7 @@ public SecurityAndComplianceCenterApi(String serviceName, Authenticator authenti } /** - * Constructs a service URL by formatting the parameterized service URL. - * - * The parameterized service URL is: - * 'https://{region}.cloud.ibm.com/instances/{instance_id}/v3' - * - * The default variable values are: - * - 'region': 'us-south.compliance' - * - 'instance_id': 'instance_id' - * - * @param providedUrlVariables map from variable names to desired values. - * If a variable is not provided in this map, - * the default variable value will be used instead. - * @return the formatted URL with all variable placeholders replaced by values. - */ - public static String constructServiceUrl(Map providedUrlVariables) { - return BaseService.constructServiceUrl(PARAMETERIZED_SERVICE_URL, defaultUrlVariables, providedUrlVariables); - } - - /** - * Get settings. + * List settings. * * Retrieve the settings of your service instance. * @@ -199,37 +228,21 @@ public static String constructServiceUrl(Map providedUrlVariable * @return a {@link ServiceCall} with a result of type {@link Settings} */ public ServiceCall getSettings(GetSettingsOptions getSettingsOptions) { - if (getSettingsOptions == null) { - getSettingsOptions = new GetSettingsOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/settings")); + com.ibm.cloud.sdk.core.util.Validator.notNull(getSettingsOptions, + "getSettingsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getSettingsOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/settings", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getSettings"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getSettingsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getSettingsOptions.xCorrelationId()); - } - if (getSettingsOptions.xRequestId() != null) { - builder.header("X-Request-ID", getSettingsOptions.xRequestId()); - } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } - /** - * Get settings. - * - * Retrieve the settings of your service instance. - * - * @return a {@link ServiceCall} with a result of type {@link Settings} - */ - public ServiceCall getSettings() { - return getSettings(null); - } - /** * Update settings. * @@ -241,42 +254,27 @@ public ServiceCall getSettings() { public ServiceCall updateSettings(UpdateSettingsOptions updateSettingsOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull(updateSettingsOptions, "updateSettingsOptions cannot be null"); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/settings")); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", updateSettingsOptions.instanceId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/settings", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "updateSettings"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (updateSettingsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", updateSettingsOptions.xCorrelationId()); - } - if (updateSettingsOptions.xRequestId() != null) { - builder.header("X-Request-ID", updateSettingsOptions.xRequestId()); - } final JsonObject contentJson = new JsonObject(); - if (updateSettingsOptions.eventNotifications() != null) { - contentJson.add("event_notifications", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.eventNotifications())); - } if (updateSettingsOptions.objectStorage() != null) { contentJson.add("object_storage", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.objectStorage())); } + if (updateSettingsOptions.eventNotifications() != null) { + contentJson.add("event_notifications", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateSettingsOptions.eventNotifications())); + } builder.bodyJson(contentJson); ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } - /** - * Update settings. - * - * Update the settings of your service instance. - * - * @return a {@link ServiceCall} with a result of type {@link Settings} - */ - public ServiceCall updateSettings() { - return updateSettings(null); - } - /** * Create a test event. * @@ -288,1024 +286,1503 @@ public ServiceCall updateSettings() { * @return a {@link ServiceCall} with a result of type {@link TestEvent} */ public ServiceCall postTestEvent(PostTestEventOptions postTestEventOptions) { - if (postTestEventOptions == null) { - postTestEventOptions = new PostTestEventOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/test_event")); + com.ibm.cloud.sdk.core.util.Validator.notNull(postTestEventOptions, + "postTestEventOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", postTestEventOptions.instanceId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/test_event", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "postTestEvent"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (postTestEventOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", postTestEventOptions.xCorrelationId()); - } - if (postTestEventOptions.xRequestId() != null) { - builder.header("X-Request-ID", postTestEventOptions.xRequestId()); - } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Create a test event. - * - * Send a test event to your Event Notifications instance to ensure that the events that are generated by Security - * and Compliance Center are being forwarded to Event Notifications. For more information, see [Enabling event - * notifications](/docs/security-compliance?topic=security-compliance-event-notifications#event-notifications-test-api). - * - * @return a {@link ServiceCall} with a result of type {@link TestEvent} - */ - public ServiceCall postTestEvent() { - return postTestEvent(null); - } - - /** - * List control libraries. + * Get all instance attachments. * - * Retrieve all of the control libraries that are available in your account, including predefined, and custom - * libraries. + * Retrieve all instance attachments. * - * With Security and Compliance Center, you can create 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. 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](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). + * With Security and Compliance Center, you can evaluate your resources on a recurring schedule or you can initiate a + * scan at any time. To evaluate your resources, you create an attachment. 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * - * @param listControlLibrariesOptions the {@link ListControlLibrariesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ControlLibraryCollection} + * @param listInstanceAttachmentsOptions the {@link ListInstanceAttachmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileAttachmentCollection} */ - public ServiceCall listControlLibraries(ListControlLibrariesOptions listControlLibrariesOptions) { - if (listControlLibrariesOptions == null) { - listControlLibrariesOptions = new ListControlLibrariesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/control_libraries")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listControlLibraries"); + public ServiceCall listInstanceAttachments(ListInstanceAttachmentsOptions listInstanceAttachmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listInstanceAttachmentsOptions, + "listInstanceAttachmentsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listInstanceAttachmentsOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/attachments", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listInstanceAttachments"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listControlLibrariesOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listControlLibrariesOptions.xCorrelationId()); + if (listInstanceAttachmentsOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listInstanceAttachmentsOptions.accountId())); } - if (listControlLibrariesOptions.xRequestId() != null) { - builder.header("X-Request-ID", listControlLibrariesOptions.xRequestId()); + if (listInstanceAttachmentsOptions.versionGroupLabel() != null) { + builder.query("version_group_label", String.valueOf(listInstanceAttachmentsOptions.versionGroupLabel())); } - if (listControlLibrariesOptions.limit() != null) { - builder.query("limit", String.valueOf(listControlLibrariesOptions.limit())); + if (listInstanceAttachmentsOptions.limit() != null) { + builder.query("limit", String.valueOf(listInstanceAttachmentsOptions.limit())); } - if (listControlLibrariesOptions.controlLibraryType() != null) { - builder.query("control_library_type", String.valueOf(listControlLibrariesOptions.controlLibraryType())); + if (listInstanceAttachmentsOptions.sort() != null) { + builder.query("sort", String.valueOf(listInstanceAttachmentsOptions.sort())); } - if (listControlLibrariesOptions.start() != null) { - builder.query("start", String.valueOf(listControlLibrariesOptions.start())); + if (listInstanceAttachmentsOptions.direction() != null) { + builder.query("direction", String.valueOf(listInstanceAttachmentsOptions.direction())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + if (listInstanceAttachmentsOptions.start() != null) { + builder.query("start", String.valueOf(listInstanceAttachmentsOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List control libraries. - * - * Retrieve all of the control libraries that are available in your account, including predefined, and custom - * libraries. - * - * With Security and Compliance Center, you can create 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. 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](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). - * - * @return a {@link ServiceCall} with a result of type {@link ControlLibraryCollection} - */ - public ServiceCall listControlLibraries() { - return listControlLibraries(null); - } - - /** - * Create a custom control library. + * Create an attachment. * - * Create a custom control library that is specific to your organization's needs. + * Create an attachment to link to a profile. * - * With Security and Compliance Center, you can create 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. 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](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). + * With Security and Compliance Center, you can evaluate your resources on a recurring schedule or you can initiate a + * scan at any time. To evaluate your resources, you create an attachment. 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * - * @param createCustomControlLibraryOptions the {@link CreateCustomControlLibraryOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ControlLibrary} + * @param createProfileAttachmentOptions the {@link CreateProfileAttachmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileAttachmentResponse} */ - public ServiceCall createCustomControlLibrary(CreateCustomControlLibraryOptions createCustomControlLibraryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createCustomControlLibraryOptions, - "createCustomControlLibraryOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/control_libraries")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createCustomControlLibrary"); + public ServiceCall createProfileAttachment(CreateProfileAttachmentOptions createProfileAttachmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createProfileAttachmentOptions, + "createProfileAttachmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", createProfileAttachmentOptions.instanceId()); + pathParamsMap.put("profile_id", createProfileAttachmentOptions.profileId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/profiles/{profile_id}/attachments", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createProfileAttachment"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (createCustomControlLibraryOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", createCustomControlLibraryOptions.xCorrelationId()); - } - if (createCustomControlLibraryOptions.xRequestId() != null) { - builder.header("X-Request-ID", createCustomControlLibraryOptions.xRequestId()); + if (createProfileAttachmentOptions.accountId() != null) { + builder.query("account_id", String.valueOf(createProfileAttachmentOptions.accountId())); } final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("control_library_name", createCustomControlLibraryOptions.controlLibraryName()); - contentJson.addProperty("control_library_description", createCustomControlLibraryOptions.controlLibraryDescription()); - contentJson.addProperty("control_library_type", createCustomControlLibraryOptions.controlLibraryType()); - contentJson.add("controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createCustomControlLibraryOptions.controls())); - if (createCustomControlLibraryOptions.versionGroupLabel() != null) { - contentJson.addProperty("version_group_label", createCustomControlLibraryOptions.versionGroupLabel()); - } - if (createCustomControlLibraryOptions.controlLibraryVersion() != null) { - contentJson.addProperty("control_library_version", createCustomControlLibraryOptions.controlLibraryVersion()); - } - if (createCustomControlLibraryOptions.latest() != null) { - contentJson.addProperty("latest", createCustomControlLibraryOptions.latest()); - } - if (createCustomControlLibraryOptions.controlsCount() != null) { - contentJson.addProperty("controls_count", createCustomControlLibraryOptions.controlsCount()); + contentJson.add("attachments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileAttachmentOptions.newAttachments())); + if (createProfileAttachmentOptions.newProfileId() != null) { + contentJson.addProperty("profile_id", createProfileAttachmentOptions.newProfileId()); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete a control library. + * Get an attachment. * - * Delete a custom control library by providing the control library ID. You can find this ID by looking in the - * Security and Compliance Center UI. + * Retrieve an attachment that is linked to a profile by specifying the attachment ID. * - * 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](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). + * With Security and Compliance Center, you can evaluate your resources on a recurring schedule or you can initiate a + * scan at any time. To evaluate your resources, you create an attachment. 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * - * @param deleteCustomControlLibraryOptions the {@link DeleteCustomControlLibraryOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ControlLibraryDelete} + * @param getProfileAttachmentOptions the {@link GetProfileAttachmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileAttachment} */ - public ServiceCall deleteCustomControlLibrary(DeleteCustomControlLibraryOptions deleteCustomControlLibraryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCustomControlLibraryOptions, - "deleteCustomControlLibraryOptions cannot be null"); + public ServiceCall getProfileAttachment(GetProfileAttachmentOptions getProfileAttachmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getProfileAttachmentOptions, + "getProfileAttachmentOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("control_libraries_id", deleteCustomControlLibraryOptions.controlLibrariesId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/control_libraries/{control_libraries_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteCustomControlLibrary"); + pathParamsMap.put("instance_id", getProfileAttachmentOptions.instanceId()); + pathParamsMap.put("profile_id", getProfileAttachmentOptions.profileId()); + pathParamsMap.put("attachment_id", getProfileAttachmentOptions.attachmentId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/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()); } builder.header("Accept", "application/json"); - if (deleteCustomControlLibraryOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", deleteCustomControlLibraryOptions.xCorrelationId()); + if (getProfileAttachmentOptions.accountId() != null) { + builder.query("account_id", String.valueOf(getProfileAttachmentOptions.accountId())); } - if (deleteCustomControlLibraryOptions.xRequestId() != null) { - builder.header("X-Request-ID", deleteCustomControlLibraryOptions.xRequestId()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get a control library. + * Update an attachment. * - * View the details of a control library by specifying its ID. + * Update an attachment that is linked to a profile. * - * With Security and Compliance Center, you can create 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. 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](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). + * With Security and Compliance Center, you can evaluate your resources on a recurring schedule or you can initiate a + * scan at any time. To evaluate your resources, you create an attachment. 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * - * @param getControlLibraryOptions the {@link GetControlLibraryOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ControlLibrary} + * @param replaceProfileAttachmentOptions the {@link ReplaceProfileAttachmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileAttachment} */ - public ServiceCall getControlLibrary(GetControlLibraryOptions getControlLibraryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getControlLibraryOptions, - "getControlLibraryOptions cannot be null"); + public ServiceCall replaceProfileAttachment(ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceProfileAttachmentOptions, + "replaceProfileAttachmentOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("control_libraries_id", getControlLibraryOptions.controlLibrariesId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/control_libraries/{control_libraries_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getControlLibrary"); + pathParamsMap.put("instance_id", replaceProfileAttachmentOptions.instanceId()); + pathParamsMap.put("profile_id", replaceProfileAttachmentOptions.profileId()); + pathParamsMap.put("attachment_id", replaceProfileAttachmentOptions.attachmentId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/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()); } builder.header("Accept", "application/json"); - if (getControlLibraryOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getControlLibraryOptions.xCorrelationId()); + if (replaceProfileAttachmentOptions.accountId() != null) { + builder.query("account_id", String.valueOf(replaceProfileAttachmentOptions.accountId())); } - if (getControlLibraryOptions.xRequestId() != null) { - builder.header("X-Request-ID", getControlLibraryOptions.xRequestId()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("attachment_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.attachmentParameters())); + contentJson.addProperty("description", replaceProfileAttachmentOptions.description()); + contentJson.addProperty("name", replaceProfileAttachmentOptions.name()); + contentJson.add("notifications", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.notifications())); + contentJson.addProperty("schedule", replaceProfileAttachmentOptions.schedule()); + contentJson.add("scope", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.scope())); + contentJson.addProperty("status", replaceProfileAttachmentOptions.status()); + if (replaceProfileAttachmentOptions.dataSelectionRange() != null) { + contentJson.add("data_selection_range", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.dataSelectionRange())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Update a control library. + * Delete an attachment. * - * Update a custom control library by providing the control library ID. You can find this ID in the Security and - * Compliance Center UI. + * Delete an attachment that is linked to a profile. * - * 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](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). + * With Security and Compliance Center, you can evaluate your resources on a recurring schedule or you can initiate a + * scan at any time. To evaluate your resources, you create an attachment. 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). * - * @param replaceCustomControlLibraryOptions the {@link ReplaceCustomControlLibraryOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ControlLibrary} + * @param deleteProfileAttachmentOptions the {@link DeleteProfileAttachmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileAttachment} */ - public ServiceCall replaceCustomControlLibrary(ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceCustomControlLibraryOptions, - "replaceCustomControlLibraryOptions cannot be null"); + public ServiceCall deleteProfileAttachment(DeleteProfileAttachmentOptions deleteProfileAttachmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteProfileAttachmentOptions, + "deleteProfileAttachmentOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("control_libraries_id", replaceCustomControlLibraryOptions.controlLibrariesId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/control_libraries/{control_libraries_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "replaceCustomControlLibrary"); + pathParamsMap.put("instance_id", deleteProfileAttachmentOptions.instanceId()); + pathParamsMap.put("profile_id", deleteProfileAttachmentOptions.profileId()); + pathParamsMap.put("attachment_id", deleteProfileAttachmentOptions.attachmentId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/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()); } builder.header("Accept", "application/json"); - if (replaceCustomControlLibraryOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", replaceCustomControlLibraryOptions.xCorrelationId()); + if (deleteProfileAttachmentOptions.accountId() != null) { + builder.query("account_id", String.valueOf(deleteProfileAttachmentOptions.accountId())); } - if (replaceCustomControlLibraryOptions.xRequestId() != null) { - builder.header("X-Request-ID", replaceCustomControlLibraryOptions.xRequestId()); - } - final JsonObject contentJson = new JsonObject(); - if (replaceCustomControlLibraryOptions.id() != null) { - contentJson.addProperty("id", replaceCustomControlLibraryOptions.id()); - } - if (replaceCustomControlLibraryOptions.accountId() != null) { - contentJson.addProperty("account_id", replaceCustomControlLibraryOptions.accountId()); - } - if (replaceCustomControlLibraryOptions.controlLibraryName() != null) { - contentJson.addProperty("control_library_name", replaceCustomControlLibraryOptions.controlLibraryName()); - } - if (replaceCustomControlLibraryOptions.controlLibraryDescription() != null) { - contentJson.addProperty("control_library_description", replaceCustomControlLibraryOptions.controlLibraryDescription()); - } - if (replaceCustomControlLibraryOptions.controlLibraryType() != null) { - contentJson.addProperty("control_library_type", replaceCustomControlLibraryOptions.controlLibraryType()); - } - if (replaceCustomControlLibraryOptions.versionGroupLabel() != null) { - contentJson.addProperty("version_group_label", replaceCustomControlLibraryOptions.versionGroupLabel()); - } - if (replaceCustomControlLibraryOptions.controlLibraryVersion() != null) { - contentJson.addProperty("control_library_version", replaceCustomControlLibraryOptions.controlLibraryVersion()); - } - if (replaceCustomControlLibraryOptions.createdOn() != null) { - contentJson.add("created_on", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceCustomControlLibraryOptions.createdOn())); - } - if (replaceCustomControlLibraryOptions.createdBy() != null) { - contentJson.addProperty("created_by", replaceCustomControlLibraryOptions.createdBy()); - } - if (replaceCustomControlLibraryOptions.updatedOn() != null) { - contentJson.add("updated_on", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceCustomControlLibraryOptions.updatedOn())); - } - if (replaceCustomControlLibraryOptions.updatedBy() != null) { - contentJson.addProperty("updated_by", replaceCustomControlLibraryOptions.updatedBy()); - } - if (replaceCustomControlLibraryOptions.latest() != null) { - contentJson.addProperty("latest", replaceCustomControlLibraryOptions.latest()); - } - if (replaceCustomControlLibraryOptions.hierarchyEnabled() != null) { - contentJson.addProperty("hierarchy_enabled", replaceCustomControlLibraryOptions.hierarchyEnabled()); - } - if (replaceCustomControlLibraryOptions.controlsCount() != null) { - contentJson.addProperty("controls_count", replaceCustomControlLibraryOptions.controlsCount()); - } - if (replaceCustomControlLibraryOptions.controlParentsCount() != null) { - contentJson.addProperty("control_parents_count", replaceCustomControlLibraryOptions.controlParentsCount()); - } - if (replaceCustomControlLibraryOptions.controls() != null) { - contentJson.add("controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceCustomControlLibraryOptions.controls())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List profiles. + * Upgrade an attachment. * - * View all of the predefined and custom profiles that are available in your account. + * Upgrade an attachment to the latest version of a profile. * - * @param listProfilesOptions the {@link ListProfilesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProfileCollection} + * With Security and Compliance Center, you can evaluate your resources on a recurring schedule or you can initiate a + * scan at any time. To evaluate your resources, you create an attachment. 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * + * @param upgradeAttachmentOptions the {@link UpgradeAttachmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileAttachment} */ - public ServiceCall listProfiles(ListProfilesOptions listProfilesOptions) { - if (listProfilesOptions == null) { - listProfilesOptions = new ListProfilesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listProfiles"); + public ServiceCall upgradeAttachment(UpgradeAttachmentOptions upgradeAttachmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(upgradeAttachmentOptions, + "upgradeAttachmentOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", upgradeAttachmentOptions.instanceId()); + pathParamsMap.put("profile_id", upgradeAttachmentOptions.profileId()); + pathParamsMap.put("attachment_id", upgradeAttachmentOptions.attachmentId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/profiles/{profile_id}/attachments/{attachment_id}/upgrade", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "upgradeAttachment"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listProfilesOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listProfilesOptions.xCorrelationId()); - } - if (listProfilesOptions.xRequestId() != null) { - builder.header("X-Request-ID", listProfilesOptions.xRequestId()); - } - if (listProfilesOptions.limit() != null) { - builder.query("limit", String.valueOf(listProfilesOptions.limit())); - } - if (listProfilesOptions.profileType() != null) { - builder.query("profile_type", String.valueOf(listProfilesOptions.profileType())); - } - if (listProfilesOptions.start() != null) { - builder.query("start", String.valueOf(listProfilesOptions.start())); + if (upgradeAttachmentOptions.accountId() != null) { + builder.query("account_id", String.valueOf(upgradeAttachmentOptions.accountId())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + final JsonObject contentJson = new JsonObject(); + contentJson.add("attachment_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(upgradeAttachmentOptions.attachmentParameters())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List profiles. - * - * View all of the predefined and custom profiles that are available in your account. + * Create a scan. * - * @return a {@link ServiceCall} with a result of type {@link ProfileCollection} - */ - public ServiceCall listProfiles() { - return listProfiles(null); - } - - /** - * Create a custom profile. + * Create a scan to evaluate your resources. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * With Security and Compliance Center, you can evaluate your resources on a recurring schedule. If your attachment + * exists, but you don't want to wait for the next scan to see your posture, you can initiate an on-demand scan. For + * more information, see [Running a scan on + * demand](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources#scan-ondemand-api). * - * @param createProfileOptions the {@link CreateProfileOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Profile} + * @param createScanOptions the {@link CreateScanOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CreateScanResponse} */ - public ServiceCall createProfile(CreateProfileOptions createProfileOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createProfileOptions, - "createProfileOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/profiles")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createProfile"); + public ServiceCall createScan(CreateScanOptions createScanOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createScanOptions, + "createScanOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", createScanOptions.instanceId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scans", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createScan"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (createProfileOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", createProfileOptions.xCorrelationId()); - } - if (createProfileOptions.xRequestId() != null) { - builder.header("X-Request-ID", createProfileOptions.xRequestId()); + if (createScanOptions.accountId() != null) { + builder.query("account_id", String.valueOf(createScanOptions.accountId())); } final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("profile_name", createProfileOptions.profileName()); - contentJson.addProperty("profile_description", createProfileOptions.profileDescription()); - contentJson.addProperty("profile_type", createProfileOptions.profileType()); - contentJson.add("controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileOptions.controls())); - contentJson.add("default_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileOptions.defaultParameters())); + if (createScanOptions.attachmentId() != null) { + contentJson.addProperty("attachment_id", createScanOptions.attachmentId()); + } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete a custom profile. + * Create a custom control library. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * Create a custom control library that is specific to your organization's needs. * - * @param deleteCustomProfileOptions the {@link DeleteCustomProfileOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Profile} + * With Security and Compliance Center, you can create 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. 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](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). + * + * @param createControlLibraryOptions the {@link CreateControlLibraryOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ControlLibrary} */ - public ServiceCall deleteCustomProfile(DeleteCustomProfileOptions deleteCustomProfileOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCustomProfileOptions, - "deleteCustomProfileOptions cannot be null"); + public ServiceCall createControlLibrary(CreateControlLibraryOptions createControlLibraryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createControlLibraryOptions, + "createControlLibraryOptions cannot be null"); Map pathParamsMap = new HashMap(); - 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"); + pathParamsMap.put("instance_id", createControlLibraryOptions.instanceId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/control_libraries", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createControlLibrary"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (deleteCustomProfileOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", deleteCustomProfileOptions.xCorrelationId()); - } - if (deleteCustomProfileOptions.xRequestId() != null) { - builder.header("X-Request-ID", deleteCustomProfileOptions.xRequestId()); + if (createControlLibraryOptions.accountId() != null) { + builder.query("account_id", String.valueOf(createControlLibraryOptions.accountId())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("control_library_name", createControlLibraryOptions.controlLibraryName()); + contentJson.addProperty("control_library_description", createControlLibraryOptions.controlLibraryDescription()); + contentJson.addProperty("control_library_type", createControlLibraryOptions.controlLibraryType()); + contentJson.addProperty("control_library_version", createControlLibraryOptions.controlLibraryVersion()); + contentJson.add("controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createControlLibraryOptions.controls())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get a profile. + * Get all control libraries. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * Retrieve all the control libraries, including predefined, and custom libraries. * - * @param getProfileOptions the {@link GetProfileOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Profile} + * With Security and Compliance Center, you can create 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. 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](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} + */ + public ServiceCall listControlLibraries(ListControlLibrariesOptions listControlLibrariesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listControlLibrariesOptions, + "listControlLibrariesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listControlLibrariesOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/control_libraries", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listControlLibraries"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listControlLibrariesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listControlLibrariesOptions.accountId())); + } + if (listControlLibrariesOptions.limit() != null) { + builder.query("limit", String.valueOf(listControlLibrariesOptions.limit())); + } + if (listControlLibrariesOptions.start() != null) { + builder.query("start", String.valueOf(listControlLibrariesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a custom control library. + * + * Update a custom control library by specifying its ID. + * + * With Security and Compliance Center, you can create 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. 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](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} + */ + public ServiceCall replaceCustomControlLibrary(ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceCustomControlLibraryOptions, + "replaceCustomControlLibraryOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", replaceCustomControlLibraryOptions.instanceId()); + pathParamsMap.put("control_library_id", replaceCustomControlLibraryOptions.controlLibraryId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/control_libraries/{control_library_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "replaceCustomControlLibrary"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (replaceCustomControlLibraryOptions.bssAccount() != null) { + builder.query("bss_account", String.valueOf(replaceCustomControlLibraryOptions.bssAccount())); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("control_library_name", replaceCustomControlLibraryOptions.controlLibraryName()); + contentJson.addProperty("control_library_description", replaceCustomControlLibraryOptions.controlLibraryDescription()); + contentJson.addProperty("control_library_type", replaceCustomControlLibraryOptions.controlLibraryType()); + contentJson.addProperty("control_library_version", replaceCustomControlLibraryOptions.controlLibraryVersion()); + contentJson.add("controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceCustomControlLibraryOptions.controls())); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get a control library. + * + * View the details of a control library by specifying its ID. + * + * With Security and Compliance Center, you can create 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. 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](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} + */ + public ServiceCall getControlLibrary(GetControlLibraryOptions getControlLibraryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getControlLibraryOptions, + "getControlLibraryOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getControlLibraryOptions.instanceId()); + pathParamsMap.put("control_library_id", getControlLibraryOptions.controlLibraryId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/control_libraries/{control_library_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getControlLibrary"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (getControlLibraryOptions.accountId() != null) { + builder.query("account_id", String.valueOf(getControlLibraryOptions.accountId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a custom control library. + * + * Delete a custom control library by specifying its ID. + * + * With Security and Compliance Center, you can create 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. 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](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 ControlLibrary} + */ + public ServiceCall deleteCustomControlLibrary(DeleteCustomControlLibraryOptions deleteCustomControlLibraryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCustomControlLibraryOptions, + "deleteCustomControlLibraryOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", deleteCustomControlLibraryOptions.instanceId()); + pathParamsMap.put("control_library_id", deleteCustomControlLibraryOptions.controlLibraryId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/control_libraries/{control_library_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteCustomControlLibrary"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (deleteCustomControlLibraryOptions.accountId() != null) { + builder.query("account_id", String.valueOf(deleteCustomControlLibraryOptions.accountId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a custom profile. + * + * Create a user-defined custom profile. + * + * With Security and Compliance Center, you can create 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://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} + */ + public ServiceCall createProfile(CreateProfileOptions createProfileOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createProfileOptions, + "createProfileOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", createProfileOptions.instanceId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/profiles", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createProfile"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (createProfileOptions.accountId() != null) { + builder.query("account_id", String.valueOf(createProfileOptions.accountId())); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("profile_name", createProfileOptions.profileName()); + contentJson.addProperty("profile_version", createProfileOptions.profileVersion()); + contentJson.add("controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileOptions.controls())); + contentJson.add("default_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileOptions.defaultParameters())); + if (createProfileOptions.profileDescription() != null) { + contentJson.addProperty("profile_description", createProfileOptions.profileDescription()); + } + if (createProfileOptions.latest() != null) { + contentJson.addProperty("latest", createProfileOptions.latest()); + } + if (createProfileOptions.versionGroupLabel() != null) { + contentJson.addProperty("version_group_label", createProfileOptions.versionGroupLabel()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get all profiles. + * + * Retrieve all profiles, including predefined and custom profiles. + * + * With Security and Compliance Center, you can take advantage of predefined profiles that are curated based on + * industry standards. Or you can choose to create one that is specific to your usecase by using an existing library + * as a starting point. For more information, see [Building custom + * profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * + * @param listProfilesOptions the {@link ListProfilesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileCollection} + */ + public ServiceCall listProfiles(ListProfilesOptions listProfilesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listProfilesOptions, + "listProfilesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listProfilesOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/profiles", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listProfiles"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listProfilesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listProfilesOptions.accountId())); + } + if (listProfilesOptions.limit() != null) { + builder.query("limit", String.valueOf(listProfilesOptions.limit())); + } + if (listProfilesOptions.start() != null) { + builder.query("start", String.valueOf(listProfilesOptions.start())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a custom profile. + * + * Update the details of a user-defined profile. + * + * With Security and Compliance Center, you can create 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://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} + */ + public ServiceCall replaceProfile(ReplaceProfileOptions replaceProfileOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceProfileOptions, + "replaceProfileOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", replaceProfileOptions.instanceId()); + pathParamsMap.put("profile_id", replaceProfileOptions.profileId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/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()); + } + builder.header("Accept", "application/json"); + if (replaceProfileOptions.accountId() != null) { + builder.query("account_id", String.valueOf(replaceProfileOptions.accountId())); + } + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("profile_type", replaceProfileOptions.newProfileType()); + contentJson.add("controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileOptions.newControls())); + contentJson.add("default_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileOptions.newDefaultParameters())); + if (replaceProfileOptions.newId() != null) { + contentJson.addProperty("id", replaceProfileOptions.newId()); + } + if (replaceProfileOptions.newProfileName() != null) { + contentJson.addProperty("profile_name", replaceProfileOptions.newProfileName()); + } + if (replaceProfileOptions.newInstanceId() != null) { + contentJson.addProperty("instance_id", replaceProfileOptions.newInstanceId()); + } + if (replaceProfileOptions.newHierarchyEnabled() != null) { + contentJson.addProperty("hierarchy_enabled", replaceProfileOptions.newHierarchyEnabled()); + } + if (replaceProfileOptions.newProfileDescription() != null) { + contentJson.addProperty("profile_description", replaceProfileOptions.newProfileDescription()); + } + if (replaceProfileOptions.newProfileVersion() != null) { + contentJson.addProperty("profile_version", replaceProfileOptions.newProfileVersion()); + } + if (replaceProfileOptions.newVersionGroupLabel() != null) { + contentJson.addProperty("version_group_label", replaceProfileOptions.newVersionGroupLabel()); + } + if (replaceProfileOptions.newLatest() != null) { + contentJson.addProperty("latest", replaceProfileOptions.newLatest()); + } + if (replaceProfileOptions.newCreatedBy() != null) { + contentJson.addProperty("created_by", replaceProfileOptions.newCreatedBy()); + } + if (replaceProfileOptions.newCreatedOn() != null) { + contentJson.add("created_on", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileOptions.newCreatedOn())); + } + if (replaceProfileOptions.newUpdatedBy() != null) { + contentJson.addProperty("updated_by", replaceProfileOptions.newUpdatedBy()); + } + if (replaceProfileOptions.newUpdatedOn() != null) { + contentJson.add("updated_on", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileOptions.newUpdatedOn())); + } + if (replaceProfileOptions.newControlsCount() != null) { + contentJson.addProperty("controls_count", replaceProfileOptions.newControlsCount()); + } + if (replaceProfileOptions.newAttachmentsCount() != null) { + contentJson.addProperty("attachments_count", replaceProfileOptions.newAttachmentsCount()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get a profile. + * + * Retrieve a profile by specifying the profile ID. + * + * With Security and Compliance Center, you can utilize predefined profiles that are curated based on industry + * standards. Or you can choose to create one that is specific to your usecase, by using an existing library as a + * starting point. For more information, see [Building custom + * 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} */ public ServiceCall getProfile(GetProfileOptions getProfileOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull(getProfileOptions, "getProfileOptions cannot be null"); Map pathParamsMap = new HashMap(); - 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"); + pathParamsMap.put("instance_id", getProfileOptions.instanceId()); + pathParamsMap.put("profile_id", getProfileOptions.profileId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/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()); + } + builder.header("Accept", "application/json"); + if (getProfileOptions.accountId() != null) { + builder.query("account_id", String.valueOf(getProfileOptions.accountId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a custom profile. + * + * Delete a custom profile by specifying the profile ID. + * + * With Security and Compliance Center, you can utilize predefined profiles that are curated based on industry + * standards. Or you can choose to create one that is specific to your usecase, by using an existing library as a + * starting point. For more information, see [Building custom + * 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} + */ + public ServiceCall deleteCustomProfile(DeleteCustomProfileOptions deleteCustomProfileOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCustomProfileOptions, + "deleteCustomProfileOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", deleteCustomProfileOptions.instanceId()); + pathParamsMap.put("profile_id", deleteCustomProfileOptions.profileId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/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()); + } + builder.header("Accept", "application/json"); + if (deleteCustomProfileOptions.accountId() != null) { + builder.query("account_id", String.valueOf(deleteCustomProfileOptions.accountId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update custom profile parameters. + * + * Update the parameters of a custom profile. + * + * With Security and Compliance Center, you can utilize predefined profiles that are curated based on industry + * standards. Or you can choose to create one that is specific to your usecase, by using an existing library as a + * starting point. For more information, see [Building custom + * profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * + * @param replaceProfileParametersOptions the {@link ReplaceProfileParametersOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileDefaultParametersResponse} + */ + public ServiceCall replaceProfileParameters(ReplaceProfileParametersOptions replaceProfileParametersOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceProfileParametersOptions, + "replaceProfileParametersOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", replaceProfileParametersOptions.instanceId()); + pathParamsMap.put("profile_id", replaceProfileParametersOptions.profileId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/profiles/{profile_id}/parameters", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "replaceProfileParameters"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (replaceProfileParametersOptions.accountId() != null) { + builder.query("account_id", String.valueOf(replaceProfileParametersOptions.accountId())); + } + final JsonObject contentJson = new JsonObject(); + contentJson.add("default_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileParametersOptions.defaultParameters())); + if (replaceProfileParametersOptions.id() != null) { + contentJson.addProperty("id", replaceProfileParametersOptions.id()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List profile parameters for a given profile. + * + * List the parameters used in the Profile. + * + * @param listProfileParametersOptions the {@link ListProfileParametersOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileDefaultParametersResponse} + */ + public ServiceCall listProfileParameters(ListProfileParametersOptions listProfileParametersOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listProfileParametersOptions, + "listProfileParametersOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listProfileParametersOptions.instanceId()); + pathParamsMap.put("profile_id", listProfileParametersOptions.profileId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/profiles/{profile_id}/parameters", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listProfileParameters"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Compare profiles. + * + * Compare the version of the profile that you're currently using with your attachment to the most recent profile + * version. By comparing them, you can view what controls were added, removed, or modified. For more information, see + * [Building custom + * profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * + * @param compareProfilesOptions the {@link CompareProfilesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ComparePredefinedProfilesResponse} + */ + public ServiceCall compareProfiles(CompareProfilesOptions compareProfilesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(compareProfilesOptions, + "compareProfilesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", compareProfilesOptions.instanceId()); + pathParamsMap.put("profile_id", compareProfilesOptions.profileId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/profiles/{profile_id}/compare", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "compareProfiles"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (compareProfilesOptions.accountId() != null) { + builder.query("account_id", String.valueOf(compareProfilesOptions.accountId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get all attachments linked to a specific profile. + * + * Retrieve all attachments that are linked to a profile. + * + * With Security and Compliance Center, you can evaluate your resources on a recurring schedule or you can initiate a + * scan at any time. To evaluate your resources, you create an attachment. 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * + * @param listProfileAttachmentsOptions the {@link ListProfileAttachmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProfileAttachmentCollection} + */ + public ServiceCall listProfileAttachments(ListProfileAttachmentsOptions listProfileAttachmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listProfileAttachmentsOptions, + "listProfileAttachmentsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listProfileAttachmentsOptions.instanceId()); + pathParamsMap.put("profile_id", listProfileAttachmentsOptions.profileId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/profiles/{profile_id}/attachments", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listProfileAttachments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listProfileAttachmentsOptions.accountId() != null) { + builder.query("account_id", String.valueOf(listProfileAttachmentsOptions.accountId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a scope. + * + * Create a scope. + * + * @param createScopeOptions the {@link CreateScopeOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Scope} + */ + public ServiceCall createScope(CreateScopeOptions createScopeOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createScopeOptions, + "createScopeOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", createScopeOptions.instanceId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createScope"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (createScopeOptions.name() != null) { + contentJson.addProperty("name", createScopeOptions.name()); + } + if (createScopeOptions.description() != null) { + contentJson.addProperty("description", createScopeOptions.description()); + } + if (createScopeOptions.environment() != null) { + contentJson.addProperty("environment", createScopeOptions.environment()); + } + if (createScopeOptions.xProperties() != null) { + contentJson.add("properties", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createScopeOptions.xProperties())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get all scopes. + * + * Get all scopes. + * + * @param listScopesOptions the {@link ListScopesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ScopeCollection} + */ + public ServiceCall listScopes(ListScopesOptions listScopesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listScopesOptions, + "listScopesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listScopesOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listScopes"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listScopesOptions.limit() != null) { + builder.query("limit", String.valueOf(listScopesOptions.limit())); + } + if (listScopesOptions.start() != null) { + builder.query("start", String.valueOf(listScopesOptions.start())); + } + if (listScopesOptions.name() != null) { + builder.query("name", String.valueOf(listScopesOptions.name())); + } + if (listScopesOptions.description() != null) { + builder.query("description", String.valueOf(listScopesOptions.description())); + } + if (listScopesOptions.environment() != null) { + builder.query("environment", String.valueOf(listScopesOptions.environment())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a scope. + * + * Update the details of a scope. + * + * @param updateScopeOptions the {@link UpdateScopeOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Scope} + */ + public ServiceCall updateScope(UpdateScopeOptions updateScopeOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateScopeOptions, + "updateScopeOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", updateScopeOptions.instanceId()); + pathParamsMap.put("scope_id", updateScopeOptions.scopeId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes/{scope_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "updateScope"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (updateScopeOptions.name() != null) { + contentJson.addProperty("name", updateScopeOptions.name()); + } + if (updateScopeOptions.description() != null) { + contentJson.addProperty("description", updateScopeOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get a scope. + * + * Get a scope by specifying the scope ID. + * + * @param getScopeOptions the {@link GetScopeOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Scope} + */ + public ServiceCall getScope(GetScopeOptions getScopeOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getScopeOptions, + "getScopeOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getScopeOptions.instanceId()); + pathParamsMap.put("scope_id", getScopeOptions.scopeId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes/{scope_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getScope"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a scope. + * + * Delete a scope by specifying the scope ID. + * + * @param deleteScopeOptions the {@link DeleteScopeOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result + */ + public ServiceCall deleteScope(DeleteScopeOptions deleteScopeOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteScopeOptions, + "deleteScopeOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", deleteScopeOptions.instanceId()); + pathParamsMap.put("scope_id", deleteScopeOptions.scopeId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes/{scope_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteScope"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } - builder.header("Accept", "application/json"); - if (getProfileOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getProfileOptions.xCorrelationId()); - } - if (getProfileOptions.xRequestId() != null) { - builder.header("X-Request-ID", getProfileOptions.xRequestId()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } /** - * Update a profile. + * Create a subscope. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + * Create a subscope. * - * @param replaceProfileOptions the {@link ReplaceProfileOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Profile} + * @param createSubscopeOptions the {@link CreateSubscopeOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link SubScopeResponse} */ - public ServiceCall replaceProfile(ReplaceProfileOptions replaceProfileOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceProfileOptions, - "replaceProfileOptions cannot be null"); + public ServiceCall createSubscope(CreateSubscopeOptions createSubscopeOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createSubscopeOptions, + "createSubscopeOptions cannot be null"); Map pathParamsMap = new HashMap(); - 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"); + pathParamsMap.put("instance_id", createSubscopeOptions.instanceId()); + pathParamsMap.put("scope_id", createSubscopeOptions.scopeId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes/{scope_id}/subscopes", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createSubscope"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (replaceProfileOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", replaceProfileOptions.xCorrelationId()); - } - if (replaceProfileOptions.xRequestId() != null) { - builder.header("X-Request-ID", replaceProfileOptions.xRequestId()); - } final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("profile_name", replaceProfileOptions.profileName()); - contentJson.addProperty("profile_description", replaceProfileOptions.profileDescription()); - contentJson.addProperty("profile_type", replaceProfileOptions.profileType()); - contentJson.add("controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileOptions.controls())); - contentJson.add("default_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileOptions.defaultParameters())); + contentJson.add("subscopes", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createSubscopeOptions.subscopes())); builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List all rules. + * Get all subscopes. * - * Retrieve all the rules that you use to target the exact configuration properties that you need to ensure are - * compliant. For more information, see [Defining custom - * rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). + * Get all subscopes. * - * @param listRulesOptions the {@link ListRulesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link RulesPageBase} + * @param listSubscopesOptions the {@link ListSubscopesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link SubScopeCollection} */ - public ServiceCall listRules(ListRulesOptions listRulesOptions) { - if (listRulesOptions == null) { - listRulesOptions = new ListRulesOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/rules")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listRules"); + public ServiceCall listSubscopes(ListSubscopesOptions listSubscopesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listSubscopesOptions, + "listSubscopesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listSubscopesOptions.instanceId()); + pathParamsMap.put("scope_id", listSubscopesOptions.scopeId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes/{scope_id}/subscopes", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listSubscopes"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listRulesOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listRulesOptions.xCorrelationId()); + if (listSubscopesOptions.limit() != null) { + builder.query("limit", String.valueOf(listSubscopesOptions.limit())); } - if (listRulesOptions.xRequestId() != null) { - builder.header("X-Request-ID", listRulesOptions.xRequestId()); + if (listSubscopesOptions.start() != null) { + builder.query("start", String.valueOf(listSubscopesOptions.start())); } - if (listRulesOptions.type() != null) { - builder.query("type", String.valueOf(listRulesOptions.type())); + if (listSubscopesOptions.name() != null) { + builder.query("name", String.valueOf(listSubscopesOptions.name())); } - if (listRulesOptions.search() != null) { - builder.query("search", String.valueOf(listRulesOptions.search())); + if (listSubscopesOptions.description() != null) { + builder.query("description", String.valueOf(listSubscopesOptions.description())); } - if (listRulesOptions.serviceName() != null) { - builder.query("service_name", String.valueOf(listRulesOptions.serviceName())); + if (listSubscopesOptions.environment() != null) { + builder.query("environment", String.valueOf(listSubscopesOptions.environment())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List all rules. + * Get a subscope. * - * Retrieve all the rules that you use to target the exact configuration properties that you need to ensure are - * compliant. For more information, see [Defining custom - * rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). + * Get the subscope details. * - * @return a {@link ServiceCall} with a result of type {@link RulesPageBase} + * @param getSubscopeOptions the {@link GetSubscopeOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link SubScope} */ - public ServiceCall listRules() { - return listRules(null); + public ServiceCall getSubscope(GetSubscopeOptions getSubscopeOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getSubscopeOptions, + "getSubscopeOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getSubscopeOptions.instanceId()); + pathParamsMap.put("scope_id", getSubscopeOptions.scopeId()); + pathParamsMap.put("subscope_id", getSubscopeOptions.subscopeId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes/{scope_id}/subscopes/{subscope_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getSubscope"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); } /** - * Create a custom rule. + * Update a subscope. * - * Create a custom rule to to target the exact configuration properties that you need to evaluate your resources for - * compliance. For more information, see [Defining custom - * rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). + * Update the subscope details. * - * @param createRuleOptions the {@link CreateRuleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Rule} + * @param updateSubscopeOptions the {@link UpdateSubscopeOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link SubScope} */ - public ServiceCall createRule(CreateRuleOptions createRuleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createRuleOptions, - "createRuleOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/rules")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createRule"); + public ServiceCall updateSubscope(UpdateSubscopeOptions updateSubscopeOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateSubscopeOptions, + "updateSubscopeOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", updateSubscopeOptions.instanceId()); + pathParamsMap.put("scope_id", updateSubscopeOptions.scopeId()); + pathParamsMap.put("subscope_id", updateSubscopeOptions.subscopeId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes/{scope_id}/subscopes/{subscope_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "updateSubscope"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (createRuleOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", createRuleOptions.xCorrelationId()); - } - if (createRuleOptions.xRequestId() != null) { - 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.version() != null) { - contentJson.addProperty("version", createRuleOptions.version()); - } - if (createRuleOptions.xImport() != null) { - contentJson.add("import", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRuleOptions.xImport())); + if (updateSubscopeOptions.name() != null) { + contentJson.addProperty("name", updateSubscopeOptions.name()); } - if (createRuleOptions.labels() != null) { - contentJson.add("labels", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRuleOptions.labels())); + if (updateSubscopeOptions.description() != null) { + contentJson.addProperty("description", updateSubscopeOptions.description()); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete a custom rule. + * Delete a subscope. * - * Delete a custom rule that you no longer require to evaluate your resources. For more information, see [Defining - * custom rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). + * Delete the subscope by specifying the subscope ID. * - * @param deleteRuleOptions the {@link DeleteRuleOptions} containing the options for the call + * @param deleteSubscopeOptions the {@link DeleteSubscopeOptions} containing the options for the call * @return a {@link ServiceCall} with a void result */ - public ServiceCall deleteRule(DeleteRuleOptions deleteRuleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRuleOptions, - "deleteRuleOptions cannot be null"); + public ServiceCall deleteSubscope(DeleteSubscopeOptions deleteSubscopeOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteSubscopeOptions, + "deleteSubscopeOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("rule_id", deleteRuleOptions.ruleId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/rules/{rule_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteRule"); + pathParamsMap.put("instance_id", deleteSubscopeOptions.instanceId()); + pathParamsMap.put("scope_id", deleteSubscopeOptions.scopeId()); + pathParamsMap.put("subscope_id", deleteSubscopeOptions.subscopeId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/scopes/{scope_id}/subscopes/{subscope_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteSubscope"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } - if (deleteRuleOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", deleteRuleOptions.xCorrelationId()); - } - if (deleteRuleOptions.xRequestId() != null) { - builder.header("X-Request-ID", deleteRuleOptions.xRequestId()); - } ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } /** - * Get a custom rule. + * Create a target. * - * Retrieve a rule that you created to evaluate your resources. For more information, see [Defining custom - * rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). + * Creates a target to scan against. * - * @param getRuleOptions the {@link GetRuleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Rule} + * @param createTargetOptions the {@link CreateTargetOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Target} */ - public ServiceCall getRule(GetRuleOptions getRuleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getRuleOptions, - "getRuleOptions cannot be null"); + public ServiceCall createTarget(CreateTargetOptions createTargetOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createTargetOptions, + "createTargetOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("rule_id", getRuleOptions.ruleId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/rules/{rule_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getRule"); + pathParamsMap.put("instance_id", createTargetOptions.instanceId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/targets", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createTarget"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getRuleOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getRuleOptions.xCorrelationId()); - } - if (getRuleOptions.xRequestId() != null) { - builder.header("X-Request-ID", getRuleOptions.xRequestId()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("account_id", createTargetOptions.accountId()); + contentJson.addProperty("trusted_profile_id", createTargetOptions.trustedProfileId()); + contentJson.addProperty("name", createTargetOptions.name()); + if (createTargetOptions.credentials() != null) { + contentJson.add("credentials", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createTargetOptions.credentials())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Update a custom rule. + * Get a list of targets with pagination. * - * Update a custom rule that you use to target the exact configuration properties that you need to evaluate your - * resources for compliance. For more information, see [Defining custom - * rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). + * Returns a list of targets. * - * @param replaceRuleOptions the {@link ReplaceRuleOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Rule} + * @param listTargetsOptions the {@link ListTargetsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link TargetCollection} */ - public ServiceCall replaceRule(ReplaceRuleOptions replaceRuleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRuleOptions, - "replaceRuleOptions cannot be null"); + public ServiceCall listTargets(ListTargetsOptions listTargetsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listTargetsOptions, + "listTargetsOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("rule_id", replaceRuleOptions.ruleId()); - RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/rules/{rule_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "replaceRule"); + pathParamsMap.put("instance_id", listTargetsOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/targets", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listTargets"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - builder.header("If-Match", replaceRuleOptions.ifMatch()); - if (replaceRuleOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", replaceRuleOptions.xCorrelationId()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get a target by ID. + * + * Retrieves a target by its ID association. + * + * @param getTargetOptions the {@link GetTargetOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Target} + */ + public ServiceCall getTarget(GetTargetOptions getTargetOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getTargetOptions, + "getTargetOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getTargetOptions.instanceId()); + pathParamsMap.put("target_id", getTargetOptions.targetId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/targets/{target_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getTarget"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); } - if (replaceRuleOptions.xRequestId() != null) { - builder.header("X-Request-ID", replaceRuleOptions.xRequestId()); + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * replace a target by ID. + * + * Updates a target by its ID. + * + * @param replaceTargetOptions the {@link ReplaceTargetOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Target} + */ + public ServiceCall replaceTarget(ReplaceTargetOptions replaceTargetOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceTargetOptions, + "replaceTargetOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", replaceTargetOptions.instanceId()); + pathParamsMap.put("target_id", replaceTargetOptions.targetId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/targets/{target_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "replaceTarget"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); } + builder.header("Accept", "application/json"); 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.version() != null) { - contentJson.addProperty("version", replaceRuleOptions.version()); - } - if (replaceRuleOptions.xImport() != null) { - contentJson.add("import", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRuleOptions.xImport())); - } - if (replaceRuleOptions.labels() != null) { - contentJson.add("labels", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRuleOptions.labels())); + contentJson.addProperty("account_id", replaceTargetOptions.accountId()); + contentJson.addProperty("trusted_profile_id", replaceTargetOptions.trustedProfileId()); + contentJson.addProperty("name", replaceTargetOptions.name()); + if (replaceTargetOptions.credentials() != null) { + contentJson.add("credentials", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceTargetOptions.credentials())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List attachments to a profile. + * Delete a target by ID. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Deletes a target by the ID. * - * @param listAttachmentsOptions the {@link ListAttachmentsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AttachmentCollection} + * @param deleteTargetOptions the {@link DeleteTargetOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result */ - public ServiceCall listAttachments(ListAttachmentsOptions listAttachmentsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listAttachmentsOptions, - "listAttachmentsOptions cannot be null"); + public ServiceCall deleteTarget(DeleteTargetOptions deleteTargetOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteTargetOptions, + "deleteTargetOptions cannot be null"); Map pathParamsMap = new HashMap(); - 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"); + pathParamsMap.put("instance_id", deleteTargetOptions.instanceId()); + pathParamsMap.put("target_id", deleteTargetOptions.targetId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/targets/{target_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteTarget"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } - builder.header("Accept", "application/json"); - if (listAttachmentsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listAttachmentsOptions.xCorrelationId()); - } - if (listAttachmentsOptions.xRequestId() != null) { - builder.header("X-Request-ID", listAttachmentsOptions.xRequestId()); - } - if (listAttachmentsOptions.limit() != null) { - builder.query("limit", String.valueOf(listAttachmentsOptions.limit())); - } - if (listAttachmentsOptions.start() != null) { - builder.query("start", String.valueOf(listAttachmentsOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } /** - * Create an attachment. + * Create a provider type instance. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Create an instance 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 createAttachmentOptions the {@link CreateAttachmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AttachmentPrototype} + * @param createProviderTypeInstanceOptions the {@link CreateProviderTypeInstanceOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstance} */ - public ServiceCall createAttachment(CreateAttachmentOptions createAttachmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createAttachmentOptions, - "createAttachmentOptions cannot be null"); + public ServiceCall createProviderTypeInstance(CreateProviderTypeInstanceOptions createProviderTypeInstanceOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createProviderTypeInstanceOptions, + "createProviderTypeInstanceOptions cannot be null"); Map pathParamsMap = new HashMap(); - 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"); + pathParamsMap.put("instance_id", createProviderTypeInstanceOptions.instanceId()); + pathParamsMap.put("provider_type_id", createProviderTypeInstanceOptions.providerTypeId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createProviderTypeInstance"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (createAttachmentOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", createAttachmentOptions.xCorrelationId()); - } - if (createAttachmentOptions.xRequestId() != null) { - builder.header("X-Request-ID", createAttachmentOptions.xRequestId()); - } final JsonObject contentJson = new JsonObject(); - contentJson.add("attachments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createAttachmentOptions.attachments())); - if (createAttachmentOptions.profileId() != null) { - contentJson.addProperty("profile_id", createAttachmentOptions.profileId()); + 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())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete an attachment. + * List instances of a specific provider type. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * 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 deleteProfileAttachmentOptions the {@link DeleteProfileAttachmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AttachmentItem} + * @param listProviderTypeInstancesOptions the {@link ListProviderTypeInstancesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstanceCollection} */ - public ServiceCall deleteProfileAttachment(DeleteProfileAttachmentOptions deleteProfileAttachmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteProfileAttachmentOptions, - "deleteProfileAttachmentOptions cannot be null"); + public ServiceCall listProviderTypeInstances(ListProviderTypeInstancesOptions listProviderTypeInstancesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listProviderTypeInstancesOptions, + "listProviderTypeInstancesOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("attachment_id", deleteProfileAttachmentOptions.attachmentId()); - 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"); + pathParamsMap.put("instance_id", listProviderTypeInstancesOptions.instanceId()); + pathParamsMap.put("provider_type_id", listProviderTypeInstancesOptions.providerTypeId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listProviderTypeInstances"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (deleteProfileAttachmentOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", deleteProfileAttachmentOptions.xCorrelationId()); - } - if (deleteProfileAttachmentOptions.xRequestId() != null) { - builder.header("X-Request-ID", deleteProfileAttachmentOptions.xRequestId()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Get an attachment. + * Get a provider type instance. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). * - * @param getProfileAttachmentOptions the {@link GetProfileAttachmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AttachmentItem} + * @param getProviderTypeInstanceOptions the {@link GetProviderTypeInstanceOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstance} */ - public ServiceCall getProfileAttachment(GetProfileAttachmentOptions getProfileAttachmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getProfileAttachmentOptions, - "getProfileAttachmentOptions cannot be null"); + public ServiceCall getProviderTypeInstance(GetProviderTypeInstanceOptions getProviderTypeInstanceOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getProviderTypeInstanceOptions, + "getProviderTypeInstanceOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("attachment_id", getProfileAttachmentOptions.attachmentId()); - 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"); + pathParamsMap.put("instance_id", getProviderTypeInstanceOptions.instanceId()); + pathParamsMap.put("provider_type_id", getProviderTypeInstanceOptions.providerTypeId()); + pathParamsMap.put("provider_type_instance_id", getProviderTypeInstanceOptions.providerTypeInstanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getProviderTypeInstance"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getProfileAttachmentOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getProfileAttachmentOptions.xCorrelationId()); - } - if (getProfileAttachmentOptions.xRequestId() != null) { - builder.header("X-Request-ID", getProfileAttachmentOptions.xRequestId()); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Update an attachment. + * Update a provider type instance. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * 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 replaceProfileAttachmentOptions the {@link ReplaceProfileAttachmentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AttachmentItem} + * @param updateProviderTypeInstanceOptions the {@link UpdateProviderTypeInstanceOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstance} */ - public ServiceCall replaceProfileAttachment(ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(replaceProfileAttachmentOptions, - "replaceProfileAttachmentOptions cannot be null"); + public ServiceCall updateProviderTypeInstance(UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateProviderTypeInstanceOptions, + "updateProviderTypeInstanceOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("attachment_id", replaceProfileAttachmentOptions.attachmentId()); - 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"); + pathParamsMap.put("instance_id", updateProviderTypeInstanceOptions.instanceId()); + pathParamsMap.put("provider_type_id", updateProviderTypeInstanceOptions.providerTypeId()); + pathParamsMap.put("provider_type_instance_id", updateProviderTypeInstanceOptions.providerTypeInstanceId()); + RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "updateProviderTypeInstance"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (replaceProfileAttachmentOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", replaceProfileAttachmentOptions.xCorrelationId()); - } - if (replaceProfileAttachmentOptions.xRequestId() != null) { - builder.header("X-Request-ID", replaceProfileAttachmentOptions.xRequestId()); - } final JsonObject contentJson = new JsonObject(); - if (replaceProfileAttachmentOptions.id() != null) { - contentJson.addProperty("id", replaceProfileAttachmentOptions.id()); - } - if (replaceProfileAttachmentOptions.profileId() != null) { - contentJson.addProperty("profile_id", replaceProfileAttachmentOptions.profileId()); - } - if (replaceProfileAttachmentOptions.accountId() != null) { - contentJson.addProperty("account_id", replaceProfileAttachmentOptions.accountId()); - } - if (replaceProfileAttachmentOptions.instanceId() != null) { - contentJson.addProperty("instance_id", replaceProfileAttachmentOptions.instanceId()); - } - if (replaceProfileAttachmentOptions.scope() != null) { - contentJson.add("scope", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.scope())); - } - if (replaceProfileAttachmentOptions.createdOn() != null) { - contentJson.add("created_on", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.createdOn())); - } - if (replaceProfileAttachmentOptions.createdBy() != null) { - contentJson.addProperty("created_by", replaceProfileAttachmentOptions.createdBy()); - } - if (replaceProfileAttachmentOptions.updatedOn() != null) { - contentJson.add("updated_on", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.updatedOn())); - } - if (replaceProfileAttachmentOptions.updatedBy() != null) { - contentJson.addProperty("updated_by", replaceProfileAttachmentOptions.updatedBy()); - } - if (replaceProfileAttachmentOptions.status() != null) { - contentJson.addProperty("status", replaceProfileAttachmentOptions.status()); - } - if (replaceProfileAttachmentOptions.schedule() != null) { - contentJson.addProperty("schedule", replaceProfileAttachmentOptions.schedule()); + if (updateProviderTypeInstanceOptions.name() != null) { + contentJson.addProperty("name", updateProviderTypeInstanceOptions.name()); } - if (replaceProfileAttachmentOptions.notifications() != null) { - contentJson.add("notifications", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.notifications())); - } - if (replaceProfileAttachmentOptions.attachmentParameters() != null) { - contentJson.add("attachment_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.attachmentParameters())); - } - if (replaceProfileAttachmentOptions.lastScan() != null) { - contentJson.add("last_scan", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.lastScan())); - } - if (replaceProfileAttachmentOptions.nextScanTime() != null) { - contentJson.add("next_scan_time", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceProfileAttachmentOptions.nextScanTime())); - } - if (replaceProfileAttachmentOptions.name() != null) { - contentJson.addProperty("name", replaceProfileAttachmentOptions.name()); - } - if (replaceProfileAttachmentOptions.description() != null) { - contentJson.addProperty("description", replaceProfileAttachmentOptions.description()); + if (updateProviderTypeInstanceOptions.attributes() != null) { + contentJson.add("attributes", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProviderTypeInstanceOptions.attributes())); } builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Create a scan. + * Delete a provider type instance. * - * Create a scan to evaluate your resources on a recurring basis or on demand. + * 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 createScanOptions the {@link CreateScanOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Scan} + * @param deleteProviderTypeInstanceOptions the {@link DeleteProviderTypeInstanceOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result */ - public ServiceCall createScan(CreateScanOptions createScanOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createScanOptions, - "createScanOptions cannot be null"); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/scans")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createScan"); + public ServiceCall deleteProviderTypeInstance(DeleteProviderTypeInstanceOptions deleteProviderTypeInstanceOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteProviderTypeInstanceOptions, + "deleteProviderTypeInstanceOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", deleteProviderTypeInstanceOptions.instanceId()); + pathParamsMap.put("provider_type_id", deleteProviderTypeInstanceOptions.providerTypeId()); + pathParamsMap.put("provider_type_instance_id", deleteProviderTypeInstanceOptions.providerTypeInstanceId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteProviderTypeInstance"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } - builder.header("Accept", "application/json"); - if (createScanOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", createScanOptions.xCorrelationId()); - } - if (createScanOptions.xRequestId() != null) { - builder.header("X-Request-ID", createScanOptions.xRequestId()); - } - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("attachment_id", createScanOptions.attachmentId()); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } /** - * List attachments. + * List provider types. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * List all the registered provider types or integrations such as Workload Protection available to connect to Security + * and Compliance Center. For more information about connecting Workload Protection with the Security and Compliance + * Center, see [Connecting Workload + * Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). * - * @param listAttachmentsAccountOptions the {@link ListAttachmentsAccountOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link AttachmentCollection} + * @param listProviderTypesOptions the {@link ListProviderTypesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProviderTypeCollection} */ - public ServiceCall listAttachmentsAccount(ListAttachmentsAccountOptions listAttachmentsAccountOptions) { - if (listAttachmentsAccountOptions == null) { - listAttachmentsAccountOptions = new ListAttachmentsAccountOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/attachments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listAttachmentsAccount"); + public ServiceCall listProviderTypes(ListProviderTypesOptions listProviderTypesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listProviderTypesOptions, + "listProviderTypesOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listProviderTypesOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/provider_types", pathParamsMap)); + 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 (listAttachmentsAccountOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listAttachmentsAccountOptions.xCorrelationId()); - } - if (listAttachmentsAccountOptions.xRequestId() != null) { - builder.header("X-Request-ID", listAttachmentsAccountOptions.xRequestId()); - } - if (listAttachmentsAccountOptions.limit() != null) { - builder.query("limit", String.valueOf(listAttachmentsAccountOptions.limit())); - } - if (listAttachmentsAccountOptions.start() != null) { - builder.query("start", String.valueOf(listAttachmentsAccountOptions.start())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List attachments. + * Get a provider type. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + * Retrieve a provider type by specifying its ID. 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 AttachmentCollection} + * @param getProviderTypeByIdOptions the {@link GetProviderTypeByIdOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ProviderType} */ - public ServiceCall listAttachmentsAccount() { - return listAttachmentsAccount(null); + public ServiceCall getProviderTypeById(GetProviderTypeByIdOptions getProviderTypeByIdOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getProviderTypeByIdOptions, + "getProviderTypeByIdOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getProviderTypeByIdOptions.instanceId()); + pathParamsMap.put("provider_type_id", getProviderTypeByIdOptions.providerTypeId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/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"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); } /** @@ -1318,21 +1795,16 @@ public ServiceCall listAttachmentsAccount() { * @return a {@link ServiceCall} with a result of type {@link ReportLatest} */ public ServiceCall getLatestReports(GetLatestReportsOptions getLatestReportsOptions) { - if (getLatestReportsOptions == null) { - getLatestReportsOptions = new GetLatestReportsOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/latest")); + com.ibm.cloud.sdk.core.util.Validator.notNull(getLatestReportsOptions, + "getLatestReportsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getLatestReportsOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/latest", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getLatestReports"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getLatestReportsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getLatestReportsOptions.xCorrelationId()); - } - if (getLatestReportsOptions.xRequestId() != null) { - builder.header("X-Request-ID", getLatestReportsOptions.xRequestId()); - } if (getLatestReportsOptions.sort() != null) { builder.query("sort", String.valueOf(getLatestReportsOptions.sort())); } @@ -1341,18 +1813,6 @@ public ServiceCall getLatestReports(GetLatestReportsOptions getLat return createServiceCall(builder.build(), responseConverter); } - /** - * 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). - * - * @return a {@link ServiceCall} with a result of type {@link ReportLatest} - */ - public ServiceCall getLatestReports() { - return getLatestReports(null); - } - /** * List reports. * @@ -1360,32 +1820,27 @@ public ServiceCall getLatestReports() { * results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). * * @param listReportsOptions the {@link ListReportsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ReportPage} + * @return a {@link ServiceCall} with a result of type {@link ReportCollection} */ - public ServiceCall listReports(ListReportsOptions listReportsOptions) { - if (listReportsOptions == null) { - listReportsOptions = new ListReportsOptions.Builder().build(); - } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports")); + public ServiceCall listReports(ListReportsOptions listReportsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listReportsOptions, + "listReportsOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listReportsOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listReports"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listReportsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listReportsOptions.xCorrelationId()); - } - if (listReportsOptions.xRequestId() != null) { - builder.header("X-Request-ID", listReportsOptions.xRequestId()); - } - if (listReportsOptions.attachmentId() != null) { - builder.query("attachment_id", String.valueOf(listReportsOptions.attachmentId())); + if (listReportsOptions.reportAttachmentId() != null) { + builder.query("report_attachment_id", String.valueOf(listReportsOptions.reportAttachmentId())); } if (listReportsOptions.groupId() != null) { builder.query("group_id", String.valueOf(listReportsOptions.groupId())); } - if (listReportsOptions.profileId() != null) { - builder.query("profile_id", String.valueOf(listReportsOptions.profileId())); + if (listReportsOptions.reportProfileId() != null) { + builder.query("report_profile_id", String.valueOf(listReportsOptions.reportProfileId())); } if (listReportsOptions.type() != null) { builder.query("type", String.valueOf(listReportsOptions.type())); @@ -1399,27 +1854,16 @@ public ServiceCall listReports(ListReportsOptions listReportsOptions if (listReportsOptions.sort() != null) { builder.query("sort", String.valueOf(listReportsOptions.sort())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } - /** - * List reports. - * - * Retrieve a page of reports that are filtered by the specified parameters. For more information, see [Viewing - * results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). - * - * @return a {@link ServiceCall} with a result of type {@link ReportPage} - */ - public ServiceCall listReports() { - return listReports(null); - } - /** * Get a report. * - * Retrieve a report by specifying its ID. For more information, see [Viewing + * Retrieve a specified report and filter the report details by the specified scope ID and/or subscope ID. For more + * information, see [Viewing * results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). * * @param getReportOptions the {@link GetReportOptions} containing the options for the call @@ -1430,17 +1874,18 @@ public ServiceCall getReport(GetReportOptions getReportOptions) { "getReportOptions cannot be null"); Map pathParamsMap = new HashMap(); pathParamsMap.put("report_id", getReportOptions.reportId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/{report_id}", pathParamsMap)); + pathParamsMap.put("instance_id", getReportOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getReport"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getReportOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getReportOptions.xCorrelationId()); + if (getReportOptions.scopeId() != null) { + builder.query("scope_id", String.valueOf(getReportOptions.scopeId())); } - if (getReportOptions.xRequestId() != null) { - builder.header("X-Request-ID", getReportOptions.xRequestId()); + if (getReportOptions.subscopeId() != null) { + builder.query("subscope_id", String.valueOf(getReportOptions.subscopeId())); } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -1460,19 +1905,14 @@ public ServiceCall getReportSummary(GetReportSummaryOptions getRe com.ibm.cloud.sdk.core.util.Validator.notNull(getReportSummaryOptions, "getReportSummaryOptions cannot be null"); Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getReportSummaryOptions.instanceId()); pathParamsMap.put("report_id", getReportSummaryOptions.reportId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/{report_id}/summary", pathParamsMap)); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/summary", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getReportSummary"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getReportSummaryOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getReportSummaryOptions.xCorrelationId()); - } - if (getReportSummaryOptions.xRequestId() != null) { - builder.header("X-Request-ID", getReportSummaryOptions.xRequestId()); - } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); @@ -1481,31 +1921,28 @@ public ServiceCall getReportSummary(GetReportSummaryOptions getRe /** * Get report evaluation details. * - * Retrieve the evaluation details of a report by specifying the report ID. For more information, see [Viewing + * Download a .csv file to inspect the evaluation details of a specified report. For more information, see [Viewing * results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). * - * @param getReportEvaluationOptions the {@link GetReportEvaluationOptions} containing the options for the call + * @param getReportDownloadFileOptions the {@link GetReportDownloadFileOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link InputStream} */ - public ServiceCall getReportEvaluation(GetReportEvaluationOptions getReportEvaluationOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getReportEvaluationOptions, - "getReportEvaluationOptions cannot be null"); + public ServiceCall getReportDownloadFile(GetReportDownloadFileOptions getReportDownloadFileOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getReportDownloadFileOptions, + "getReportDownloadFileOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("report_id", getReportEvaluationOptions.reportId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/{report_id}/download", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getReportEvaluation"); + pathParamsMap.put("instance_id", getReportDownloadFileOptions.instanceId()); + pathParamsMap.put("report_id", getReportDownloadFileOptions.reportId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/download", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getReportDownloadFile"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } - builder.header("Accept", "application/csv"); - if (getReportEvaluationOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getReportEvaluationOptions.xCorrelationId()); - } - if (getReportEvaluationOptions.xRequestId() != null) { - builder.header("X-Request-ID", getReportEvaluationOptions.xRequestId()); + if (getReportDownloadFileOptions.accept() != null) { + builder.header("Accept", getReportDownloadFileOptions.accept()); } - if (getReportEvaluationOptions.excludeSummary() != null) { - builder.query("exclude_summary", String.valueOf(getReportEvaluationOptions.excludeSummary())); + if (getReportDownloadFileOptions.excludeSummary() != null) { + builder.query("exclude_summary", String.valueOf(getReportDownloadFileOptions.excludeSummary())); } ResponseConverter responseConverter = ResponseConverterUtils.getInputStream(); return createServiceCall(builder.build(), responseConverter); @@ -1524,19 +1961,14 @@ public ServiceCall getReportControls(GetReportControlsOptions ge com.ibm.cloud.sdk.core.util.Validator.notNull(getReportControlsOptions, "getReportControlsOptions cannot be null"); Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getReportControlsOptions.instanceId()); pathParamsMap.put("report_id", getReportControlsOptions.reportId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/{report_id}/controls", pathParamsMap)); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/controls", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getReportControls"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getReportControlsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getReportControlsOptions.xCorrelationId()); - } - if (getReportControlsOptions.xRequestId() != null) { - builder.header("X-Request-ID", getReportControlsOptions.xRequestId()); - } if (getReportControlsOptions.controlId() != null) { builder.query("control_id", String.valueOf(getReportControlsOptions.controlId())); } @@ -1555,6 +1987,12 @@ public ServiceCall getReportControls(GetReportControlsOptions ge if (getReportControlsOptions.sort() != null) { builder.query("sort", String.valueOf(getReportControlsOptions.sort())); } + if (getReportControlsOptions.scopeId() != null) { + builder.query("scope_id", String.valueOf(getReportControlsOptions.scopeId())); + } + if (getReportControlsOptions.subscopeId() != null) { + builder.query("subscope_id", String.valueOf(getReportControlsOptions.subscopeId())); + } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); @@ -1573,20 +2011,15 @@ public ServiceCall getReportRule(GetReportRuleOptions getReportRuleOpt com.ibm.cloud.sdk.core.util.Validator.notNull(getReportRuleOptions, "getReportRuleOptions cannot be null"); Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getReportRuleOptions.instanceId()); pathParamsMap.put("report_id", getReportRuleOptions.reportId()); pathParamsMap.put("rule_id", getReportRuleOptions.ruleId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/{report_id}/rules/{rule_id}", pathParamsMap)); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/rules/{rule_id}", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getReportRule"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getReportRuleOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getReportRuleOptions.xCorrelationId()); - } - if (getReportRuleOptions.xRequestId() != null) { - builder.header("X-Request-ID", getReportRuleOptions.xRequestId()); - } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); @@ -1605,19 +2038,14 @@ public ServiceCall listReportEvaluations(ListReportEvaluationsOp com.ibm.cloud.sdk.core.util.Validator.notNull(listReportEvaluationsOptions, "listReportEvaluationsOptions cannot be null"); Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listReportEvaluationsOptions.instanceId()); pathParamsMap.put("report_id", listReportEvaluationsOptions.reportId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/{report_id}/evaluations", pathParamsMap)); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/evaluations", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listReportEvaluations"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listReportEvaluationsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listReportEvaluationsOptions.xCorrelationId()); - } - if (listReportEvaluationsOptions.xRequestId() != null) { - builder.header("X-Request-ID", listReportEvaluationsOptions.xRequestId()); - } if (listReportEvaluationsOptions.assessmentId() != null) { builder.query("assessment_id", String.valueOf(listReportEvaluationsOptions.assessmentId())); } @@ -1645,6 +2073,15 @@ public ServiceCall listReportEvaluations(ListReportEvaluationsOp if (listReportEvaluationsOptions.limit() != null) { builder.query("limit", String.valueOf(listReportEvaluationsOptions.limit())); } + if (listReportEvaluationsOptions.sort() != null) { + builder.query("sort", String.valueOf(listReportEvaluationsOptions.sort())); + } + if (listReportEvaluationsOptions.scopeId() != null) { + builder.query("scope_id", String.valueOf(listReportEvaluationsOptions.scopeId())); + } + if (listReportEvaluationsOptions.subscopeId() != null) { + builder.query("subscope_id", String.valueOf(listReportEvaluationsOptions.subscopeId())); + } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); @@ -1663,19 +2100,14 @@ public ServiceCall listReportResources(ListReportResourcesOptions com.ibm.cloud.sdk.core.util.Validator.notNull(listReportResourcesOptions, "listReportResourcesOptions cannot be null"); Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", listReportResourcesOptions.instanceId()); pathParamsMap.put("report_id", listReportResourcesOptions.reportId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/{report_id}/resources", pathParamsMap)); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/resources", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listReportResources"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listReportResourcesOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listReportResourcesOptions.xCorrelationId()); - } - if (listReportResourcesOptions.xRequestId() != null) { - builder.header("X-Request-ID", listReportResourcesOptions.xRequestId()); - } if (listReportResourcesOptions.id() != null) { builder.query("id", String.valueOf(listReportResourcesOptions.id())); } @@ -1700,6 +2132,12 @@ public ServiceCall listReportResources(ListReportResourcesOptions if (listReportResourcesOptions.limit() != null) { builder.query("limit", String.valueOf(listReportResourcesOptions.limit())); } + if (listReportResourcesOptions.scopeId() != null) { + builder.query("scope_id", String.valueOf(listReportResourcesOptions.scopeId())); + } + if (listReportResourcesOptions.subscopeId() != null) { + builder.query("subscope_id", String.valueOf(listReportResourcesOptions.subscopeId())); + } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); @@ -1718,19 +2156,14 @@ public ServiceCall getReportTags(GetReportTagsOptions getReportTagsO com.ibm.cloud.sdk.core.util.Validator.notNull(getReportTagsOptions, "getReportTagsOptions cannot be null"); Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getReportTagsOptions.instanceId()); pathParamsMap.put("report_id", getReportTagsOptions.reportId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/{report_id}/tags", pathParamsMap)); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/tags", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getReportTags"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getReportTagsOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getReportTagsOptions.xCorrelationId()); - } - if (getReportTagsOptions.xRequestId() != null) { - builder.header("X-Request-ID", getReportTagsOptions.xRequestId()); - } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); @@ -1749,303 +2182,384 @@ public ServiceCall getReportViolationsDrift(GetReportViol com.ibm.cloud.sdk.core.util.Validator.notNull(getReportViolationsDriftOptions, "getReportViolationsDriftOptions cannot be null"); Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getReportViolationsDriftOptions.instanceId()); pathParamsMap.put("report_id", getReportViolationsDriftOptions.reportId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/reports/{report_id}/violations_drift", pathParamsMap)); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/violations_drift", pathParamsMap)); Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getReportViolationsDrift"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getReportViolationsDriftOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getReportViolationsDriftOptions.xCorrelationId()); - } - if (getReportViolationsDriftOptions.xRequestId() != null) { - builder.header("X-Request-ID", getReportViolationsDriftOptions.xRequestId()); - } if (getReportViolationsDriftOptions.scanTimeDuration() != null) { builder.query("scan_time_duration", String.valueOf(getReportViolationsDriftOptions.scanTimeDuration())); } + if (getReportViolationsDriftOptions.scopeId() != null) { + builder.query("scope_id", String.valueOf(getReportViolationsDriftOptions.scopeId())); + } + if (getReportViolationsDriftOptions.subscopeId() != null) { + builder.query("subscope_id", String.valueOf(getReportViolationsDriftOptions.subscopeId())); + } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List provider type instances. + * List scan reports. * - * 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). + * Get a list of scan reports and view the status of report generation in progress. For more information, see [Viewing + * results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). * - * @param listProviderTypeInstancesOptions the {@link ListProviderTypeInstancesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstancesResponse} + * @param listScanReportsOptions the {@link ListScanReportsOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ScanReportCollection} */ - public ServiceCall listProviderTypeInstances(ListProviderTypeInstancesOptions listProviderTypeInstancesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(listProviderTypeInstancesOptions, - "listProviderTypeInstancesOptions cannot be null"); + public ServiceCall listScanReports(ListScanReportsOptions listScanReportsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listScanReportsOptions, + "listScanReportsOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("provider_type_id", listProviderTypeInstancesOptions.providerTypeId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types/{provider_type_id}/provider_type_instances", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listProviderTypeInstances"); + pathParamsMap.put("instance_id", listScanReportsOptions.instanceId()); + pathParamsMap.put("report_id", listScanReportsOptions.reportId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/scan_reports", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listScanReports"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (listProviderTypeInstancesOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", listProviderTypeInstancesOptions.xCorrelationId()); + if (listScanReportsOptions.scopeId() != null) { + builder.query("scope_id", String.valueOf(listScanReportsOptions.scopeId())); + } + if (listScanReportsOptions.subscopeId() != null) { + builder.query("subscope_id", String.valueOf(listScanReportsOptions.subscopeId())); } - if (listProviderTypeInstancesOptions.xRequestId() != null) { - builder.header("X-Request-ID", listProviderTypeInstancesOptions.xRequestId()); + if (listScanReportsOptions.sort() != null) { + builder.query("sort", String.valueOf(listScanReportsOptions.sort())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Create a provider type instance. + * Create a scan report. * - * Create an instance 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). + * Create a scan report for a specific scope or sub-scope. For more information, see [Defining custom + * rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). * - * @param createProviderTypeInstanceOptions the {@link CreateProviderTypeInstanceOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstanceItem} + * @param createScanReportOptions the {@link CreateScanReportOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link CreateScanReport} */ - public ServiceCall createProviderTypeInstance(CreateProviderTypeInstanceOptions createProviderTypeInstanceOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(createProviderTypeInstanceOptions, - "createProviderTypeInstanceOptions cannot be null"); + public ServiceCall createScanReport(CreateScanReportOptions createScanReportOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createScanReportOptions, + "createScanReportOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("provider_type_id", createProviderTypeInstanceOptions.providerTypeId()); - RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types/{provider_type_id}/provider_type_instances", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createProviderTypeInstance"); + pathParamsMap.put("instance_id", createScanReportOptions.instanceId()); + pathParamsMap.put("report_id", createScanReportOptions.reportId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/scan_reports", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createScanReport"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (createProviderTypeInstanceOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", createProviderTypeInstanceOptions.xCorrelationId()); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("format", createScanReportOptions.format()); + if (createScanReportOptions.scopeId() != null) { + contentJson.addProperty("scope_id", createScanReportOptions.scopeId()); } - if (createProviderTypeInstanceOptions.xRequestId() != null) { - builder.header("X-Request-ID", createProviderTypeInstanceOptions.xRequestId()); + if (createScanReportOptions.subscopeId() != null) { + contentJson.addProperty("subscope_id", createScanReportOptions.subscopeId()); } - final JsonObject contentJson = new JsonObject(); - 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()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Delete a provider type instance. + * Get a scan report. * - * 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). + * Retrieve the scan report by specifying the ID. For more information, see [Viewing + * results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). * - * @param deleteProviderTypeInstanceOptions the {@link DeleteProviderTypeInstanceOptions} containing the options for the call - * @return a {@link ServiceCall} with a void result + * @param getScanReportOptions the {@link GetScanReportOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ScanReport} */ - public ServiceCall deleteProviderTypeInstance(DeleteProviderTypeInstanceOptions deleteProviderTypeInstanceOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(deleteProviderTypeInstanceOptions, - "deleteProviderTypeInstanceOptions cannot be null"); + public ServiceCall getScanReport(GetScanReportOptions getScanReportOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getScanReportOptions, + "getScanReportOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("provider_type_id", deleteProviderTypeInstanceOptions.providerTypeId()); - pathParamsMap.put("provider_type_instance_id", deleteProviderTypeInstanceOptions.providerTypeInstanceId()); - RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteProviderTypeInstance"); + pathParamsMap.put("instance_id", getScanReportOptions.instanceId()); + pathParamsMap.put("report_id", getScanReportOptions.reportId()); + pathParamsMap.put("job_id", getScanReportOptions.jobId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/scan_reports/{job_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getScanReport"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } - if (deleteProviderTypeInstanceOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", deleteProviderTypeInstanceOptions.xCorrelationId()); + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get a scan report details. + * + * Download the scan report with evaluation details for the specified ID. For more information, see [Viewing + * results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + * + * @param getScanReportDownloadFileOptions the {@link GetScanReportDownloadFileOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link InputStream} + */ + public ServiceCall getScanReportDownloadFile(GetScanReportDownloadFileOptions getScanReportDownloadFileOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getScanReportDownloadFileOptions, + "getScanReportDownloadFileOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getScanReportDownloadFileOptions.instanceId()); + pathParamsMap.put("report_id", getScanReportDownloadFileOptions.reportId()); + pathParamsMap.put("job_id", getScanReportDownloadFileOptions.jobId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/reports/{report_id}/scan_reports/{job_id}/download", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getScanReportDownloadFile"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); } - if (deleteProviderTypeInstanceOptions.xRequestId() != null) { - builder.header("X-Request-ID", deleteProviderTypeInstanceOptions.xRequestId()); + if (getScanReportDownloadFileOptions.accept() != null) { + builder.header("Accept", getScanReportDownloadFileOptions.accept()); } - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + ResponseConverter responseConverter = ResponseConverterUtils.getInputStream(); return createServiceCall(builder.build(), responseConverter); } /** - * Get a provider type instance. + * Get all rules. * - * 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://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + * Retrieve all the rules that you use to target the exact configuration properties that you need to ensure are + * compliant. For more information, see [Defining custom + * rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). * - * @param getProviderTypeInstanceOptions the {@link GetProviderTypeInstanceOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstanceItem} + * @param listRulesOptions the {@link ListRulesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link RuleCollection} */ - public ServiceCall getProviderTypeInstance(GetProviderTypeInstanceOptions getProviderTypeInstanceOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getProviderTypeInstanceOptions, - "getProviderTypeInstanceOptions cannot be null"); + public ServiceCall listRules(ListRulesOptions listRulesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listRulesOptions, + "listRulesOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("provider_type_id", getProviderTypeInstanceOptions.providerTypeId()); - pathParamsMap.put("provider_type_instance_id", getProviderTypeInstanceOptions.providerTypeInstanceId()); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getProviderTypeInstance"); + pathParamsMap.put("instance_id", listRulesOptions.instanceId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/rules", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listRules"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getProviderTypeInstanceOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getProviderTypeInstanceOptions.xCorrelationId()); + if (listRulesOptions.limit() != null) { + builder.query("limit", String.valueOf(listRulesOptions.limit())); + } + if (listRulesOptions.start() != null) { + builder.query("start", String.valueOf(listRulesOptions.start())); + } + if (listRulesOptions.type() != null) { + builder.query("type", String.valueOf(listRulesOptions.type())); + } + if (listRulesOptions.search() != null) { + builder.query("search", String.valueOf(listRulesOptions.search())); } - if (getProviderTypeInstanceOptions.xRequestId() != null) { - builder.header("X-Request-ID", getProviderTypeInstanceOptions.xRequestId()); + if (listRulesOptions.serviceName() != null) { + builder.query("service_name", String.valueOf(listRulesOptions.serviceName())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + if (listRulesOptions.sort() != null) { + builder.query("sort", String.valueOf(listRulesOptions.sort())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Update a provider type instance. + * Create a custom rule. * - * 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). + * Create a custom rule to to target the exact configuration properties that you need to evaluate your resources for + * compliance. For more information, see [Defining custom + * rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). * - * @param updateProviderTypeInstanceOptions the {@link UpdateProviderTypeInstanceOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProviderTypeInstanceItem} + * @param createRuleOptions the {@link CreateRuleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Rule} */ - public ServiceCall updateProviderTypeInstance(UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(updateProviderTypeInstanceOptions, - "updateProviderTypeInstanceOptions cannot be null"); + public ServiceCall createRule(CreateRuleOptions createRuleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createRuleOptions, + "createRuleOptions cannot be null"); Map pathParamsMap = new HashMap(); - pathParamsMap.put("provider_type_id", updateProviderTypeInstanceOptions.providerTypeId()); - pathParamsMap.put("provider_type_instance_id", updateProviderTypeInstanceOptions.providerTypeInstanceId()); - RequestBuilder builder = RequestBuilder.patch(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "updateProviderTypeInstance"); + pathParamsMap.put("instance_id", createRuleOptions.instanceId()); + RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/rules", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "createRule"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (updateProviderTypeInstanceOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", updateProviderTypeInstanceOptions.xCorrelationId()); + 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.version() != null) { + contentJson.addProperty("version", createRuleOptions.version()); + } + if (createRuleOptions.xImport() != null) { + contentJson.add("import", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRuleOptions.xImport())); } - if (updateProviderTypeInstanceOptions.xRequestId() != null) { - builder.header("X-Request-ID", updateProviderTypeInstanceOptions.xRequestId()); + if (createRuleOptions.labels() != null) { + contentJson.add("labels", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createRuleOptions.labels())); } - 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()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List instances of provider types. + * Get a custom rule. * - * 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). + * Retrieve a rule that you created to evaluate your resources. For more information, see [Defining custom + * rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). * - * @param getProviderTypesInstancesOptions the {@link GetProviderTypesInstancesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProviderTypesInstancesResponse} + * @param getRuleOptions the {@link GetRuleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Rule} */ - public ServiceCall getProviderTypesInstances(GetProviderTypesInstancesOptions getProviderTypesInstancesOptions) { - if (getProviderTypesInstancesOptions == null) { - getProviderTypesInstancesOptions = new GetProviderTypesInstancesOptions.Builder().build(); + public ServiceCall getRule(GetRuleOptions getRuleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getRuleOptions, + "getRuleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", getRuleOptions.instanceId()); + pathParamsMap.put("rule_id", getRuleOptions.ruleId()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/rules/{rule_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getRule"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); } - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/provider_types_instances")); - Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getProviderTypesInstances"); + builder.header("Accept", "application/json"); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a custom rule. + * + * Update a custom rule that you use to target the exact configuration properties that you need to evaluate your + * resources for compliance. For more information, see [Defining custom + * rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). + * + * @param replaceRuleOptions the {@link ReplaceRuleOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Rule} + */ + public ServiceCall replaceRule(ReplaceRuleOptions replaceRuleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(replaceRuleOptions, + "replaceRuleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", replaceRuleOptions.instanceId()); + pathParamsMap.put("rule_id", replaceRuleOptions.ruleId()); + RequestBuilder builder = RequestBuilder.put(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/rules/{rule_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "replaceRule"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); - if (getProviderTypesInstancesOptions.xCorrelationId() != null) { - builder.header("X-Correlation-ID", getProviderTypesInstancesOptions.xCorrelationId()); + builder.header("If-Match", replaceRuleOptions.ifMatch()); + 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.version() != null) { + contentJson.addProperty("version", replaceRuleOptions.version()); } - if (getProviderTypesInstancesOptions.xRequestId() != null) { - builder.header("X-Request-ID", getProviderTypesInstancesOptions.xRequestId()); + if (replaceRuleOptions.xImport() != null) { + contentJson.add("import", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRuleOptions.xImport())); + } + if (replaceRuleOptions.labels() != null) { + contentJson.add("labels", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(replaceRuleOptions.labels())); } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List instances of provider types. + * Delete a custom rule. * - * 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). + * Delete a custom rule that you no longer require to evaluate your resources. For more information, see [Defining + * custom rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). * - * @return a {@link ServiceCall} with a result of type {@link ProviderTypesInstancesResponse} + * @param deleteRuleOptions the {@link DeleteRuleOptions} containing the options for the call + * @return a {@link ServiceCall} with a void result */ - public ServiceCall getProviderTypesInstances() { - return getProviderTypesInstances(null); + public ServiceCall deleteRule(DeleteRuleOptions deleteRuleOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteRuleOptions, + "deleteRuleOptions cannot be null"); + Map pathParamsMap = new HashMap(); + pathParamsMap.put("instance_id", deleteRuleOptions.instanceId()); + pathParamsMap.put("rule_id", deleteRuleOptions.ruleId()); + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/instances/{instance_id}/v3/rules/{rule_id}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "deleteRule"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); } /** - * List provider types. + * List services. * - * 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). + * List all the services that you use to evaluate the configuration of your resources for security and compliance. + * [Learn more](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scannable-components). * - * @param listProviderTypesOptions the {@link ListProviderTypesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProviderTypesCollection} + * @param listServicesOptions the {@link ListServicesOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ServiceCollection} */ - 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"); + public ServiceCall listServices(ListServicesOptions listServicesOptions) { + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v3/services")); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "listServices"); 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()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * List provider types. + * List services. * - * 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). + * List all the services that you use to evaluate the configuration of your resources for security and compliance. + * [Learn more](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scannable-components). * - * @return a {@link ServiceCall} with a result of type {@link ProviderTypesCollection} + * @return a {@link ServiceCall} with a result of type {@link ServiceCollection} */ - public ServiceCall listProviderTypes() { - return listProviderTypes(null); + public ServiceCall listServices() { + return listServices(null); } /** - * Get a provider type. + * Get a service. * - * 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). + * Retrieve a service configuration that you monitor. [Learn + * more](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scannable-components). * - * @param getProviderTypeByIdOptions the {@link GetProviderTypeByIdOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ProviderTypeItem} + * @param getServiceOptions the {@link GetServiceOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link Service} */ - public ServiceCall getProviderTypeById(GetProviderTypeByIdOptions getProviderTypeByIdOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(getProviderTypeByIdOptions, - "getProviderTypeByIdOptions cannot be null"); + public ServiceCall getService(GetServiceOptions getServiceOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getServiceOptions, + "getServiceOptions 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"); + pathParamsMap.put("services_name", getServiceOptions.servicesName()); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v3/services/{services_name}", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("security_and_compliance_center_api", "v3", "getService"); 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()); + 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/Account.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Account.java index d3a86d37..56539210 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Account.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Account.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -23,8 +24,91 @@ public class Account extends GenericModel { protected String name; protected String type; + /** + * Builder. + */ + public static class Builder { + private String id; + private String name; + private String type; + + /** + * Instantiates a new Builder from an existing Account instance. + * + * @param account the instance to initialize the Builder with + */ + private Builder(Account account) { + this.id = account.id; + this.name = account.name; + this.type = account.type; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a Account. + * + * @return the new Account instance + */ + public Account build() { + return new Account(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the Account builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the Account builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the Account builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + } + protected Account() { } + protected Account(Builder builder) { + id = builder.id; + name = builder.name; + type = builder.type; + } + + /** + * New builder. + * + * @return a Account builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the id. * @@ -32,7 +116,7 @@ protected Account() { } * * @return the id */ - public String getId() { + public String id() { return id; } @@ -43,7 +127,7 @@ public String getId() { * * @return the name */ - public String getName() { + public String name() { return name; } @@ -54,7 +138,7 @@ public String getName() { * * @return the type */ - public String getType() { + public String type() { return type; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalDetails.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalDetails.java new file mode 100644 index 00000000..45671a82 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalDetails.java @@ -0,0 +1,66 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Extended information for a report. + */ +public class AdditionalDetails extends GenericModel { + + @SerializedName("created_by") + protected String createdBy; + protected List labels; + protected List links; + + protected AdditionalDetails() { } + + /** + * Gets the createdBy. + * + * Identifies which entity created a report. + * + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * Gets the labels. + * + * Classification for a report. + * + * @return the labels + */ + public List getLabels() { + return labels; + } + + /** + * Gets the links. + * + * URL. + * + * @return the links + */ + public List getLinks() { + return links; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalProperty.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalProperty.java index 8cc83f7d..2ce16b07 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalProperty.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalProperty.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalTargetAttribute.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalTargetAttribute.java index 903b126b..19d6d765 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalTargetAttribute.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalTargetAttribute.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -73,7 +74,7 @@ public interface Operator { protected String name; protected String operator; - protected String value; + protected Object value; /** * Builder. @@ -81,7 +82,7 @@ public interface Operator { public static class Builder { private String name; private String operator; - private String value; + private Object value; /** * Instantiates a new Builder from an existing AdditionalTargetAttribute instance. @@ -100,6 +101,15 @@ private Builder(AdditionalTargetAttribute additionalTargetAttribute) { public Builder() { } + /** + * Instantiates a new builder with required properties. + * + * @param operator the operator + */ + public Builder(String operator) { + this.operator = operator; + } + /** * Builds a AdditionalTargetAttribute. * @@ -137,7 +147,7 @@ public Builder operator(String operator) { * @param value the value * @return the AdditionalTargetAttribute builder */ - public Builder value(String value) { + public Builder value(Object value) { this.value = value; return this; } @@ -146,6 +156,8 @@ public Builder value(String value) { protected AdditionalTargetAttribute() { } protected AdditionalTargetAttribute(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.operator, + "operator cannot be null"); name = builder.name; operator = builder.operator; value = builder.value; @@ -185,11 +197,11 @@ public String operator() { /** * Gets the value. * - * The value. + * The value can be of any type. * * @return the value */ - public String 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/Assessment.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Assessment.java index de93bf9e..0d714b21 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Assessment.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Assessment.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,8 +10,10 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -32,10 +34,163 @@ public class Assessment extends GenericModel { protected String assessmentDescription; @SerializedName("parameter_count") protected Long parameterCount; - protected List parameters; + protected List parameters; + + /** + * Builder. + */ + public static class Builder { + private String assessmentId; + private String assessmentType; + private String assessmentMethod; + private String assessmentDescription; + private Long parameterCount; + private List parameters; + + /** + * Instantiates a new Builder from an existing Assessment instance. + * + * @param assessment the instance to initialize the Builder with + */ + private Builder(Assessment assessment) { + this.assessmentId = assessment.assessmentId; + this.assessmentType = assessment.assessmentType; + this.assessmentMethod = assessment.assessmentMethod; + this.assessmentDescription = assessment.assessmentDescription; + this.parameterCount = assessment.parameterCount; + this.parameters = assessment.parameters; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param parameters the parameters + */ + public Builder(List parameters) { + this.parameters = parameters; + } + + /** + * Builds a Assessment. + * + * @return the new Assessment instance + */ + public Assessment build() { + return new Assessment(this); + } + + /** + * Adds a new element to parameters. + * + * @param parameters the new element to be added + * @return the Assessment builder + */ + public Builder addParameters(Parameter parameters) { + com.ibm.cloud.sdk.core.util.Validator.notNull(parameters, + "parameters cannot be null"); + if (this.parameters == null) { + this.parameters = new ArrayList(); + } + this.parameters.add(parameters); + return this; + } + + /** + * Set the assessmentId. + * + * @param assessmentId the assessmentId + * @return the Assessment builder + */ + public Builder assessmentId(String assessmentId) { + this.assessmentId = assessmentId; + return this; + } + + /** + * Set the assessmentType. + * + * @param assessmentType the assessmentType + * @return the Assessment builder + */ + public Builder assessmentType(String assessmentType) { + this.assessmentType = assessmentType; + return this; + } + + /** + * Set the assessmentMethod. + * + * @param assessmentMethod the assessmentMethod + * @return the Assessment builder + */ + public Builder assessmentMethod(String assessmentMethod) { + this.assessmentMethod = assessmentMethod; + return this; + } + + /** + * Set the assessmentDescription. + * + * @param assessmentDescription the assessmentDescription + * @return the Assessment builder + */ + public Builder assessmentDescription(String assessmentDescription) { + this.assessmentDescription = assessmentDescription; + return this; + } + + /** + * Set the parameterCount. + * + * @param parameterCount the parameterCount + * @return the Assessment builder + */ + public Builder parameterCount(long parameterCount) { + this.parameterCount = parameterCount; + return this; + } + + /** + * Set the parameters. + * Existing parameters will be replaced. + * + * @param parameters the parameters + * @return the Assessment builder + */ + public Builder parameters(List parameters) { + this.parameters = parameters; + return this; + } + } protected Assessment() { } + protected Assessment(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.parameters, + "parameters cannot be null"); + assessmentId = builder.assessmentId; + assessmentType = builder.assessmentType; + assessmentMethod = builder.assessmentMethod; + assessmentDescription = builder.assessmentDescription; + parameterCount = builder.parameterCount; + parameters = builder.parameters; + } + + /** + * New builder. + * + * @return a Assessment builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the assessmentId. * @@ -43,7 +198,7 @@ protected Assessment() { } * * @return the assessmentId */ - public String getAssessmentId() { + public String assessmentId() { return assessmentId; } @@ -54,7 +209,7 @@ public String getAssessmentId() { * * @return the assessmentType */ - public String getAssessmentType() { + public String assessmentType() { return assessmentType; } @@ -65,7 +220,7 @@ public String getAssessmentType() { * * @return the assessmentMethod */ - public String getAssessmentMethod() { + public String assessmentMethod() { return assessmentMethod; } @@ -76,7 +231,7 @@ public String getAssessmentMethod() { * * @return the assessmentDescription */ - public String getAssessmentDescription() { + public String assessmentDescription() { return assessmentDescription; } @@ -87,7 +242,7 @@ public String getAssessmentDescription() { * * @return the parameterCount */ - public Long getParameterCount() { + public Long parameterCount() { return parameterCount; } @@ -98,7 +253,7 @@ public Long getParameterCount() { * * @return the parameters */ - public List getParameters() { + public List parameters() { return parameters; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentPrototype.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentPrototype.java new file mode 100644 index 00000000..d930a2aa --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentPrototype.java @@ -0,0 +1,122 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The necessary fields to include a rule/assessment. + */ +public class AssessmentPrototype extends GenericModel { + + @SerializedName("assessment_id") + protected String assessmentId; + @SerializedName("assessment_description") + protected String assessmentDescription; + + /** + * Builder. + */ + public static class Builder { + private String assessmentId; + private String assessmentDescription; + + /** + * Instantiates a new Builder from an existing AssessmentPrototype instance. + * + * @param assessmentPrototype the instance to initialize the Builder with + */ + private Builder(AssessmentPrototype assessmentPrototype) { + this.assessmentId = assessmentPrototype.assessmentId; + this.assessmentDescription = assessmentPrototype.assessmentDescription; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a AssessmentPrototype. + * + * @return the new AssessmentPrototype instance + */ + public AssessmentPrototype build() { + return new AssessmentPrototype(this); + } + + /** + * Set the assessmentId. + * + * @param assessmentId the assessmentId + * @return the AssessmentPrototype builder + */ + public Builder assessmentId(String assessmentId) { + this.assessmentId = assessmentId; + return this; + } + + /** + * Set the assessmentDescription. + * + * @param assessmentDescription the assessmentDescription + * @return the AssessmentPrototype builder + */ + public Builder assessmentDescription(String assessmentDescription) { + this.assessmentDescription = assessmentDescription; + return this; + } + } + + protected AssessmentPrototype() { } + + protected AssessmentPrototype(Builder builder) { + assessmentId = builder.assessmentId; + assessmentDescription = builder.assessmentDescription; + } + + /** + * New builder. + * + * @return a AssessmentPrototype builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assessmentId. + * + * The ID of the rule to target. A list of rules can be obtained from the list_rules method. + * + * @return the assessmentId + */ + public String assessmentId() { + return assessmentId; + } + + /** + * Gets the assessmentDescription. + * + * Details on the intent of the rule for an assessment. + * + * @return the assessmentDescription + */ + public String assessmentDescription() { + return assessmentDescription; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentWithStats.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentWithStats.java new file mode 100644 index 00000000..0204db96 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentWithStats.java @@ -0,0 +1,171 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The control specification assessment. + */ +public class AssessmentWithStats extends GenericModel { + + @SerializedName("assessment_id") + protected String assessmentId; + @SerializedName("assessment_type") + protected String assessmentType; + @SerializedName("assessment_method") + protected String assessmentMethod; + @SerializedName("assessment_description") + protected String assessmentDescription; + @SerializedName("parameter_count") + protected Long parameterCount; + protected List parameters; + @SerializedName("total_count") + protected Long totalCount; + @SerializedName("pass_count") + protected Long passCount; + @SerializedName("failure_count") + protected Long failureCount; + @SerializedName("error_count") + protected Long errorCount; + @SerializedName("completed_count") + protected Long completedCount; + + protected AssessmentWithStats() { } + + /** + * Gets the assessmentId. + * + * The assessment ID. + * + * @return the assessmentId + */ + public String getAssessmentId() { + return assessmentId; + } + + /** + * Gets the assessmentType. + * + * The assessment type. + * + * @return the assessmentType + */ + public String getAssessmentType() { + return assessmentType; + } + + /** + * Gets the assessmentMethod. + * + * The assessment method. + * + * @return the assessmentMethod + */ + public String getAssessmentMethod() { + return assessmentMethod; + } + + /** + * Gets the assessmentDescription. + * + * The assessment description. + * + * @return the assessmentDescription + */ + public String getAssessmentDescription() { + return assessmentDescription; + } + + /** + * Gets the parameterCount. + * + * The number of parameters of this assessment. + * + * @return the parameterCount + */ + public Long getParameterCount() { + return parameterCount; + } + + /** + * Gets the parameters. + * + * The list of parameters of this assessment. + * + * @return the parameters + */ + public List getParameters() { + return parameters; + } + + /** + * Gets the totalCount. + * + * The total number of evaluations. + * + * @return the totalCount + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Gets the passCount. + * + * The number of passed evaluations. + * + * @return the passCount + */ + public Long getPassCount() { + return passCount; + } + + /** + * Gets the failureCount. + * + * The number of failed evaluations. + * + * @return the failureCount + */ + public Long getFailureCount() { + return failureCount; + } + + /** + * Gets the errorCount. + * + * The number of evaluations that started, but did not finish, and ended with errors. + * + * @return the errorCount + */ + public Long getErrorCount() { + return errorCount; + } + + /** + * Gets the completedCount. + * + * The total number of completed evaluations. + * + * @return the completedCount + */ + public Long getCompletedCount() { + return completedCount; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Attachment.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Attachment.java index fc93fd68..14ce4b7a 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Attachment.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Attachment.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -25,7 +26,9 @@ public class Attachment extends GenericModel { protected String name; protected String description; protected String schedule; - protected List scope; + protected Object scope; + protected List scopes; + protected AttachmentNotifications notifications; protected Attachment() { } @@ -76,12 +79,36 @@ public String getSchedule() { /** * Gets the scope. * - * The scope of the attachment. + * (deprecated) The scope associated with the report. * * @return the scope + * @deprecated this method is deprecated and may be removed in a future release */ - public List getScope() { + @Deprecated + public Object getScope() { return scope; } + + /** + * Gets the scopes. + * + * The report's scopes based on the caller's access permissions. + * + * @return the scopes + */ + public List getScopes() { + return scopes; + } + + /** + * Gets the notifications. + * + * The notification configuration of the attachment. + * + * @return the notifications + */ + public AttachmentNotifications getNotifications() { + return notifications; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotifications.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotifications.java new file mode 100644 index 00000000..256bf14e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotifications.java @@ -0,0 +1,119 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 notification configuration of the attachment. + */ +public class AttachmentNotifications extends GenericModel { + + protected Boolean enabled; + protected AttachmentNotificationsControls controls; + + /** + * Builder. + */ + public static class Builder { + private Boolean enabled; + private AttachmentNotificationsControls controls; + + /** + * Instantiates a new Builder from an existing AttachmentNotifications instance. + * + * @param attachmentNotifications the instance to initialize the Builder with + */ + private Builder(AttachmentNotifications attachmentNotifications) { + this.enabled = attachmentNotifications.enabled; + this.controls = attachmentNotifications.controls; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a AttachmentNotifications. + * + * @return the new AttachmentNotifications instance + */ + public AttachmentNotifications build() { + return new AttachmentNotifications(this); + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the AttachmentNotifications builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the controls. + * + * @param controls the controls + * @return the AttachmentNotifications builder + */ + public Builder controls(AttachmentNotificationsControls controls) { + this.controls = controls; + return this; + } + } + + protected AttachmentNotifications() { } + + protected AttachmentNotifications(Builder builder) { + enabled = builder.enabled; + controls = builder.controls; + } + + /** + * New builder. + * + * @return a AttachmentNotifications builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the enabled. + * + * Shows if the notification is enabled or disabled. + * + * @return the enabled + */ + public Boolean enabled() { + return enabled; + } + + /** + * Gets the controls. + * + * The controls associated with an AttachmentNotification. + * + * @return the controls + */ + public AttachmentNotificationsControls controls() { + return controls; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsControls.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsControls.java new file mode 100644 index 00000000..8358726a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsControls.java @@ -0,0 +1,153 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 controls associated with an AttachmentNotification. + */ +public class AttachmentNotificationsControls extends GenericModel { + + @SerializedName("threshold_limit") + protected Long thresholdLimit; + @SerializedName("failed_control_ids") + protected List failedControlIds; + + /** + * Builder. + */ + public static class Builder { + private Long thresholdLimit; + private List failedControlIds; + + /** + * Instantiates a new Builder from an existing AttachmentNotificationsControls instance. + * + * @param attachmentNotificationsControls the instance to initialize the Builder with + */ + private Builder(AttachmentNotificationsControls attachmentNotificationsControls) { + this.thresholdLimit = attachmentNotificationsControls.thresholdLimit; + this.failedControlIds = attachmentNotificationsControls.failedControlIds; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param failedControlIds the failedControlIds + */ + public Builder(List failedControlIds) { + this.failedControlIds = failedControlIds; + } + + /** + * Builds a AttachmentNotificationsControls. + * + * @return the new AttachmentNotificationsControls instance + */ + public AttachmentNotificationsControls build() { + return new AttachmentNotificationsControls(this); + } + + /** + * Adds a new element to failedControlIds. + * + * @param failedControlIds the new element to be added + * @return the AttachmentNotificationsControls builder + */ + public Builder addFailedControlIds(String failedControlIds) { + com.ibm.cloud.sdk.core.util.Validator.notNull(failedControlIds, + "failedControlIds cannot be null"); + if (this.failedControlIds == null) { + this.failedControlIds = new ArrayList(); + } + this.failedControlIds.add(failedControlIds); + return this; + } + + /** + * Set the thresholdLimit. + * + * @param thresholdLimit the thresholdLimit + * @return the AttachmentNotificationsControls builder + */ + public Builder thresholdLimit(long thresholdLimit) { + this.thresholdLimit = thresholdLimit; + return this; + } + + /** + * Set the failedControlIds. + * Existing failedControlIds will be replaced. + * + * @param failedControlIds the failedControlIds + * @return the AttachmentNotificationsControls builder + */ + public Builder failedControlIds(List failedControlIds) { + this.failedControlIds = failedControlIds; + return this; + } + } + + protected AttachmentNotificationsControls() { } + + protected AttachmentNotificationsControls(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.failedControlIds, + "failedControlIds cannot be null"); + thresholdLimit = builder.thresholdLimit; + failedControlIds = builder.failedControlIds; + } + + /** + * New builder. + * + * @return a AttachmentNotificationsControls builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the thresholdLimit. + * + * The maximum number of not compliant controls before a notification is triggered. + * + * @return the thresholdLimit + */ + public Long thresholdLimit() { + return thresholdLimit; + } + + /** + * Gets the failedControlIds. + * + * List of controls that triggers a notification should a scan fail. + * + * @return the failedControlIds + */ + public List failedControlIds() { + return failedControlIds; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComparePredefinedProfilesResponse.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComparePredefinedProfilesResponse.java new file mode 100644 index 00000000..37742d19 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComparePredefinedProfilesResponse.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The predefined profile comparison response. + */ +public class ComparePredefinedProfilesResponse extends GenericModel { + + @SerializedName("current_predefined_version") + protected CompareProfileResponse currentPredefinedVersion; + @SerializedName("latest_predefined_version") + protected CompareProfileResponse latestPredefinedVersion; + @SerializedName("controls_changes") + protected ControlChanges controlsChanges; + @SerializedName("default_parameters_changes") + protected DefaultParametersChanges defaultParametersChanges; + + protected ComparePredefinedProfilesResponse() { } + + /** + * Gets the currentPredefinedVersion. + * + * Shows a change in the Profile. + * + * @return the currentPredefinedVersion + */ + public CompareProfileResponse getCurrentPredefinedVersion() { + return currentPredefinedVersion; + } + + /** + * Gets the latestPredefinedVersion. + * + * Shows a change in the Profile. + * + * @return the latestPredefinedVersion + */ + public CompareProfileResponse getLatestPredefinedVersion() { + return latestPredefinedVersion; + } + + /** + * Gets the controlsChanges. + * + * Shows details of the controls that were changed. + * + * @return the controlsChanges + */ + public ControlChanges getControlsChanges() { + return controlsChanges; + } + + /** + * Gets the defaultParametersChanges. + * + * Shows details of the parameters that were changed. + * + * @return the defaultParametersChanges + */ + public DefaultParametersChanges getDefaultParametersChanges() { + return defaultParametersChanges; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfileResponse.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfileResponse.java new file mode 100644 index 00000000..e2a75b88 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfileResponse.java @@ -0,0 +1,193 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Shows a change in the Profile. + */ +public class CompareProfileResponse extends GenericModel { + + /** + * The type of profile, either predefined or custom. + */ + public interface ProfileType { + /** custom. */ + String CUSTOM = "custom"; + /** predefined. */ + String PREDEFINED = "predefined"; + } + + protected String id; + @SerializedName("profile_name") + protected String profileName; + @SerializedName("profile_description") + protected String profileDescription; + @SerializedName("profile_type") + protected String profileType; + @SerializedName("profile_version") + protected String profileVersion; + @SerializedName("version_group_label") + protected String versionGroupLabel; + protected Boolean latest; + @SerializedName("created_by") + protected String createdBy; + @SerializedName("created_on") + protected Date createdOn; + @SerializedName("updated_by") + protected String updatedBy; + @SerializedName("updated_on") + protected Date updatedOn; + @SerializedName("controls_count") + protected Long controlsCount; + + protected CompareProfileResponse() { } + + /** + * Gets the id. + * + * The ID of the profile. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the profileName. + * + * The name of the profile. + * + * @return the profileName + */ + public String getProfileName() { + return profileName; + } + + /** + * Gets the profileDescription. + * + * A description of what the profile should represent. + * + * @return the profileDescription + */ + public String getProfileDescription() { + return profileDescription; + } + + /** + * Gets the profileType. + * + * The type of profile, either predefined or custom. + * + * @return the profileType + */ + public String getProfileType() { + return profileType; + } + + /** + * Gets the profileVersion. + * + * The version of the profile. + * + * @return the profileVersion + */ + public String getProfileVersion() { + return profileVersion; + } + + /** + * Gets the versionGroupLabel. + * + * The unique identifier of the profile revision. + * + * @return the versionGroupLabel + */ + public String getVersionGroupLabel() { + return versionGroupLabel; + } + + /** + * Gets the latest. + * + * Determines if the profile is up to date with the latest revisions. + * + * @return the latest + */ + public Boolean isLatest() { + return latest; + } + + /** + * Gets the createdBy. + * + * User who created the profile. + * + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * Gets the createdOn. + * + * The date when the profile was created, in date-time format. + * + * @return the createdOn + */ + public Date getCreatedOn() { + return createdOn; + } + + /** + * Gets the updatedBy. + * + * User who made the latest changes to the profile. + * + * @return the updatedBy + */ + public String getUpdatedBy() { + return updatedBy; + } + + /** + * Gets the updatedOn. + * + * The date when the profile was last updated, in date-time format. + * + * @return the updatedOn + */ + public Date getUpdatedOn() { + return updatedOn; + } + + /** + * Gets the controlsCount. + * + * Number of controls in the profile. + * + * @return the controlsCount + */ + public Long getControlsCount() { + return controlsCount; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfilesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfilesOptions.java new file mode 100644 index 00000000..c414fefe --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfilesOptions.java @@ -0,0 +1,160 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 compareProfiles options. + */ +public class CompareProfilesOptions extends GenericModel { + + protected String instanceId; + protected String profileId; + protected String accountId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String profileId; + private String accountId; + + /** + * Instantiates a new Builder from an existing CompareProfilesOptions instance. + * + * @param compareProfilesOptions the instance to initialize the Builder with + */ + private Builder(CompareProfilesOptions compareProfilesOptions) { + this.instanceId = compareProfilesOptions.instanceId; + this.profileId = compareProfilesOptions.profileId; + this.accountId = compareProfilesOptions.accountId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param profileId the profileId + */ + public Builder(String instanceId, String profileId) { + this.instanceId = instanceId; + this.profileId = profileId; + } + + /** + * Builds a CompareProfilesOptions. + * + * @return the new CompareProfilesOptions instance + */ + public CompareProfilesOptions build() { + return new CompareProfilesOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the CompareProfilesOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the profileId. + * + * @param profileId the profileId + * @return the CompareProfilesOptions builder + */ + public Builder profileId(String profileId) { + this.profileId = profileId; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CompareProfilesOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + } + + protected CompareProfilesOptions() { } + + protected CompareProfilesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); + instanceId = builder.instanceId; + profileId = builder.profileId; + accountId = builder.accountId; + } + + /** + * New builder. + * + * @return a CompareProfilesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the profileId. + * + * The profile ID to compare. + * + * @return the profileId + */ + public String profileId() { + return profileId; + } + + /** + * Gets the accountId. + * + * The user account ID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceScore.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceScore.java index 6a67983d..1c77f683 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceScore.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceScore.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStats.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStats.java index 89b863b1..03b9b85a 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStats.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStats.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; @@ -32,6 +33,8 @@ public interface Status { String UNABLE_TO_PERFORM = "unable_to_perform"; /** user_evaluation_required. */ String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; } protected String status; @@ -45,6 +48,8 @@ public interface Status { protected Long unableToPerformCount; @SerializedName("user_evaluation_required_count") protected Long userEvaluationRequiredCount; + @SerializedName("not_applicable_count") + protected Long notApplicableCount; protected ComplianceStats() { } @@ -113,5 +118,16 @@ public Long getUnableToPerformCount() { public Long getUserEvaluationRequiredCount() { return userEvaluationRequiredCount; } + + /** + * Gets the notApplicableCount. + * + * The number of not applicable (with no evaluations) checks. + * + * @return the notApplicableCount + */ + public Long getNotApplicableCount() { + return notApplicableCount; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsWithNonCompliant.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsWithNonCompliant.java new file mode 100644 index 00000000..62147c05 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsWithNonCompliant.java @@ -0,0 +1,148 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The compliance stats. + */ +public class ComplianceStatsWithNonCompliant extends GenericModel { + + /** + * The allowed values of an aggregated status for controls, specifications, assessments, and resources. + */ + public interface Status { + /** compliant. */ + String COMPLIANT = "compliant"; + /** not_compliant. */ + String NOT_COMPLIANT = "not_compliant"; + /** unable_to_perform. */ + String UNABLE_TO_PERFORM = "unable_to_perform"; + /** user_evaluation_required. */ + String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; + } + + protected String status; + @SerializedName("total_count") + protected Long totalCount; + @SerializedName("compliant_count") + protected Long compliantCount; + @SerializedName("not_compliant_count") + protected Long notCompliantCount; + @SerializedName("unable_to_perform_count") + protected Long unableToPerformCount; + @SerializedName("user_evaluation_required_count") + protected Long userEvaluationRequiredCount; + @SerializedName("not_applicable_count") + protected Long notApplicableCount; + @SerializedName("not_compliant_controls") + protected List notCompliantControls; + + protected ComplianceStatsWithNonCompliant() { } + + /** + * Gets the status. + * + * The allowed values of an aggregated status for controls, specifications, assessments, and resources. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the totalCount. + * + * The total number of checks. + * + * @return the totalCount + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Gets the compliantCount. + * + * The number of compliant checks. + * + * @return the compliantCount + */ + public Long getCompliantCount() { + return compliantCount; + } + + /** + * Gets the notCompliantCount. + * + * The number of checks that are not compliant. + * + * @return the notCompliantCount + */ + public Long getNotCompliantCount() { + return notCompliantCount; + } + + /** + * Gets the unableToPerformCount. + * + * The number of checks that are unable to perform. + * + * @return the unableToPerformCount + */ + public Long getUnableToPerformCount() { + return unableToPerformCount; + } + + /** + * Gets the userEvaluationRequiredCount. + * + * The number of checks that require a user evaluation. + * + * @return the userEvaluationRequiredCount + */ + public Long getUserEvaluationRequiredCount() { + return userEvaluationRequiredCount; + } + + /** + * Gets the notApplicableCount. + * + * The number of not applicable (with no evaluations) checks. + * + * @return the notApplicableCount + */ + public Long getNotApplicableCount() { + return notApplicableCount; + } + + /** + * Gets the notCompliantControls. + * + * The list of non compliant controls. + * + * @return the notCompliantControls + */ + public List getNotCompliantControls() { + return notCompliantControls; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItem.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItem.java new file mode 100644 index 00000000..a284f441 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItem.java @@ -0,0 +1,208 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ConditionItem. + * + * Classes which extend this class: + * - ConditionItemConditionBase + * - ConditionItemConditionList + * - ConditionItemConditionSubRule + */ +public class ConditionItem 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; + protected List or; + protected List and; + protected SubRule any; + @SerializedName("any_ifexists") + protected SubRule anyIfexists; + protected SubRule all; + @SerializedName("all_ifexists") + protected SubRule allIfexists; + + protected ConditionItem() { } + + /** + * 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. + * + * The value can be of any type. + * + * @return the value + */ + public Object value() { + return value; + } + + /** + * Gets the or. + * + * A list of required configurations where one item should evaluate to true. + * + * @return the or + */ + public List or() { + return or; + } + + /** + * Gets the and. + * + * A list of required configurations where all items should evaluate to true. + * + * @return the and + */ + public List and() { + return and; + } + + /** + * Gets the any. + * + * A rule within a rule used in the requiredConfig. + * + * @return the any + */ + public SubRule any() { + return any; + } + + /** + * Gets the anyIfexists. + * + * A rule within a rule used in the requiredConfig. + * + * @return the anyIfexists + */ + public SubRule anyIfexists() { + return anyIfexists; + } + + /** + * Gets the all. + * + * A rule within a rule used in the requiredConfig. + * + * @return the all + */ + public SubRule all() { + return all; + } + + /** + * Gets the allIfexists. + * + * A rule within a rule used in the requiredConfig. + * + * @return the allIfexists + */ + public SubRule allIfexists() { + return allIfexists; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionBase.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionBase.java new file mode 100644 index 00000000..0b91204f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionBase.java @@ -0,0 +1,188 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 required configuration base object. + */ +public class ConditionItemConditionBase extends ConditionItem { + + /** + * 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"; + } + + + /** + * Builder. + */ + public static class Builder { + private String description; + private String property; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing ConditionItemConditionBase instance. + * + * @param conditionItemConditionBase the instance to initialize the Builder with + */ + public Builder(ConditionItem conditionItemConditionBase) { + this.description = conditionItemConditionBase.description; + this.property = conditionItemConditionBase.property; + this.operator = conditionItemConditionBase.operator; + this.value = conditionItemConditionBase.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 ConditionItemConditionBase. + * + * @return the new ConditionItemConditionBase instance + */ + public ConditionItemConditionBase build() { + return new ConditionItemConditionBase(this); + } + + /** + * Set the description. + * + * @param description the description + * @return the ConditionItemConditionBase builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the property. + * + * @param property the property + * @return the ConditionItemConditionBase builder + */ + public Builder property(String property) { + this.property = property; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the ConditionItemConditionBase builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ConditionItemConditionBase builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected ConditionItemConditionBase() { } + + protected ConditionItemConditionBase(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 ConditionItemConditionBase 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/ConditionItemConditionList.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionList.java new file mode 100644 index 00000000..484d0d78 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionList.java @@ -0,0 +1,28 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A list of required configurations. + * + * Classes which extend this class: + * - ConditionItemConditionListConditionListConditionOr + * - ConditionItemConditionListConditionListConditionAnd + */ +public class ConditionItemConditionList extends ConditionItem { + + + protected ConditionItemConditionList() { } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionAnd.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionAnd.java new file mode 100644 index 00000000..8dcd37f7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionAnd.java @@ -0,0 +1,113 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * ConditionItemConditionListConditionListConditionAnd. + */ +public class ConditionItemConditionListConditionListConditionAnd extends ConditionItemConditionList { + + + /** + * Builder. + */ + public static class Builder { + private String description; + private List and; + + /** + * Instantiates a new Builder from an existing ConditionItemConditionListConditionListConditionAnd instance. + * + * @param conditionItemConditionListConditionListConditionAnd the instance to initialize the Builder with + */ + public Builder(ConditionItemConditionList conditionItemConditionListConditionListConditionAnd) { + this.description = conditionItemConditionListConditionListConditionAnd.description; + this.and = conditionItemConditionListConditionListConditionAnd.and; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ConditionItemConditionListConditionListConditionAnd. + * + * @return the new ConditionItemConditionListConditionListConditionAnd instance + */ + public ConditionItemConditionListConditionListConditionAnd build() { + return new ConditionItemConditionListConditionListConditionAnd(this); + } + + /** + * Adds a new element to and. + * + * @param and the new element to be added + * @return the ConditionItemConditionListConditionListConditionAnd builder + */ + public Builder addAnd(ConditionItem and) { + com.ibm.cloud.sdk.core.util.Validator.notNull(and, + "and cannot be null"); + if (this.and == null) { + this.and = new ArrayList(); + } + this.and.add(and); + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ConditionItemConditionListConditionListConditionAnd builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the and. + * Existing and will be replaced. + * + * @param and the and + * @return the ConditionItemConditionListConditionListConditionAnd builder + */ + public Builder and(List and) { + this.and = and; + return this; + } + } + + protected ConditionItemConditionListConditionListConditionAnd() { } + + protected ConditionItemConditionListConditionListConditionAnd(Builder builder) { + description = builder.description; + and = builder.and; + } + + /** + * New builder. + * + * @return a ConditionItemConditionListConditionListConditionAnd 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/ConditionItemConditionListConditionListConditionOr.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionOr.java new file mode 100644 index 00000000..fbf88ef9 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionOr.java @@ -0,0 +1,113 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * The `OR` required configurations. + */ +public class ConditionItemConditionListConditionListConditionOr extends ConditionItemConditionList { + + + /** + * Builder. + */ + public static class Builder { + private String description; + private List or; + + /** + * Instantiates a new Builder from an existing ConditionItemConditionListConditionListConditionOr instance. + * + * @param conditionItemConditionListConditionListConditionOr the instance to initialize the Builder with + */ + public Builder(ConditionItemConditionList conditionItemConditionListConditionListConditionOr) { + this.description = conditionItemConditionListConditionListConditionOr.description; + this.or = conditionItemConditionListConditionListConditionOr.or; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ConditionItemConditionListConditionListConditionOr. + * + * @return the new ConditionItemConditionListConditionListConditionOr instance + */ + public ConditionItemConditionListConditionListConditionOr build() { + return new ConditionItemConditionListConditionListConditionOr(this); + } + + /** + * Adds a new element to or. + * + * @param or the new element to be added + * @return the ConditionItemConditionListConditionListConditionOr builder + */ + public Builder addOr(ConditionItem or) { + com.ibm.cloud.sdk.core.util.Validator.notNull(or, + "or cannot be null"); + if (this.or == null) { + this.or = new ArrayList(); + } + this.or.add(or); + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ConditionItemConditionListConditionListConditionOr builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the or. + * Existing or will be replaced. + * + * @param or the or + * @return the ConditionItemConditionListConditionListConditionOr builder + */ + public Builder or(List or) { + this.or = or; + return this; + } + } + + protected ConditionItemConditionListConditionListConditionOr() { } + + protected ConditionItemConditionListConditionListConditionOr(Builder builder) { + description = builder.description; + or = builder.or; + } + + /** + * New builder. + * + * @return a ConditionItemConditionListConditionListConditionOr 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/ConditionItemConditionSubRule.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRule.java new file mode 100644 index 00000000..9e7666c7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRule.java @@ -0,0 +1,30 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * ConditionItemConditionSubRule. + * + * Classes which extend this class: + * - ConditionItemConditionSubRuleConditionSubRuleConditionAny + * - ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf + * - ConditionItemConditionSubRuleConditionSubRuleConditionAll + * - ConditionItemConditionSubRuleConditionSubRuleConditionAllIf + */ +public class ConditionItemConditionSubRule extends ConditionItem { + + + protected ConditionItemConditionSubRule() { } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAll.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAll.java new file mode 100644 index 00000000..978dd462 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAll.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A subrule using the 'all' operator. + */ +public class ConditionItemConditionSubRuleConditionSubRuleConditionAll extends ConditionItemConditionSubRule { + + + /** + * Builder. + */ + public static class Builder { + private SubRule all; + + /** + * Instantiates a new Builder from an existing ConditionItemConditionSubRuleConditionSubRuleConditionAll instance. + * + * @param conditionItemConditionSubRuleConditionSubRuleConditionAll the instance to initialize the Builder with + */ + public Builder(ConditionItemConditionSubRule conditionItemConditionSubRuleConditionSubRuleConditionAll) { + this.all = conditionItemConditionSubRuleConditionSubRuleConditionAll.all; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ConditionItemConditionSubRuleConditionSubRuleConditionAll. + * + * @return the new ConditionItemConditionSubRuleConditionSubRuleConditionAll instance + */ + public ConditionItemConditionSubRuleConditionSubRuleConditionAll build() { + return new ConditionItemConditionSubRuleConditionSubRuleConditionAll(this); + } + + /** + * Set the all. + * + * @param all the all + * @return the ConditionItemConditionSubRuleConditionSubRuleConditionAll builder + */ + public Builder all(SubRule all) { + this.all = all; + return this; + } + } + + protected ConditionItemConditionSubRuleConditionSubRuleConditionAll() { } + + protected ConditionItemConditionSubRuleConditionSubRuleConditionAll(Builder builder) { + all = builder.all; + } + + /** + * New builder. + * + * @return a ConditionItemConditionSubRuleConditionSubRuleConditionAll 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/ConditionItemConditionSubRuleConditionSubRuleConditionAllIf.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAllIf.java new file mode 100644 index 00000000..9aaf9f22 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAllIf.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A subrule using the 'all_ifexists' operator. + */ +public class ConditionItemConditionSubRuleConditionSubRuleConditionAllIf extends ConditionItemConditionSubRule { + + + /** + * Builder. + */ + public static class Builder { + private SubRule allIfexists; + + /** + * Instantiates a new Builder from an existing ConditionItemConditionSubRuleConditionSubRuleConditionAllIf instance. + * + * @param conditionItemConditionSubRuleConditionSubRuleConditionAllIf the instance to initialize the Builder with + */ + public Builder(ConditionItemConditionSubRule conditionItemConditionSubRuleConditionSubRuleConditionAllIf) { + this.allIfexists = conditionItemConditionSubRuleConditionSubRuleConditionAllIf.allIfexists; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ConditionItemConditionSubRuleConditionSubRuleConditionAllIf. + * + * @return the new ConditionItemConditionSubRuleConditionSubRuleConditionAllIf instance + */ + public ConditionItemConditionSubRuleConditionSubRuleConditionAllIf build() { + return new ConditionItemConditionSubRuleConditionSubRuleConditionAllIf(this); + } + + /** + * Set the allIfexists. + * + * @param allIfexists the allIfexists + * @return the ConditionItemConditionSubRuleConditionSubRuleConditionAllIf builder + */ + public Builder allIfexists(SubRule allIfexists) { + this.allIfexists = allIfexists; + return this; + } + } + + protected ConditionItemConditionSubRuleConditionSubRuleConditionAllIf() { } + + protected ConditionItemConditionSubRuleConditionSubRuleConditionAllIf(Builder builder) { + allIfexists = builder.allIfexists; + } + + /** + * New builder. + * + * @return a ConditionItemConditionSubRuleConditionSubRuleConditionAllIf 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/ConditionItemConditionSubRuleConditionSubRuleConditionAny.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAny.java new file mode 100644 index 00000000..0e380611 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAny.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A subrule using the 'any' operator. + */ +public class ConditionItemConditionSubRuleConditionSubRuleConditionAny extends ConditionItemConditionSubRule { + + + /** + * Builder. + */ + public static class Builder { + private SubRule any; + + /** + * Instantiates a new Builder from an existing ConditionItemConditionSubRuleConditionSubRuleConditionAny instance. + * + * @param conditionItemConditionSubRuleConditionSubRuleConditionAny the instance to initialize the Builder with + */ + public Builder(ConditionItemConditionSubRule conditionItemConditionSubRuleConditionSubRuleConditionAny) { + this.any = conditionItemConditionSubRuleConditionSubRuleConditionAny.any; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ConditionItemConditionSubRuleConditionSubRuleConditionAny. + * + * @return the new ConditionItemConditionSubRuleConditionSubRuleConditionAny instance + */ + public ConditionItemConditionSubRuleConditionSubRuleConditionAny build() { + return new ConditionItemConditionSubRuleConditionSubRuleConditionAny(this); + } + + /** + * Set the any. + * + * @param any the any + * @return the ConditionItemConditionSubRuleConditionSubRuleConditionAny builder + */ + public Builder any(SubRule any) { + this.any = any; + return this; + } + } + + protected ConditionItemConditionSubRuleConditionSubRuleConditionAny() { } + + protected ConditionItemConditionSubRuleConditionSubRuleConditionAny(Builder builder) { + any = builder.any; + } + + /** + * New builder. + * + * @return a ConditionItemConditionSubRuleConditionSubRuleConditionAny 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/ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf.java new file mode 100644 index 00000000..4f6e6ef3 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A subrule using the 'any_ifexists' operator. + */ +public class ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf extends ConditionItemConditionSubRule { + + + /** + * Builder. + */ + public static class Builder { + private SubRule anyIfexists; + + /** + * Instantiates a new Builder from an existing ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf instance. + * + * @param conditionItemConditionSubRuleConditionSubRuleConditionAnyIf the instance to initialize the Builder with + */ + public Builder(ConditionItemConditionSubRule conditionItemConditionSubRuleConditionSubRuleConditionAnyIf) { + this.anyIfexists = conditionItemConditionSubRuleConditionSubRuleConditionAnyIf.anyIfexists; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf. + * + * @return the new ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf instance + */ + public ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf build() { + return new ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf(this); + } + + /** + * Set the anyIfexists. + * + * @param anyIfexists the anyIfexists + * @return the ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf builder + */ + public Builder anyIfexists(SubRule anyIfexists) { + this.anyIfexists = anyIfexists; + return this; + } + } + + protected ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf() { } + + protected ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf(Builder builder) { + anyIfexists = builder.anyIfexists; + } + + /** + * New builder. + * + * @return a ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf 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/ConfigurationInformationPoints.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConfigurationInformationPoints.java new file mode 100644 index 00000000..55b8412e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConfigurationInformationPoints.java @@ -0,0 +1,52 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The service configuration information. + */ +public class ConfigurationInformationPoints extends GenericModel { + + protected String type; + protected List endpoints; + + protected ConfigurationInformationPoints() { } + + /** + * Gets the type. + * + * The information type. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the endpoints. + * + * The service configurations endpoints. + * + * @return the endpoints + */ + public List getEndpoints() { + return endpoints; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Control.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Control.java new file mode 100644 index 00000000..37131da3 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Control.java @@ -0,0 +1,159 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A technical, administrative, or physical safeguard designed to meet a set of defined security and privacy + * requirements. + */ +public class Control extends GenericModel { + + @SerializedName("control_name") + protected String controlName; + @SerializedName("control_id") + protected String controlId; + @SerializedName("control_description") + protected String controlDescription; + @SerializedName("control_category") + protected String controlCategory; + @SerializedName("control_parent") + protected String controlParent; + @SerializedName("control_severity") + protected String controlSeverity; + @SerializedName("control_tags") + protected List controlTags; + @SerializedName("control_specifications") + protected List controlSpecifications; + @SerializedName("control_docs") + protected ControlDoc controlDocs; + protected String status; + + protected Control() { } + + /** + * Gets the controlName. + * + * The ID of the control library that contains the profile. + * + * @return the controlName + */ + public String getControlName() { + return controlName; + } + + /** + * Gets the controlId. + * + * The control name. + * + * @return the controlId + */ + public String getControlId() { + return controlId; + } + + /** + * Gets the controlDescription. + * + * The control description. + * + * @return the controlDescription + */ + public String getControlDescription() { + return controlDescription; + } + + /** + * Gets the controlCategory. + * + * The association of the control. + * + * @return the controlCategory + */ + public String getControlCategory() { + return controlCategory; + } + + /** + * Gets the controlParent. + * + * The ID of the parent control. + * + * @return the controlParent + */ + public String getControlParent() { + return controlParent; + } + + /** + * Gets the controlSeverity. + * + * Details how important a control is should it fail. + * + * @return the controlSeverity + */ + public String getControlSeverity() { + return controlSeverity; + } + + /** + * Gets the controlTags. + * + * tags associated with a control. + * + * @return the controlTags + */ + public List getControlTags() { + return controlTags; + } + + /** + * Gets the controlSpecifications. + * + * List of control specifications associated with the control. + * + * @return the controlSpecifications + */ + public List getControlSpecifications() { + return controlSpecifications; + } + + /** + * Gets the controlDocs. + * + * References to a control documentation. + * + * @return the controlDocs + */ + public ControlDoc getControlDocs() { + return controlDocs; + } + + /** + * Gets the status. + * + * Determines if a control will be evaluated or not. + * + * @return the status + */ + public String getStatus() { + return status; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChanges.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChanges.java new file mode 100644 index 00000000..7679c015 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChanges.java @@ -0,0 +1,104 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Shows details of the controls that were changed. + */ +public class ControlChanges extends GenericModel { + + @SerializedName("total_added") + protected Long totalAdded; + @SerializedName("total_removed") + protected Long totalRemoved; + @SerializedName("total_updated") + protected Long totalUpdated; + protected List added; + protected List removed; + protected List updated; + + protected ControlChanges() { } + + /** + * Gets the totalAdded. + * + * How many controls were added. + * + * @return the totalAdded + */ + public Long getTotalAdded() { + return totalAdded; + } + + /** + * Gets the totalRemoved. + * + * How many controls were removed. + * + * @return the totalRemoved + */ + public Long getTotalRemoved() { + return totalRemoved; + } + + /** + * Gets the totalUpdated. + * + * How many controls were updated. + * + * @return the totalUpdated + */ + public Long getTotalUpdated() { + return totalUpdated; + } + + /** + * Gets the added. + * + * A list of controls that were added. + * + * @return the added + */ + public List getAdded() { + return added; + } + + /** + * Gets the removed. + * + * A list of controls that were removed. + * + * @return the removed + */ + public List getRemoved() { + return removed; + } + + /** + * Gets the updated. + * + * A list of controls that were updated. + * + * @return the updated + */ + public List getUpdated() { + return updated; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesUpdated.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesUpdated.java new file mode 100644 index 00000000..d62f19c5 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesUpdated.java @@ -0,0 +1,50 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * Shows the difference in the Controls. + */ +public class ControlChangesUpdated extends GenericModel { + + protected ProfileControls current; + protected ProfileControls latest; + + protected ControlChangesUpdated() { } + + /** + * Gets the current. + * + * The control details for a profile. + * + * @return the current + */ + public ProfileControls getCurrent() { + return current; + } + + /** + * Gets the latest. + * + * The control details for a profile. + * + * @return the latest + */ + public ProfileControls getLatest() { + return latest; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlDoc.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlDoc.java new file mode 100644 index 00000000..816f2f63 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlDoc.java @@ -0,0 +1,122 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * References to a control documentation. + */ +public class ControlDoc extends GenericModel { + + @SerializedName("control_docs_id") + protected String controlDocsId; + @SerializedName("control_docs_type") + protected String controlDocsType; + + /** + * Builder. + */ + public static class Builder { + private String controlDocsId; + private String controlDocsType; + + /** + * Instantiates a new Builder from an existing ControlDoc instance. + * + * @param controlDoc the instance to initialize the Builder with + */ + private Builder(ControlDoc controlDoc) { + this.controlDocsId = controlDoc.controlDocsId; + this.controlDocsType = controlDoc.controlDocsType; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ControlDoc. + * + * @return the new ControlDoc instance + */ + public ControlDoc build() { + return new ControlDoc(this); + } + + /** + * Set the controlDocsId. + * + * @param controlDocsId the controlDocsId + * @return the ControlDoc builder + */ + public Builder controlDocsId(String controlDocsId) { + this.controlDocsId = controlDocsId; + return this; + } + + /** + * Set the controlDocsType. + * + * @param controlDocsType the controlDocsType + * @return the ControlDoc builder + */ + public Builder controlDocsType(String controlDocsType) { + this.controlDocsType = controlDocsType; + return this; + } + } + + protected ControlDoc() { } + + protected ControlDoc(Builder builder) { + controlDocsId = builder.controlDocsId; + controlDocsType = builder.controlDocsType; + } + + /** + * New builder. + * + * @return a ControlDoc builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the controlDocsId. + * + * The ID of the control doc. + * + * @return the controlDocsId + */ + public String controlDocsId() { + return controlDocsId; + } + + /** + * Gets the controlDocsType. + * + * The type of the control doc. + * + * @return the controlDocsType + */ + public String controlDocsType() { + return controlDocsType; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibrariesPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibrariesPager.java index 5280dcae..c77c718d 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibrariesPager.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibrariesPager.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; @@ -65,9 +66,9 @@ public boolean hasNext() { /** * Returns the next page of results. - * @return a List<ControlLibraryItem> that contains the next page of results + * @return a List<ControlLibrary> that contains the next page of results */ - public List getNext() { + public List getNext() { if (!hasNext()) { throw new NoSuchElementException("No more results available"); } @@ -94,12 +95,12 @@ public List getNext() { /** * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ControlLibraryItem> containing all results returned by the "listControlLibraries" method + * @return a List<ControlLibrary> containing all results returned by the "listControlLibraries" method */ - public List getAll() { - List results = new ArrayList<>(); + public List getAll() { + List results = new ArrayList<>(); while (hasNext()) { - List nextPage = getNext(); + List nextPage = getNext(); results.addAll(nextPage); } return results; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibrary.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibrary.java index 6318b945..11f69562 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibrary.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibrary.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,9 +10,9 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; import java.util.List; @@ -20,508 +20,226 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The request payload of the control library. + * A Control Library. */ public class ControlLibrary extends GenericModel { /** - * The control library type. + * Details that the control library is a user made(custom) or Security Compliance Center(predefined). */ public interface ControlLibraryType { - /** predefined. */ - String PREDEFINED = "predefined"; /** custom. */ String CUSTOM = "custom"; + /** predefined. */ + String PREDEFINED = "predefined"; } - protected String id; - @SerializedName("account_id") - protected String accountId; @SerializedName("control_library_name") protected String controlLibraryName; @SerializedName("control_library_description") protected String controlLibraryDescription; @SerializedName("control_library_type") protected String controlLibraryType; - @SerializedName("version_group_label") - protected String versionGroupLabel; @SerializedName("control_library_version") protected String controlLibraryVersion; - @SerializedName("created_on") - protected Date createdOn; + protected List controls; + protected String id; + @SerializedName("account_id") + protected String accountId; + @SerializedName("version_group_label") + protected String versionGroupLabel; + protected Boolean latest; @SerializedName("created_by") protected String createdBy; - @SerializedName("updated_on") - protected Date updatedOn; + @SerializedName("created_on") + protected Date createdOn; @SerializedName("updated_by") protected String updatedBy; - protected Boolean latest; + @SerializedName("updated_on") + protected Date updatedOn; @SerializedName("hierarchy_enabled") protected Boolean hierarchyEnabled; @SerializedName("controls_count") protected Long controlsCount; @SerializedName("control_parents_count") protected Long controlParentsCount; - protected List controls; - - /** - * Builder. - */ - public static class Builder { - private String id; - private String accountId; - private String controlLibraryName; - private String controlLibraryDescription; - private String controlLibraryType; - private String versionGroupLabel; - private String controlLibraryVersion; - private Date createdOn; - private String createdBy; - private Date updatedOn; - private String updatedBy; - private Boolean latest; - private Boolean hierarchyEnabled; - private Long controlsCount; - private Long controlParentsCount; - private List controls; - - /** - * Instantiates a new Builder from an existing ControlLibrary instance. - * - * @param controlLibrary the instance to initialize the Builder with - */ - private Builder(ControlLibrary controlLibrary) { - this.id = controlLibrary.id; - this.accountId = controlLibrary.accountId; - this.controlLibraryName = controlLibrary.controlLibraryName; - this.controlLibraryDescription = controlLibrary.controlLibraryDescription; - this.controlLibraryType = controlLibrary.controlLibraryType; - this.versionGroupLabel = controlLibrary.versionGroupLabel; - this.controlLibraryVersion = controlLibrary.controlLibraryVersion; - this.createdOn = controlLibrary.createdOn; - this.createdBy = controlLibrary.createdBy; - this.updatedOn = controlLibrary.updatedOn; - this.updatedBy = controlLibrary.updatedBy; - this.latest = controlLibrary.latest; - this.hierarchyEnabled = controlLibrary.hierarchyEnabled; - this.controlsCount = controlLibrary.controlsCount; - this.controlParentsCount = controlLibrary.controlParentsCount; - this.controls = controlLibrary.controls; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ControlLibrary. - * - * @return the new ControlLibrary instance - */ - public ControlLibrary build() { - return new ControlLibrary(this); - } - - /** - * Adds an controls to controls. - * - * @param controls the new controls - * @return the ControlLibrary builder - */ - public Builder addControls(ControlsInControlLib controls) { - com.ibm.cloud.sdk.core.util.Validator.notNull(controls, - "controls cannot be null"); - if (this.controls == null) { - this.controls = new ArrayList(); - } - this.controls.add(controls); - return this; - } - - /** - * Set the id. - * - * @param id the id - * @return the ControlLibrary builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ControlLibrary builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Set the controlLibraryName. - * - * @param controlLibraryName the controlLibraryName - * @return the ControlLibrary builder - */ - public Builder controlLibraryName(String controlLibraryName) { - this.controlLibraryName = controlLibraryName; - return this; - } - - /** - * Set the controlLibraryDescription. - * - * @param controlLibraryDescription the controlLibraryDescription - * @return the ControlLibrary builder - */ - public Builder controlLibraryDescription(String controlLibraryDescription) { - this.controlLibraryDescription = controlLibraryDescription; - return this; - } - - /** - * Set the controlLibraryType. - * - * @param controlLibraryType the controlLibraryType - * @return the ControlLibrary builder - */ - public Builder controlLibraryType(String controlLibraryType) { - this.controlLibraryType = controlLibraryType; - return this; - } - - /** - * Set the versionGroupLabel. - * - * @param versionGroupLabel the versionGroupLabel - * @return the ControlLibrary builder - */ - public Builder versionGroupLabel(String versionGroupLabel) { - this.versionGroupLabel = versionGroupLabel; - return this; - } - - /** - * Set the controlLibraryVersion. - * - * @param controlLibraryVersion the controlLibraryVersion - * @return the ControlLibrary builder - */ - public Builder controlLibraryVersion(String controlLibraryVersion) { - this.controlLibraryVersion = controlLibraryVersion; - return this; - } - - /** - * Set the createdOn. - * - * @param createdOn the createdOn - * @return the ControlLibrary builder - */ - public Builder createdOn(Date createdOn) { - this.createdOn = createdOn; - return this; - } - - /** - * Set the createdBy. - * - * @param createdBy the createdBy - * @return the ControlLibrary builder - */ - public Builder createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - * Set the updatedOn. - * - * @param updatedOn the updatedOn - * @return the ControlLibrary builder - */ - public Builder updatedOn(Date updatedOn) { - this.updatedOn = updatedOn; - return this; - } - - /** - * Set the updatedBy. - * - * @param updatedBy the updatedBy - * @return the ControlLibrary builder - */ - public Builder updatedBy(String updatedBy) { - this.updatedBy = updatedBy; - return this; - } - - /** - * Set the latest. - * - * @param latest the latest - * @return the ControlLibrary builder - */ - public Builder latest(Boolean latest) { - this.latest = latest; - return this; - } - - /** - * Set the hierarchyEnabled. - * - * @param hierarchyEnabled the hierarchyEnabled - * @return the ControlLibrary builder - */ - public Builder hierarchyEnabled(Boolean hierarchyEnabled) { - this.hierarchyEnabled = hierarchyEnabled; - return this; - } - - /** - * Set the controlsCount. - * - * @param controlsCount the controlsCount - * @return the ControlLibrary builder - */ - public Builder controlsCount(long controlsCount) { - this.controlsCount = controlsCount; - return this; - } - - /** - * Set the controlParentsCount. - * - * @param controlParentsCount the controlParentsCount - * @return the ControlLibrary builder - */ - public Builder controlParentsCount(long controlParentsCount) { - this.controlParentsCount = controlParentsCount; - return this; - } - - /** - * Set the controls. - * Existing controls will be replaced. - * - * @param controls the controls - * @return the ControlLibrary builder - */ - public Builder controls(List controls) { - this.controls = controls; - return this; - } - } protected ControlLibrary() { } - protected ControlLibrary(Builder builder) { - id = builder.id; - accountId = builder.accountId; - controlLibraryName = builder.controlLibraryName; - controlLibraryDescription = builder.controlLibraryDescription; - controlLibraryType = builder.controlLibraryType; - versionGroupLabel = builder.versionGroupLabel; - controlLibraryVersion = builder.controlLibraryVersion; - createdOn = builder.createdOn; - createdBy = builder.createdBy; - updatedOn = builder.updatedOn; - updatedBy = builder.updatedBy; - latest = builder.latest; - hierarchyEnabled = builder.hierarchyEnabled; - controlsCount = builder.controlsCount; - controlParentsCount = builder.controlParentsCount; - controls = builder.controls; - } - /** - * New builder. + * Gets the controlLibraryName. + * + * The name of the control library. * - * @return a ControlLibrary builder + * @return the controlLibraryName */ - public Builder newBuilder() { - return new Builder(this); + public String getControlLibraryName() { + return controlLibraryName; } /** - * Gets the id. + * Gets the controlLibraryDescription. * - * The control library ID. + * Details of the control library. * - * @return the id + * @return the controlLibraryDescription */ - public String id() { - return id; + public String getControlLibraryDescription() { + return controlLibraryDescription; } /** - * Gets the accountId. + * Gets the controlLibraryType. * - * The account ID. + * Details that the control library is a user made(custom) or Security Compliance Center(predefined). * - * @return the accountId + * @return the controlLibraryType */ - public String accountId() { - return accountId; + public String getControlLibraryType() { + return controlLibraryType; } /** - * Gets the controlLibraryName. + * Gets the controlLibraryVersion. * - * The control library name. + * The revision number of the control library. * - * @return the controlLibraryName + * @return the controlLibraryVersion */ - public String controlLibraryName() { - return controlLibraryName; + public String getControlLibraryVersion() { + return controlLibraryVersion; } /** - * Gets the controlLibraryDescription. + * Gets the controls. * - * The control library description. + * The list of rules that the control library attempts to adhere to. * - * @return the controlLibraryDescription + * @return the controls */ - public String controlLibraryDescription() { - return controlLibraryDescription; + public List getControls() { + return controls; } /** - * Gets the controlLibraryType. + * Gets the id. * - * The control library type. + * The ID of the control library. * - * @return the controlLibraryType + * @return the id */ - public String controlLibraryType() { - return controlLibraryType; + public String getId() { + return id; } /** - * Gets the versionGroupLabel. + * Gets the accountId. * - * The version group label. + * The ID of the account associated with the creation of the control library. * - * @return the versionGroupLabel + * @return the accountId */ - public String versionGroupLabel() { - return versionGroupLabel; + public String getAccountId() { + return accountId; } /** - * Gets the controlLibraryVersion. + * Gets the versionGroupLabel. * - * The control library version. + * The ETag or version of the Control Library. * - * @return the controlLibraryVersion + * @return the versionGroupLabel */ - public String controlLibraryVersion() { - return controlLibraryVersion; + public String getVersionGroupLabel() { + return versionGroupLabel; } /** - * Gets the createdOn. + * Gets the latest. * - * The date when the control library was created. + * Shows if the Control Library is the latest. * - * @return the createdOn + * @return the latest */ - public Date createdOn() { - return createdOn; + public Boolean isLatest() { + return latest; } /** * Gets the createdBy. * - * The user who created the control library. + * The ID of the creator of the Control Library. * * @return the createdBy */ - public String createdBy() { + public String getCreatedBy() { return createdBy; } /** - * Gets the updatedOn. + * Gets the createdOn. * - * The date when the control library was updated. + * The date-time of the creation. * - * @return the updatedOn + * @return the createdOn */ - public Date updatedOn() { - return updatedOn; + public Date getCreatedOn() { + return createdOn; } /** * Gets the updatedBy. * - * The user who updated the control library. + * The ID of the user who made the last update. * * @return the updatedBy */ - public String updatedBy() { + public String getUpdatedBy() { return updatedBy; } /** - * Gets the latest. + * Gets the updatedOn. * - * The latest version of the control library. + * The date-time of the update. * - * @return the latest + * @return the updatedOn */ - public Boolean latest() { - return latest; + public Date getUpdatedOn() { + return updatedOn; } /** * Gets the hierarchyEnabled. * - * The indication of whether hierarchy is enabled for the control library. + * Determines if the control library has any hierarchy. * * @return the hierarchyEnabled */ - public Boolean hierarchyEnabled() { + public Boolean isHierarchyEnabled() { return hierarchyEnabled; } /** * Gets the controlsCount. * - * The number of controls. + * The count of controls tied to the control library. * * @return the controlsCount */ - public Long controlsCount() { + public Long getControlsCount() { return controlsCount; } /** * Gets the controlParentsCount. * - * The number of parent controls in the control library. + * THe count of control parents in the control library. * * @return the controlParentsCount */ - public Long controlParentsCount() { + public Long getControlParentsCount() { return controlParentsCount; } - - /** - * Gets the controls. - * - * The list of controls in a control library. - * - * @return the controls - */ - public List controls() { - return controls; - } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryCollection.java index 45b1df7c..4dea9d88 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryCollection.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryCollection.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -18,72 +19,72 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The response body of control libraries. + * A list of ControlLibrary. */ public class ControlLibraryCollection extends GenericModel { + protected Long limit; @SerializedName("total_count") protected Long totalCount; - protected Long limit; - protected PaginatedCollectionFirst first; - protected PaginatedCollectionNext next; + protected PageHRefFirst first; + protected PageHRefNext next; @SerializedName("control_libraries") - protected List controlLibraries; + protected List controlLibraries; protected ControlLibraryCollection() { } /** - * Gets the totalCount. + * Gets the limit. * - * The number of control libraries. + * The requested page limit. * - * @return the totalCount + * @return the limit */ - public Long getTotalCount() { - return totalCount; + public Long getLimit() { + return limit; } /** - * Gets the limit. + * Gets the totalCount. * - * limit. + * The total number of resources that are in the collection. * - * @return the limit + * @return the totalCount */ - public Long getLimit() { - return limit; + public Long getTotalCount() { + return totalCount; } /** * Gets the first. * - * The reference to the first page of entries. + * A page reference. * * @return the first */ - public PaginatedCollectionFirst getFirst() { + public PageHRefFirst getFirst() { return first; } /** * Gets the next. * - * The reference URL for the next few entries. + * A page reference. * * @return the next */ - public PaginatedCollectionNext getNext() { + public PageHRefNext getNext() { return next; } /** * Gets the controlLibraries. * - * The control libraries. + * The list of control libraries. * * @return the controlLibraries */ - public List getControlLibraries() { + public List getControlLibraries() { return controlLibraries; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlPrototype.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlPrototype.java new file mode 100644 index 00000000..b23e71fc --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlPrototype.java @@ -0,0 +1,330 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 payload to instantiate a control. + */ +public class ControlPrototype extends GenericModel { + + @SerializedName("control_name") + protected String controlName; + @SerializedName("control_description") + protected String controlDescription; + @SerializedName("control_category") + protected String controlCategory; + @SerializedName("control_requirement") + protected Boolean controlRequirement; + @SerializedName("control_parent") + protected String controlParent; + @SerializedName("control_specifications") + protected List controlSpecifications; + @SerializedName("control_docs") + protected ControlDoc controlDocs; + protected String status; + + /** + * Builder. + */ + public static class Builder { + private String controlName; + private String controlDescription; + private String controlCategory; + private Boolean controlRequirement; + private String controlParent; + private List controlSpecifications; + private ControlDoc controlDocs; + private String status; + + /** + * Instantiates a new Builder from an existing ControlPrototype instance. + * + * @param controlPrototype the instance to initialize the Builder with + */ + private Builder(ControlPrototype controlPrototype) { + this.controlName = controlPrototype.controlName; + this.controlDescription = controlPrototype.controlDescription; + this.controlCategory = controlPrototype.controlCategory; + this.controlRequirement = controlPrototype.controlRequirement; + this.controlParent = controlPrototype.controlParent; + this.controlSpecifications = controlPrototype.controlSpecifications; + this.controlDocs = controlPrototype.controlDocs; + this.status = controlPrototype.status; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param controlName the controlName + * @param controlDescription the controlDescription + * @param controlCategory the controlCategory + * @param controlRequirement the controlRequirement + * @param controlSpecifications the controlSpecifications + */ + public Builder(String controlName, String controlDescription, String controlCategory, Boolean controlRequirement, List controlSpecifications) { + this.controlName = controlName; + this.controlDescription = controlDescription; + this.controlCategory = controlCategory; + this.controlRequirement = controlRequirement; + this.controlSpecifications = controlSpecifications; + } + + /** + * Builds a ControlPrototype. + * + * @return the new ControlPrototype instance + */ + public ControlPrototype build() { + return new ControlPrototype(this); + } + + /** + * Adds a new element to controlSpecifications. + * + * @param controlSpecifications the new element to be added + * @return the ControlPrototype builder + */ + public Builder addControlSpecifications(ControlSpecificationPrototype controlSpecifications) { + com.ibm.cloud.sdk.core.util.Validator.notNull(controlSpecifications, + "controlSpecifications cannot be null"); + if (this.controlSpecifications == null) { + this.controlSpecifications = new ArrayList(); + } + this.controlSpecifications.add(controlSpecifications); + return this; + } + + /** + * Set the controlName. + * + * @param controlName the controlName + * @return the ControlPrototype builder + */ + public Builder controlName(String controlName) { + this.controlName = controlName; + return this; + } + + /** + * Set the controlDescription. + * + * @param controlDescription the controlDescription + * @return the ControlPrototype builder + */ + public Builder controlDescription(String controlDescription) { + this.controlDescription = controlDescription; + return this; + } + + /** + * Set the controlCategory. + * + * @param controlCategory the controlCategory + * @return the ControlPrototype builder + */ + public Builder controlCategory(String controlCategory) { + this.controlCategory = controlCategory; + return this; + } + + /** + * Set the controlRequirement. + * + * @param controlRequirement the controlRequirement + * @return the ControlPrototype builder + */ + public Builder controlRequirement(Boolean controlRequirement) { + this.controlRequirement = controlRequirement; + return this; + } + + /** + * Set the controlParent. + * + * @param controlParent the controlParent + * @return the ControlPrototype builder + */ + public Builder controlParent(String controlParent) { + this.controlParent = controlParent; + return this; + } + + /** + * Set the controlSpecifications. + * Existing controlSpecifications will be replaced. + * + * @param controlSpecifications the controlSpecifications + * @return the ControlPrototype builder + */ + public Builder controlSpecifications(List controlSpecifications) { + this.controlSpecifications = controlSpecifications; + return this; + } + + /** + * Set the controlDocs. + * + * @param controlDocs the controlDocs + * @return the ControlPrototype builder + */ + public Builder controlDocs(ControlDoc controlDocs) { + this.controlDocs = controlDocs; + return this; + } + + /** + * Set the status. + * + * @param status the status + * @return the ControlPrototype builder + */ + public Builder status(String status) { + this.status = status; + return this; + } + } + + protected ControlPrototype() { } + + protected ControlPrototype(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlName, + "controlName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlDescription, + "controlDescription cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlCategory, + "controlCategory cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlRequirement, + "controlRequirement cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlSpecifications, + "controlSpecifications cannot be null"); + controlName = builder.controlName; + controlDescription = builder.controlDescription; + controlCategory = builder.controlCategory; + controlRequirement = builder.controlRequirement; + controlParent = builder.controlParent; + controlSpecifications = builder.controlSpecifications; + controlDocs = builder.controlDocs; + status = builder.status; + } + + /** + * New builder. + * + * @return a ControlPrototype builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the controlName. + * + * The ID of the control library that contains the profile. + * + * @return the controlName + */ + public String controlName() { + return controlName; + } + + /** + * Gets the controlDescription. + * + * The control description. + * + * @return the controlDescription + */ + public String controlDescription() { + return controlDescription; + } + + /** + * Gets the controlCategory. + * + * The association of the control. + * + * @return the controlCategory + */ + public String controlCategory() { + return controlCategory; + } + + /** + * Gets the controlRequirement. + * + * true if the control can be automated, false if the control cannot. + * + * @return the controlRequirement + */ + public Boolean controlRequirement() { + return controlRequirement; + } + + /** + * Gets the controlParent. + * + * The ID of the parent control. + * + * @return the controlParent + */ + public String controlParent() { + return controlParent; + } + + /** + * Gets the controlSpecifications. + * + * List of control specifications associated with the control. + * + * @return the controlSpecifications + */ + public List controlSpecifications() { + return controlSpecifications; + } + + /** + * Gets the controlDocs. + * + * References to a control documentation. + * + * @return the controlDocs + */ + public ControlDoc controlDocs() { + return controlDocs; + } + + /** + * Gets the status. + * + * Details if a control library can be used or not. + * + * @return the status + */ + public String status() { + return status; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecification.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecification.java new file mode 100644 index 00000000..c53d7bf7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecification.java @@ -0,0 +1,337 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A statement that defines a security/privacy requirement for a Control. + */ +public class ControlSpecification extends GenericModel { + + protected String id; + protected String responsibility; + @SerializedName("component_id") + protected String componentId; + @SerializedName("component_name") + protected String componentName; + @SerializedName("component_type") + protected String componentType; + protected String environment; + protected String description; + @SerializedName("assessments_count") + protected Long assessmentsCount; + protected List assessments; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String responsibility; + private String componentId; + private String componentName; + private String componentType; + private String environment; + private String description; + private Long assessmentsCount; + private List assessments; + + /** + * Instantiates a new Builder from an existing ControlSpecification instance. + * + * @param controlSpecification the instance to initialize the Builder with + */ + private Builder(ControlSpecification controlSpecification) { + this.id = controlSpecification.id; + this.responsibility = controlSpecification.responsibility; + this.componentId = controlSpecification.componentId; + this.componentName = controlSpecification.componentName; + this.componentType = controlSpecification.componentType; + this.environment = controlSpecification.environment; + this.description = controlSpecification.description; + this.assessmentsCount = controlSpecification.assessmentsCount; + this.assessments = controlSpecification.assessments; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param assessments the assessments + */ + public Builder(List assessments) { + this.assessments = assessments; + } + + /** + * Builds a ControlSpecification. + * + * @return the new ControlSpecification instance + */ + public ControlSpecification build() { + return new ControlSpecification(this); + } + + /** + * Adds a new element to assessments. + * + * @param assessments the new element to be added + * @return the ControlSpecification builder + */ + public Builder addAssessments(Assessment assessments) { + com.ibm.cloud.sdk.core.util.Validator.notNull(assessments, + "assessments cannot be null"); + if (this.assessments == null) { + this.assessments = new ArrayList(); + } + this.assessments.add(assessments); + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the ControlSpecification builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the responsibility. + * + * @param responsibility the responsibility + * @return the ControlSpecification builder + */ + public Builder responsibility(String responsibility) { + this.responsibility = responsibility; + return this; + } + + /** + * Set the componentId. + * + * @param componentId the componentId + * @return the ControlSpecification builder + */ + public Builder componentId(String componentId) { + this.componentId = componentId; + return this; + } + + /** + * Set the componentName. + * + * @param componentName the componentName + * @return the ControlSpecification builder + */ + public Builder componentName(String componentName) { + this.componentName = componentName; + return this; + } + + /** + * Set the componentType. + * + * @param componentType the componentType + * @return the ControlSpecification builder + */ + public Builder componentType(String componentType) { + this.componentType = componentType; + return this; + } + + /** + * Set the environment. + * + * @param environment the environment + * @return the ControlSpecification builder + */ + public Builder environment(String environment) { + this.environment = environment; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ControlSpecification builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the assessmentsCount. + * + * @param assessmentsCount the assessmentsCount + * @return the ControlSpecification builder + */ + public Builder assessmentsCount(long assessmentsCount) { + this.assessmentsCount = assessmentsCount; + return this; + } + + /** + * Set the assessments. + * Existing assessments will be replaced. + * + * @param assessments the assessments + * @return the ControlSpecification builder + */ + public Builder assessments(List assessments) { + this.assessments = assessments; + return this; + } + } + + protected ControlSpecification() { } + + protected ControlSpecification(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.assessments, + "assessments cannot be null"); + id = builder.id; + responsibility = builder.responsibility; + componentId = builder.componentId; + componentName = builder.componentName; + componentType = builder.componentType; + environment = builder.environment; + description = builder.description; + assessmentsCount = builder.assessmentsCount; + assessments = builder.assessments; + } + + /** + * New builder. + * + * @return a ControlSpecification builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The ID of the control. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the responsibility. + * + * Details which party is responsible for the implementation of a specification. + * + * @return the responsibility + */ + public String responsibility() { + return responsibility; + } + + /** + * Gets the componentId. + * + * The ID of the component. + * + * @return the componentId + */ + public String componentId() { + return componentId; + } + + /** + * Gets the componentName. + * + * The name of the component. + * + * @return the componentName + */ + public String componentName() { + return componentName; + } + + /** + * Gets the componentType. + * + * The type of component that will use the specification. + * + * @return the componentType + */ + public String componentType() { + return componentType; + } + + /** + * Gets the environment. + * + * The cloud provider the specification is targeting. + * + * @return the environment + */ + public String environment() { + return environment; + } + + /** + * Gets the description. + * + * Information about the Control Specification. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the assessmentsCount. + * + * The number of rules tied to the specification. + * + * @return the assessmentsCount + */ + public Long assessmentsCount() { + return assessmentsCount; + } + + /** + * Gets the assessments. + * + * The detailed list of rules associated with the Specification. + * + * @return the assessments + */ + public List assessments() { + return assessments; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationPrototype.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationPrototype.java new file mode 100644 index 00000000..738de2aa --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationPrototype.java @@ -0,0 +1,229 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 necessary fields to instantiate a Control Specification. + */ +public class ControlSpecificationPrototype extends GenericModel { + + /** + * The cloud provider the specification is targeting. + */ + public interface Environment { + /** ibm-cloud. */ + String IBM_CLOUD = "ibm-cloud"; + } + + @SerializedName("component_id") + protected String componentId; + protected String environment; + @SerializedName("control_specification_id") + protected String controlSpecificationId; + @SerializedName("control_specification_description") + protected String controlSpecificationDescription; + protected List assessments; + + /** + * Builder. + */ + public static class Builder { + private String componentId; + private String environment; + private String controlSpecificationId; + private String controlSpecificationDescription; + private List assessments; + + /** + * Instantiates a new Builder from an existing ControlSpecificationPrototype instance. + * + * @param controlSpecificationPrototype the instance to initialize the Builder with + */ + private Builder(ControlSpecificationPrototype controlSpecificationPrototype) { + this.componentId = controlSpecificationPrototype.componentId; + this.environment = controlSpecificationPrototype.environment; + this.controlSpecificationId = controlSpecificationPrototype.controlSpecificationId; + this.controlSpecificationDescription = controlSpecificationPrototype.controlSpecificationDescription; + this.assessments = controlSpecificationPrototype.assessments; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ControlSpecificationPrototype. + * + * @return the new ControlSpecificationPrototype instance + */ + public ControlSpecificationPrototype build() { + return new ControlSpecificationPrototype(this); + } + + /** + * Adds a new element to assessments. + * + * @param assessments the new element to be added + * @return the ControlSpecificationPrototype builder + */ + public Builder addAssessments(AssessmentPrototype assessments) { + com.ibm.cloud.sdk.core.util.Validator.notNull(assessments, + "assessments cannot be null"); + if (this.assessments == null) { + this.assessments = new ArrayList(); + } + this.assessments.add(assessments); + return this; + } + + /** + * Set the componentId. + * + * @param componentId the componentId + * @return the ControlSpecificationPrototype builder + */ + public Builder componentId(String componentId) { + this.componentId = componentId; + return this; + } + + /** + * Set the environment. + * + * @param environment the environment + * @return the ControlSpecificationPrototype builder + */ + public Builder environment(String environment) { + this.environment = environment; + return this; + } + + /** + * Set the controlSpecificationId. + * + * @param controlSpecificationId the controlSpecificationId + * @return the ControlSpecificationPrototype builder + */ + public Builder controlSpecificationId(String controlSpecificationId) { + this.controlSpecificationId = controlSpecificationId; + return this; + } + + /** + * Set the controlSpecificationDescription. + * + * @param controlSpecificationDescription the controlSpecificationDescription + * @return the ControlSpecificationPrototype builder + */ + public Builder controlSpecificationDescription(String controlSpecificationDescription) { + this.controlSpecificationDescription = controlSpecificationDescription; + return this; + } + + /** + * Set the assessments. + * Existing assessments will be replaced. + * + * @param assessments the assessments + * @return the ControlSpecificationPrototype builder + */ + public Builder assessments(List assessments) { + this.assessments = assessments; + return this; + } + } + + protected ControlSpecificationPrototype() { } + + protected ControlSpecificationPrototype(Builder builder) { + componentId = builder.componentId; + environment = builder.environment; + controlSpecificationId = builder.controlSpecificationId; + controlSpecificationDescription = builder.controlSpecificationDescription; + assessments = builder.assessments; + } + + /** + * New builder. + * + * @return a ControlSpecificationPrototype builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the componentId. + * + * The ID of the component. The component_id can be found from the 'service_name' using the Get Services method. + * + * @return the componentId + */ + public String componentId() { + return componentId; + } + + /** + * Gets the environment. + * + * The cloud provider the specification is targeting. + * + * @return the environment + */ + public String environment() { + return environment; + } + + /** + * Gets the controlSpecificationId. + * + * The ID of the control specification to give when creating the control_specification. + * + * @return the controlSpecificationId + */ + public String controlSpecificationId() { + return controlSpecificationId; + } + + /** + * Gets the controlSpecificationDescription. + * + * Information about the Control Specification. + * + * @return the controlSpecificationDescription + */ + public String controlSpecificationDescription() { + return controlSpecificationDescription; + } + + /** + * Gets the assessments. + * + * The detailed list of rules associated with the Specification. + * + * @return the assessments + */ + public List assessments() { + return assessments; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationWithStats.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationWithStats.java index 2f6fd59f..fdac0a60 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationWithStats.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationWithStats.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -34,17 +35,21 @@ public interface Status { String UNABLE_TO_PERFORM = "unable_to_perform"; /** user_evaluation_required. */ String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; } @SerializedName("control_specification_id") protected String controlSpecificationId; - @SerializedName("component_id") - protected String componentId; @SerializedName("control_specification_description") protected String controlSpecificationDescription; + @SerializedName("component_id") + protected String componentId; + @SerializedName("component_name") + protected String componentName; protected String environment; protected String responsibility; - protected List assessments; + protected List assessments; protected String status; @SerializedName("total_count") protected Long totalCount; @@ -56,6 +61,8 @@ public interface Status { protected Long unableToPerformCount; @SerializedName("user_evaluation_required_count") protected Long userEvaluationRequiredCount; + @SerializedName("not_applicable_count") + protected Long notApplicableCount; protected ControlSpecificationWithStats() { } @@ -70,6 +77,17 @@ public String getControlSpecificationId() { return controlSpecificationId; } + /** + * Gets the controlSpecificationDescription. + * + * The component description. + * + * @return the controlSpecificationDescription + */ + public String getControlSpecificationDescription() { + return controlSpecificationDescription; + } + /** * Gets the componentId. * @@ -82,14 +100,14 @@ public String getComponentId() { } /** - * Gets the controlSpecificationDescription. + * Gets the componentName. * - * The component description. + * The components name. * - * @return the controlSpecificationDescription + * @return the componentName */ - public String getControlSpecificationDescription() { - return controlSpecificationDescription; + public String getComponentName() { + return componentName; } /** @@ -121,7 +139,7 @@ public String getResponsibility() { * * @return the assessments */ - public List getAssessments() { + public List getAssessments() { return assessments; } @@ -190,5 +208,16 @@ public Long getUnableToPerformCount() { public Long getUserEvaluationRequiredCount() { return userEvaluationRequiredCount; } + + /** + * Gets the notApplicableCount. + * + * The number of not applicable (with no evaluations) checks. + * + * @return the notApplicableCount + */ + public Long getNotApplicableCount() { + return notApplicableCount; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSummary.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSummary.java new file mode 100644 index 00000000..3202e665 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSummary.java @@ -0,0 +1,65 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The summary of the control. + */ +public class ControlSummary extends GenericModel { + + protected String id; + @SerializedName("control_name") + protected String controlName; + @SerializedName("control_description") + protected String controlDescription; + + protected ControlSummary() { } + + /** + * Gets the id. + * + * The controls ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the controlName. + * + * The controls name. + * + * @return the controlName + */ + public String getControlName() { + return controlName; + } + + /** + * Gets the controlDescription. + * + * The controls description. + * + * @return the controlDescription + */ + public String getControlDescription() { + return controlDescription; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlWithStats.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlWithStats.java index 40281437..94341212 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlWithStats.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlWithStats.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -34,8 +35,14 @@ public interface Status { String UNABLE_TO_PERFORM = "unable_to_perform"; /** user_evaluation_required. */ String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; } + @SerializedName("report_id") + protected String reportId; + @SerializedName("home_account_id") + protected String homeAccountId; protected String id; @SerializedName("control_library_id") protected String controlLibraryId; @@ -47,10 +54,10 @@ public interface Status { protected String controlDescription; @SerializedName("control_category") protected String controlCategory; - @SerializedName("control_path") - protected String controlPath; @SerializedName("control_specifications") protected List controlSpecifications; + @SerializedName("resource_tags") + protected Tags resourceTags; protected String status; @SerializedName("total_count") protected Long totalCount; @@ -62,9 +69,33 @@ public interface Status { protected Long unableToPerformCount; @SerializedName("user_evaluation_required_count") protected Long userEvaluationRequiredCount; + @SerializedName("not_applicable_count") + protected Long notApplicableCount; protected ControlWithStats() { } + /** + * Gets the reportId. + * + * The report ID. + * + * @return the reportId + */ + public String getReportId() { + return reportId; + } + + /** + * Gets the homeAccountId. + * + * The home account ID. + * + * @return the homeAccountId + */ + public String getHomeAccountId() { + return homeAccountId; + } + /** * Gets the id. * @@ -132,25 +163,25 @@ public String getControlCategory() { } /** - * Gets the controlPath. + * Gets the controlSpecifications. * - * The control path. + * The list of specifications that are on the page. * - * @return the controlPath + * @return the controlSpecifications */ - public String getControlPath() { - return controlPath; + public List getControlSpecifications() { + return controlSpecifications; } /** - * Gets the controlSpecifications. + * Gets the resourceTags. * - * The list of specifications that are on the page. + * The collection of different types of tags. * - * @return the controlSpecifications + * @return the resourceTags */ - public List getControlSpecifications() { - return controlSpecifications; + public Tags getResourceTags() { + return resourceTags; } /** @@ -218,5 +249,16 @@ public Long getUnableToPerformCount() { public Long getUserEvaluationRequiredCount() { return userEvaluationRequiredCount; } + + /** + * Gets the notApplicableCount. + * + * The number of not applicable (with no evaluations) checks. + * + * @return the notApplicableCount + */ + public Long getNotApplicableCount() { + return notApplicableCount; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateControlLibraryOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateControlLibraryOptions.java new file mode 100644 index 00000000..2e65f695 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateControlLibraryOptions.java @@ -0,0 +1,308 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createControlLibrary options. + */ +public class CreateControlLibraryOptions extends GenericModel { + + /** + * Details that the control library is a user made(custom) or Security Compliance Center(predefined). + */ + public interface ControlLibraryType { + /** custom. */ + String CUSTOM = "custom"; + } + + protected String instanceId; + protected String controlLibraryName; + protected String controlLibraryDescription; + protected String controlLibraryType; + protected String controlLibraryVersion; + protected List controls; + protected String accountId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String controlLibraryName; + private String controlLibraryDescription; + private String controlLibraryType; + private String controlLibraryVersion; + private List controls; + private String accountId; + + /** + * Instantiates a new Builder from an existing CreateControlLibraryOptions instance. + * + * @param createControlLibraryOptions the instance to initialize the Builder with + */ + private Builder(CreateControlLibraryOptions createControlLibraryOptions) { + this.instanceId = createControlLibraryOptions.instanceId; + this.controlLibraryName = createControlLibraryOptions.controlLibraryName; + this.controlLibraryDescription = createControlLibraryOptions.controlLibraryDescription; + this.controlLibraryType = createControlLibraryOptions.controlLibraryType; + this.controlLibraryVersion = createControlLibraryOptions.controlLibraryVersion; + this.controls = createControlLibraryOptions.controls; + this.accountId = createControlLibraryOptions.accountId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param controlLibraryName the controlLibraryName + * @param controlLibraryDescription the controlLibraryDescription + * @param controlLibraryType the controlLibraryType + * @param controlLibraryVersion the controlLibraryVersion + * @param controls the controls + */ + public Builder(String instanceId, String controlLibraryName, String controlLibraryDescription, String controlLibraryType, String controlLibraryVersion, List controls) { + this.instanceId = instanceId; + this.controlLibraryName = controlLibraryName; + this.controlLibraryDescription = controlLibraryDescription; + this.controlLibraryType = controlLibraryType; + this.controlLibraryVersion = controlLibraryVersion; + this.controls = controls; + } + + /** + * Builds a CreateControlLibraryOptions. + * + * @return the new CreateControlLibraryOptions instance + */ + public CreateControlLibraryOptions build() { + return new CreateControlLibraryOptions(this); + } + + /** + * Adds a new element to controls. + * + * @param controls the new element to be added + * @return the CreateControlLibraryOptions builder + */ + public Builder addControls(ControlPrototype controls) { + com.ibm.cloud.sdk.core.util.Validator.notNull(controls, + "controls cannot be null"); + if (this.controls == null) { + this.controls = new ArrayList(); + } + this.controls.add(controls); + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the CreateControlLibraryOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the controlLibraryName. + * + * @param controlLibraryName the controlLibraryName + * @return the CreateControlLibraryOptions builder + */ + public Builder controlLibraryName(String controlLibraryName) { + this.controlLibraryName = controlLibraryName; + return this; + } + + /** + * Set the controlLibraryDescription. + * + * @param controlLibraryDescription the controlLibraryDescription + * @return the CreateControlLibraryOptions builder + */ + public Builder controlLibraryDescription(String controlLibraryDescription) { + this.controlLibraryDescription = controlLibraryDescription; + return this; + } + + /** + * Set the controlLibraryType. + * + * @param controlLibraryType the controlLibraryType + * @return the CreateControlLibraryOptions builder + */ + public Builder controlLibraryType(String controlLibraryType) { + this.controlLibraryType = controlLibraryType; + return this; + } + + /** + * Set the controlLibraryVersion. + * + * @param controlLibraryVersion the controlLibraryVersion + * @return the CreateControlLibraryOptions builder + */ + public Builder controlLibraryVersion(String controlLibraryVersion) { + this.controlLibraryVersion = controlLibraryVersion; + return this; + } + + /** + * Set the controls. + * Existing controls will be replaced. + * + * @param controls the controls + * @return the CreateControlLibraryOptions builder + */ + public Builder controls(List controls) { + this.controls = controls; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateControlLibraryOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + } + + protected CreateControlLibraryOptions() { } + + protected CreateControlLibraryOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlLibraryName, + "controlLibraryName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlLibraryDescription, + "controlLibraryDescription cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlLibraryType, + "controlLibraryType cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlLibraryVersion, + "controlLibraryVersion cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controls, + "controls cannot be null"); + instanceId = builder.instanceId; + controlLibraryName = builder.controlLibraryName; + controlLibraryDescription = builder.controlLibraryDescription; + controlLibraryType = builder.controlLibraryType; + controlLibraryVersion = builder.controlLibraryVersion; + controls = builder.controls; + accountId = builder.accountId; + } + + /** + * New builder. + * + * @return a CreateControlLibraryOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the controlLibraryName. + * + * The name of the control library. + * + * @return the controlLibraryName + */ + public String controlLibraryName() { + return controlLibraryName; + } + + /** + * Gets the controlLibraryDescription. + * + * Details of the control library. + * + * @return the controlLibraryDescription + */ + public String controlLibraryDescription() { + return controlLibraryDescription; + } + + /** + * Gets the controlLibraryType. + * + * Details that the control library is a user made(custom) or Security Compliance Center(predefined). + * + * @return the controlLibraryType + */ + public String controlLibraryType() { + return controlLibraryType; + } + + /** + * Gets the controlLibraryVersion. + * + * The revision number of the control library. + * + * @return the controlLibraryVersion + */ + public String controlLibraryVersion() { + return controlLibraryVersion; + } + + /** + * Gets the controls. + * + * The list of rules that the control library attempts to adhere to. + * + * @return the controls + */ + public List controls() { + return controls; + } + + /** + * Gets the accountId. + * + * The user account ID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileAttachmentOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileAttachmentOptions.java new file mode 100644 index 00000000..4bf9fd36 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileAttachmentOptions.java @@ -0,0 +1,236 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createProfileAttachment options. + */ +public class CreateProfileAttachmentOptions extends GenericModel { + + protected String instanceId; + protected String profileId; + protected List newAttachments; + protected String newProfileId; + protected String accountId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String profileId; + private List newAttachments; + private String newProfileId; + private String accountId; + + /** + * Instantiates a new Builder from an existing CreateProfileAttachmentOptions instance. + * + * @param createProfileAttachmentOptions the instance to initialize the Builder with + */ + private Builder(CreateProfileAttachmentOptions createProfileAttachmentOptions) { + this.instanceId = createProfileAttachmentOptions.instanceId; + this.profileId = createProfileAttachmentOptions.profileId; + this.newAttachments = createProfileAttachmentOptions.newAttachments; + this.newProfileId = createProfileAttachmentOptions.newProfileId; + this.accountId = createProfileAttachmentOptions.accountId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param profileId the profileId + * @param newAttachments the newAttachments + */ + public Builder(String instanceId, String profileId, List newAttachments) { + this.instanceId = instanceId; + this.profileId = profileId; + this.newAttachments = newAttachments; + } + + /** + * Builds a CreateProfileAttachmentOptions. + * + * @return the new CreateProfileAttachmentOptions instance + */ + public CreateProfileAttachmentOptions build() { + return new CreateProfileAttachmentOptions(this); + } + + /** + * Adds a new element to newAttachments. + * + * @param newAttachments the new element to be added + * @return the CreateProfileAttachmentOptions builder + */ + public Builder addNewAttachments(ProfileAttachmentBase newAttachments) { + com.ibm.cloud.sdk.core.util.Validator.notNull(newAttachments, + "newAttachments cannot be null"); + if (this.newAttachments == null) { + this.newAttachments = new ArrayList(); + } + this.newAttachments.add(newAttachments); + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the CreateProfileAttachmentOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the profileId. + * + * @param profileId the profileId + * @return the CreateProfileAttachmentOptions builder + */ + public Builder profileId(String profileId) { + this.profileId = profileId; + return this; + } + + /** + * Set the newAttachments. + * Existing newAttachments will be replaced. + * + * @param newAttachments the newAttachments + * @return the CreateProfileAttachmentOptions builder + */ + public Builder newAttachments(List newAttachments) { + this.newAttachments = newAttachments; + return this; + } + + /** + * Set the newProfileId. + * + * @param newProfileId the newProfileId + * @return the CreateProfileAttachmentOptions builder + */ + public Builder newProfileId(String newProfileId) { + this.newProfileId = newProfileId; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateProfileAttachmentOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + } + + protected CreateProfileAttachmentOptions() { } + + protected CreateProfileAttachmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId 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.newAttachments, + "newAttachments cannot be null"); + instanceId = builder.instanceId; + profileId = builder.profileId; + newAttachments = builder.newAttachments; + newProfileId = builder.newProfileId; + accountId = builder.accountId; + } + + /** + * New builder. + * + * @return a CreateProfileAttachmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the profileId. + * + * The profile ID. + * + * @return the profileId + */ + public String profileId() { + return profileId; + } + + /** + * Gets the newAttachments. + * + * The Prototype to create a profile attachment. + * + * @return the newAttachments + */ + public List newAttachments() { + return newAttachments; + } + + /** + * Gets the newProfileId. + * + * The profile ID to target against. + * + * @return the newProfileId + */ + public String newProfileId() { + return newProfileId; + } + + /** + * Gets the accountId. + * + * The user account ID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileOptions.java index f4bfe47c..54920516 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -22,35 +23,29 @@ */ public class CreateProfileOptions extends GenericModel { - /** - * The profile type. - */ - public interface ProfileType { - /** predefined. */ - String PREDEFINED = "predefined"; - /** custom. */ - String CUSTOM = "custom"; - } - + protected String instanceId; protected String profileName; - protected String profileDescription; - protected String profileType; + protected String profileVersion; protected List controls; - protected List defaultParameters; - protected String xCorrelationId; - protected String xRequestId; + protected List defaultParameters; + protected String profileDescription; + protected Boolean latest; + protected String versionGroupLabel; + protected String accountId; /** * Builder. */ public static class Builder { + private String instanceId; private String profileName; - private String profileDescription; - private String profileType; + private String profileVersion; private List controls; - private List defaultParameters; - private String xCorrelationId; - private String xRequestId; + private List defaultParameters; + private String profileDescription; + private Boolean latest; + private String versionGroupLabel; + private String accountId; /** * Instantiates a new Builder from an existing CreateProfileOptions instance. @@ -58,13 +53,15 @@ public static class Builder { * @param createProfileOptions the instance to initialize the Builder with */ private Builder(CreateProfileOptions createProfileOptions) { + this.instanceId = createProfileOptions.instanceId; this.profileName = createProfileOptions.profileName; - this.profileDescription = createProfileOptions.profileDescription; - this.profileType = createProfileOptions.profileType; + this.profileVersion = createProfileOptions.profileVersion; this.controls = createProfileOptions.controls; this.defaultParameters = createProfileOptions.defaultParameters; - this.xCorrelationId = createProfileOptions.xCorrelationId; - this.xRequestId = createProfileOptions.xRequestId; + this.profileDescription = createProfileOptions.profileDescription; + this.latest = createProfileOptions.latest; + this.versionGroupLabel = createProfileOptions.versionGroupLabel; + this.accountId = createProfileOptions.accountId; } /** @@ -76,16 +73,16 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param profileName the profileName - * @param profileDescription the profileDescription - * @param profileType the profileType + * @param profileVersion the profileVersion * @param controls the controls * @param defaultParameters the defaultParameters */ - public Builder(String profileName, String profileDescription, String profileType, List controls, List defaultParameters) { + public Builder(String instanceId, String profileName, String profileVersion, List controls, List defaultParameters) { + this.instanceId = instanceId; this.profileName = profileName; - this.profileDescription = profileDescription; - this.profileType = profileType; + this.profileVersion = profileVersion; this.controls = controls; this.defaultParameters = defaultParameters; } @@ -100,9 +97,9 @@ public CreateProfileOptions build() { } /** - * Adds an controls to controls. + * Adds a new element to controls. * - * @param controls the new controls + * @param controls the new element to be added * @return the CreateProfileOptions builder */ public Builder addControls(ProfileControlsPrototype controls) { @@ -116,51 +113,51 @@ public Builder addControls(ProfileControlsPrototype controls) { } /** - * Adds an defaultParameters to defaultParameters. + * Adds a new element to defaultParameters. * - * @param defaultParameters the new defaultParameters + * @param defaultParameters the new element to be added * @return the CreateProfileOptions builder */ - public Builder addDefaultParameters(DefaultParametersPrototype defaultParameters) { + public Builder addDefaultParameters(DefaultParameters defaultParameters) { com.ibm.cloud.sdk.core.util.Validator.notNull(defaultParameters, "defaultParameters cannot be null"); if (this.defaultParameters == null) { - this.defaultParameters = new ArrayList(); + this.defaultParameters = new ArrayList(); } this.defaultParameters.add(defaultParameters); return this; } /** - * Set the profileName. + * Set the instanceId. * - * @param profileName the profileName + * @param instanceId the instanceId * @return the CreateProfileOptions builder */ - public Builder profileName(String profileName) { - this.profileName = profileName; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the profileDescription. + * Set the profileName. * - * @param profileDescription the profileDescription + * @param profileName the profileName * @return the CreateProfileOptions builder */ - public Builder profileDescription(String profileDescription) { - this.profileDescription = profileDescription; + public Builder profileName(String profileName) { + this.profileName = profileName; return this; } /** - * Set the profileType. + * Set the profileVersion. * - * @param profileType the profileType + * @param profileVersion the profileVersion * @return the CreateProfileOptions builder */ - public Builder profileType(String profileType) { - this.profileType = profileType; + public Builder profileVersion(String profileVersion) { + this.profileVersion = profileVersion; return this; } @@ -183,30 +180,52 @@ public Builder controls(List controls) { * @param defaultParameters the defaultParameters * @return the CreateProfileOptions builder */ - public Builder defaultParameters(List defaultParameters) { + public Builder defaultParameters(List defaultParameters) { this.defaultParameters = defaultParameters; return this; } /** - * Set the xCorrelationId. + * Set the profileDescription. * - * @param xCorrelationId the xCorrelationId + * @param profileDescription the profileDescription * @return the CreateProfileOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder profileDescription(String profileDescription) { + this.profileDescription = profileDescription; return this; } /** - * Set the xRequestId. + * Set the latest. * - * @param xRequestId the xRequestId + * @param latest the latest * @return the CreateProfileOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder latest(Boolean latest) { + this.latest = latest; + return this; + } + + /** + * Set the versionGroupLabel. + * + * @param versionGroupLabel the versionGroupLabel + * @return the CreateProfileOptions builder + */ + public Builder versionGroupLabel(String versionGroupLabel) { + this.versionGroupLabel = versionGroupLabel; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateProfileOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } } @@ -214,23 +233,25 @@ public Builder xRequestId(String xRequestId) { protected CreateProfileOptions() { } protected CreateProfileOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId 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, - "profileDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.profileType, - "profileType cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.profileVersion, + "profileVersion cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controls, "controls cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.defaultParameters, "defaultParameters cannot be null"); + instanceId = builder.instanceId; profileName = builder.profileName; - profileDescription = builder.profileDescription; - profileType = builder.profileType; + profileVersion = builder.profileVersion; controls = builder.controls; defaultParameters = builder.defaultParameters; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + profileDescription = builder.profileDescription; + latest = builder.latest; + versionGroupLabel = builder.versionGroupLabel; + accountId = builder.accountId; } /** @@ -243,42 +264,42 @@ public Builder newBuilder() { } /** - * Gets the profileName. + * Gets the instanceId. * - * The name of the profile. + * The ID of the Security and Compliance Center instance. * - * @return the profileName + * @return the instanceId */ - public String profileName() { - return profileName; + public String instanceId() { + return instanceId; } /** - * Gets the profileDescription. + * Gets the profileName. * - * The description of the profile. + * The name of the profile. * - * @return the profileDescription + * @return the profileName */ - public String profileDescription() { - return profileDescription; + public String profileName() { + return profileName; } /** - * Gets the profileType. + * Gets the profileVersion. * - * The profile type. + * The version of the profile. * - * @return the profileType + * @return the profileVersion */ - public String profileType() { - return profileType; + public String profileVersion() { + return profileVersion; } /** * Gets the controls. * - * The controls that are in the profile. + * List of controls associated with the profile. * * @return the controls */ @@ -289,38 +310,56 @@ public List controls() { /** * Gets the defaultParameters. * - * The default parameters of the profile. + * The default values when using the profile. * * @return the defaultParameters */ - public List defaultParameters() { + public List defaultParameters() { return defaultParameters; } /** - * Gets the xCorrelationId. + * Gets the profileDescription. + * + * A description of what the profile should represent. + * + * @return the profileDescription + */ + public String profileDescription() { + return profileDescription; + } + + /** + * Gets the latest. + * + * Determines if the profile is up to date with the latest revisions. + * + * @return the latest + */ + public Boolean latest() { + return latest; + } + + /** + * Gets the versionGroupLabel. * - * The supplied or generated value of this header is logged for a request, and repeated in a response header for the - * corresponding response. The same value is used for downstream requests, and retries of those requests. If a value - * of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The unique identifier of the revision. * - * @return the xCorrelationId + * @return the versionGroupLabel */ - public String xCorrelationId() { - return xCorrelationId; + public String versionGroupLabel() { + return versionGroupLabel; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } } 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 1cef3d89..23c72ea0 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -21,21 +22,19 @@ */ public class CreateProviderTypeInstanceOptions extends GenericModel { + protected String instanceId; protected String providerTypeId; protected String name; protected Map attributes; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String providerTypeId; private String name; private Map attributes; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing CreateProviderTypeInstanceOptions instance. @@ -43,11 +42,10 @@ public static class Builder { * @param createProviderTypeInstanceOptions the instance to initialize the Builder with */ private Builder(CreateProviderTypeInstanceOptions createProviderTypeInstanceOptions) { + this.instanceId = createProviderTypeInstanceOptions.instanceId; this.providerTypeId = createProviderTypeInstanceOptions.providerTypeId; this.name = createProviderTypeInstanceOptions.name; this.attributes = createProviderTypeInstanceOptions.attributes; - this.xCorrelationId = createProviderTypeInstanceOptions.xCorrelationId; - this.xRequestId = createProviderTypeInstanceOptions.xRequestId; } /** @@ -59,14 +57,12 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param providerTypeId the providerTypeId - * @param name the name - * @param attributes the attributes */ - public Builder(String providerTypeId, String name, Map attributes) { + public Builder(String instanceId, String providerTypeId) { + this.instanceId = instanceId; this.providerTypeId = providerTypeId; - this.name = name; - this.attributes = attributes; } /** @@ -78,6 +74,17 @@ public CreateProviderTypeInstanceOptions build() { return new CreateProviderTypeInstanceOptions(this); } + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the CreateProviderTypeInstanceOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + /** * Set the providerTypeId. * @@ -110,44 +117,19 @@ public Builder attributes(Map attributes) { this.attributes = attributes; return this; } - - /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the CreateProviderTypeInstanceOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. - * - * @param xRequestId the xRequestId - * @return the CreateProviderTypeInstanceOptions builder - */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; - return this; - } } protected CreateProviderTypeInstanceOptions() { } protected CreateProviderTypeInstanceOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); 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"); + instanceId = builder.instanceId; providerTypeId = builder.providerTypeId; name = builder.name; attributes = builder.attributes; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -159,6 +141,17 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + /** * Gets the providerTypeId. * @@ -191,31 +184,5 @@ public String name() { public Map attributes() { return attributes; } - - /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this headers is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this headers is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xRequestId - */ - public String xRequestId() { - return xRequestId; - } } 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 40ab889d..b30eb5db 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -22,27 +23,25 @@ */ public class CreateRuleOptions extends GenericModel { + protected String instanceId; protected String description; - protected TargetPrototype target; + protected RuleTargetPrototype target; protected RequiredConfig requiredConfig; protected String version; protected Import xImport; protected List labels; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String description; - private TargetPrototype target; + private RuleTargetPrototype target; private RequiredConfig requiredConfig; private String version; private Import xImport; private List labels; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing CreateRuleOptions instance. @@ -50,14 +49,13 @@ public static class Builder { * @param createRuleOptions the instance to initialize the Builder with */ private Builder(CreateRuleOptions createRuleOptions) { + this.instanceId = createRuleOptions.instanceId; this.description = createRuleOptions.description; this.target = createRuleOptions.target; this.requiredConfig = createRuleOptions.requiredConfig; this.version = createRuleOptions.version; this.xImport = createRuleOptions.xImport; this.labels = createRuleOptions.labels; - this.xCorrelationId = createRuleOptions.xCorrelationId; - this.xRequestId = createRuleOptions.xRequestId; } /** @@ -69,11 +67,13 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param description the description * @param target the target * @param requiredConfig the requiredConfig */ - public Builder(String description, TargetPrototype target, RequiredConfig requiredConfig) { + public Builder(String instanceId, String description, RuleTargetPrototype target, RequiredConfig requiredConfig) { + this.instanceId = instanceId; this.description = description; this.target = target; this.requiredConfig = requiredConfig; @@ -89,9 +89,9 @@ public CreateRuleOptions build() { } /** - * Adds an labels to labels. + * Adds a new element to labels. * - * @param labels the new labels + * @param labels the new element to be added * @return the CreateRuleOptions builder */ public Builder addLabels(String labels) { @@ -104,6 +104,17 @@ public Builder addLabels(String labels) { return this; } + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the CreateRuleOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + /** * Set the description. * @@ -121,7 +132,7 @@ public Builder description(String description) { * @param target the target * @return the CreateRuleOptions builder */ - public Builder target(TargetPrototype target) { + public Builder target(RuleTargetPrototype target) { this.target = target; return this; } @@ -170,47 +181,26 @@ public Builder labels(List labels) { this.labels = labels; return this; } - - /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the CreateRuleOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. - * - * @param xRequestId the xRequestId - * @return the CreateRuleOptions builder - */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; - return this; - } } protected CreateRuleOptions() { } protected CreateRuleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.description, "description cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.target, "target cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.requiredConfig, "requiredConfig cannot be null"); + instanceId = builder.instanceId; description = builder.description; target = builder.target; requiredConfig = builder.requiredConfig; version = builder.version; xImport = builder.xImport; labels = builder.labels; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -222,6 +212,17 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + /** * Gets the description. * @@ -240,14 +241,14 @@ public String description() { * * @return the target */ - public TargetPrototype target() { + public RuleTargetPrototype target() { return target; } /** * Gets the requiredConfig. * - * The required configurations. + * The required configurations for a Rule. * * @return the requiredConfig */ @@ -287,31 +288,5 @@ public Import xImport() { public List labels() { return labels; } - - /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xRequestId - */ - public String xRequestId() { - return xRequestId; - } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanOptions.java index c0de1569..58afb2e2 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,17 @@ */ public class CreateScanOptions extends GenericModel { + protected String instanceId; protected String attachmentId; - protected String xCorrelationId; - protected String xRequestId; + protected String accountId; /** * Builder. */ public static class Builder { + private String instanceId; private String attachmentId; - private String xCorrelationId; - private String xRequestId; + private String accountId; /** * Instantiates a new Builder from an existing CreateScanOptions instance. @@ -37,9 +38,9 @@ public static class Builder { * @param createScanOptions the instance to initialize the Builder with */ private Builder(CreateScanOptions createScanOptions) { + this.instanceId = createScanOptions.instanceId; this.attachmentId = createScanOptions.attachmentId; - this.xCorrelationId = createScanOptions.xCorrelationId; - this.xRequestId = createScanOptions.xRequestId; + this.accountId = createScanOptions.accountId; } /** @@ -51,10 +52,10 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param attachmentId the attachmentId + * @param instanceId the instanceId */ - public Builder(String attachmentId) { - this.attachmentId = attachmentId; + public Builder(String instanceId) { + this.instanceId = instanceId; } /** @@ -67,35 +68,35 @@ public CreateScanOptions build() { } /** - * Set the attachmentId. + * Set the instanceId. * - * @param attachmentId the attachmentId + * @param instanceId the instanceId * @return the CreateScanOptions builder */ - public Builder attachmentId(String attachmentId) { - this.attachmentId = attachmentId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. + * Set the attachmentId. * - * @param xCorrelationId the xCorrelationId + * @param attachmentId the attachmentId * @return the CreateScanOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder attachmentId(String attachmentId) { + this.attachmentId = attachmentId; return this; } /** - * Set the xRequestId. + * Set the accountId. * - * @param xRequestId the xRequestId + * @param accountId the accountId * @return the CreateScanOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } } @@ -103,11 +104,11 @@ public Builder xRequestId(String xRequestId) { protected CreateScanOptions() { } protected CreateScanOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attachmentId, - "attachmentId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; attachmentId = builder.attachmentId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + accountId = builder.accountId; } /** @@ -120,40 +121,36 @@ public Builder newBuilder() { } /** - * Gets the attachmentId. + * Gets the instanceId. * - * The attachment ID of a profile. + * The ID of the Security and Compliance Center instance. * - * @return the attachmentId + * @return the instanceId */ - public String attachmentId() { - return attachmentId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. + * Gets the attachmentId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the profile attachment. * - * @return the xCorrelationId + * @return the attachmentId */ - public String xCorrelationId() { - return xCorrelationId; + public String attachmentId() { + return attachmentId; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } } 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/CreateScanReport.java similarity index 64% rename from modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributes.java rename to modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReport.java index 16b9d4bf..6fd3842d 100644 --- 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/CreateScanReport.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,18 +10,29 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; +import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The attributes for connecting to the provider type instance. + * The scan report ID. */ -public class ProviderTypeInstanceAttributes extends DynamicModel { +public class CreateScanReport extends GenericModel { + + protected String id; + protected CreateScanReport() { } - public ProviderTypeInstanceAttributes() { - super(new TypeToken() { }); + /** + * Gets the id. + * + * The scan report ID. + * + * @return the id + */ + public String getId() { + return id; } } + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportOptions.java new file mode 100644 index 00000000..806f36ce --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportOptions.java @@ -0,0 +1,226 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 createScanReport options. + */ +public class CreateScanReportOptions extends GenericModel { + + /** + * The enum of different report format types. + */ + public interface Format { + /** csv. */ + String CSV = "csv"; + /** pdf. */ + String PDF = "pdf"; + } + + protected String instanceId; + protected String reportId; + protected String format; + protected String scopeId; + protected String subscopeId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String reportId; + private String format; + private String scopeId; + private String subscopeId; + + /** + * Instantiates a new Builder from an existing CreateScanReportOptions instance. + * + * @param createScanReportOptions the instance to initialize the Builder with + */ + private Builder(CreateScanReportOptions createScanReportOptions) { + this.instanceId = createScanReportOptions.instanceId; + this.reportId = createScanReportOptions.reportId; + this.format = createScanReportOptions.format; + this.scopeId = createScanReportOptions.scopeId; + this.subscopeId = createScanReportOptions.subscopeId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param reportId the reportId + * @param format the format + */ + public Builder(String instanceId, String reportId, String format) { + this.instanceId = instanceId; + this.reportId = reportId; + this.format = format; + } + + /** + * Builds a CreateScanReportOptions. + * + * @return the new CreateScanReportOptions instance + */ + public CreateScanReportOptions build() { + return new CreateScanReportOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the CreateScanReportOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the reportId. + * + * @param reportId the reportId + * @return the CreateScanReportOptions builder + */ + public Builder reportId(String reportId) { + this.reportId = reportId; + return this; + } + + /** + * Set the format. + * + * @param format the format + * @return the CreateScanReportOptions builder + */ + public Builder format(String format) { + this.format = format; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the CreateScanReportOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the subscopeId. + * + * @param subscopeId the subscopeId + * @return the CreateScanReportOptions builder + */ + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; + return this; + } + } + + protected CreateScanReportOptions() { } + + protected CreateScanReportOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, + "reportId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.format, + "format cannot be null"); + instanceId = builder.instanceId; + reportId = builder.reportId; + format = builder.format; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; + } + + /** + * New builder. + * + * @return a CreateScanReportOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the reportId. + * + * The ID of the scan that is associated with a report. + * + * @return the reportId + */ + public String reportId() { + return reportId; + } + + /** + * Gets the format. + * + * The enum of different report format types. + * + * @return the format + */ + public String format() { + return format; + } + + /** + * Gets the scopeId. + * + * The ID of the scope. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The ID of the sub-scope. + * + * @return the subscopeId + */ + public String subscopeId() { + return subscopeId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanResponse.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanResponse.java new file mode 100644 index 00000000..2e9a8717 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanResponse.java @@ -0,0 +1,143 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The response that details the whether starting a scan was successful. + */ +public class CreateScanResponse extends GenericModel { + + protected String id; + @SerializedName("account_id") + protected String accountId; + @SerializedName("attachment_id") + protected String attachmentId; + @SerializedName("report_id") + protected String reportId; + protected String status; + @SerializedName("last_scan_time") + protected Date lastScanTime; + @SerializedName("next_scan_time") + protected Date nextScanTime; + @SerializedName("scan_type") + protected String scanType; + protected Long occurence; + + protected CreateScanResponse() { } + + /** + * Gets the id. + * + * The ID of the scan generated. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The ID of the account associated with the scan. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the attachmentId. + * + * The ID of the profile attachment associated with the scan. + * + * @return the attachmentId + */ + public String getAttachmentId() { + return attachmentId; + } + + /** + * Gets the reportId. + * + * The ID of the report associated with the scan. + * + * @return the reportId + */ + public String getReportId() { + return reportId; + } + + /** + * Gets the status. + * + * Details the state of a scan. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the lastScanTime. + * + * The last time a scan was performed. + * + * @return the lastScanTime + */ + public Date getLastScanTime() { + return lastScanTime; + } + + /** + * Gets the nextScanTime. + * + * The next time a scan will be triggered. + * + * @return the nextScanTime + */ + public Date getNextScanTime() { + return nextScanTime; + } + + /** + * Gets the scanType. + * + * Shows how a scan gets triggered. + * + * @return the scanType + */ + public String getScanType() { + return scanType; + } + + /** + * Gets the occurence. + * + * The number of times the scan appeared. + * + * @return the occurence + */ + public Long getOccurence() { + return occurence; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScopeOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScopeOptions.java new file mode 100644 index 00000000..b2c6c49b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScopeOptions.java @@ -0,0 +1,228 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createScope options. + */ +public class CreateScopeOptions extends GenericModel { + + protected String instanceId; + protected String name; + protected String description; + protected String environment; + protected List xProperties; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String name; + private String description; + private String environment; + private List xProperties; + + /** + * Instantiates a new Builder from an existing CreateScopeOptions instance. + * + * @param createScopeOptions the instance to initialize the Builder with + */ + private Builder(CreateScopeOptions createScopeOptions) { + this.instanceId = createScopeOptions.instanceId; + this.name = createScopeOptions.name; + this.description = createScopeOptions.description; + this.environment = createScopeOptions.environment; + this.xProperties = createScopeOptions.xProperties; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + */ + public Builder(String instanceId) { + this.instanceId = instanceId; + } + + /** + * Builds a CreateScopeOptions. + * + * @return the new CreateScopeOptions instance + */ + public CreateScopeOptions build() { + return new CreateScopeOptions(this); + } + + /** + * Adds a new element to xProperties. + * + * @param xProperties the new element to be added + * @return the CreateScopeOptions builder + */ + public Builder addXProperties(ScopeProperty xProperties) { + com.ibm.cloud.sdk.core.util.Validator.notNull(xProperties, + "xProperties cannot be null"); + if (this.xProperties == null) { + this.xProperties = new ArrayList(); + } + this.xProperties.add(xProperties); + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the CreateScopeOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateScopeOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateScopeOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the environment. + * + * @param environment the environment + * @return the CreateScopeOptions builder + */ + public Builder environment(String environment) { + this.environment = environment; + return this; + } + + /** + * Set the xProperties. + * Existing xProperties will be replaced. + * + * @param xProperties the xProperties + * @return the CreateScopeOptions builder + */ + public Builder xProperties(List xProperties) { + this.xProperties = xProperties; + return this; + } + } + + protected CreateScopeOptions() { } + + protected CreateScopeOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; + name = builder.name; + description = builder.description; + environment = builder.environment; + xProperties = builder.xProperties; + } + + /** + * New builder. + * + * @return a CreateScopeOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the name. + * + * The scope name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * The scope description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the environment. + * + * The scope environment. + * + * @return the environment + */ + public String environment() { + return environment; + } + + /** + * Gets the xProperties. + * + * The properties that are supported for scoping by this environment. + * + * @return the xProperties + */ + public List xProperties() { + return xProperties; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateSubscopeOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateSubscopeOptions.java new file mode 100644 index 00000000..5a2b292f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateSubscopeOptions.java @@ -0,0 +1,184 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createSubscope options. + */ +public class CreateSubscopeOptions extends GenericModel { + + protected String instanceId; + protected String scopeId; + protected List subscopes; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String scopeId; + private List subscopes; + + /** + * Instantiates a new Builder from an existing CreateSubscopeOptions instance. + * + * @param createSubscopeOptions the instance to initialize the Builder with + */ + private Builder(CreateSubscopeOptions createSubscopeOptions) { + this.instanceId = createSubscopeOptions.instanceId; + this.scopeId = createSubscopeOptions.scopeId; + this.subscopes = createSubscopeOptions.subscopes; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param scopeId the scopeId + * @param subscopes the subscopes + */ + public Builder(String instanceId, String scopeId, List subscopes) { + this.instanceId = instanceId; + this.scopeId = scopeId; + this.subscopes = subscopes; + } + + /** + * Builds a CreateSubscopeOptions. + * + * @return the new CreateSubscopeOptions instance + */ + public CreateSubscopeOptions build() { + return new CreateSubscopeOptions(this); + } + + /** + * Adds a new element to subscopes. + * + * @param subscopes the new element to be added + * @return the CreateSubscopeOptions builder + */ + public Builder addSubscopes(ScopePrototype subscopes) { + com.ibm.cloud.sdk.core.util.Validator.notNull(subscopes, + "subscopes cannot be null"); + if (this.subscopes == null) { + this.subscopes = new ArrayList(); + } + this.subscopes.add(subscopes); + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the CreateSubscopeOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the CreateSubscopeOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the subscopes. + * Existing subscopes will be replaced. + * + * @param subscopes the subscopes + * @return the CreateSubscopeOptions builder + */ + public Builder subscopes(List subscopes) { + this.subscopes = subscopes; + return this; + } + } + + protected CreateSubscopeOptions() { } + + protected CreateSubscopeOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.scopeId, + "scopeId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.subscopes, + "subscopes cannot be null"); + instanceId = builder.instanceId; + scopeId = builder.scopeId; + subscopes = builder.subscopes; + } + + /** + * New builder. + * + * @return a CreateSubscopeOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope being targeted. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the subscopes. + * + * The array of subscopes. + * + * @return the subscopes + */ + public List subscopes() { + return subscopes; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateTargetOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateTargetOptions.java new file mode 100644 index 00000000..3563f72d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateTargetOptions.java @@ -0,0 +1,240 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The createTarget options. + */ +public class CreateTargetOptions extends GenericModel { + + protected String instanceId; + protected String accountId; + protected String trustedProfileId; + protected String name; + protected List credentials; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String accountId; + private String trustedProfileId; + private String name; + private List credentials; + + /** + * Instantiates a new Builder from an existing CreateTargetOptions instance. + * + * @param createTargetOptions the instance to initialize the Builder with + */ + private Builder(CreateTargetOptions createTargetOptions) { + this.instanceId = createTargetOptions.instanceId; + this.accountId = createTargetOptions.accountId; + this.trustedProfileId = createTargetOptions.trustedProfileId; + this.name = createTargetOptions.name; + this.credentials = createTargetOptions.credentials; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param accountId the accountId + * @param trustedProfileId the trustedProfileId + * @param name the name + */ + public Builder(String instanceId, String accountId, String trustedProfileId, String name) { + this.instanceId = instanceId; + this.accountId = accountId; + this.trustedProfileId = trustedProfileId; + this.name = name; + } + + /** + * Builds a CreateTargetOptions. + * + * @return the new CreateTargetOptions instance + */ + public CreateTargetOptions build() { + return new CreateTargetOptions(this); + } + + /** + * Adds a new element to credentials. + * + * @param credentials the new element to be added + * @return the CreateTargetOptions builder + */ + public Builder addCredentials(Credential credentials) { + com.ibm.cloud.sdk.core.util.Validator.notNull(credentials, + "credentials cannot be null"); + if (this.credentials == null) { + this.credentials = new ArrayList(); + } + this.credentials.add(credentials); + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the CreateTargetOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the CreateTargetOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the trustedProfileId. + * + * @param trustedProfileId the trustedProfileId + * @return the CreateTargetOptions builder + */ + public Builder trustedProfileId(String trustedProfileId) { + this.trustedProfileId = trustedProfileId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateTargetOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the credentials. + * Existing credentials will be replaced. + * + * @param credentials the credentials + * @return the CreateTargetOptions builder + */ + public Builder credentials(List credentials) { + this.credentials = credentials; + return this; + } + } + + protected CreateTargetOptions() { } + + protected CreateTargetOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.trustedProfileId, + "trustedProfileId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + instanceId = builder.instanceId; + accountId = builder.accountId; + trustedProfileId = builder.trustedProfileId; + name = builder.name; + credentials = builder.credentials; + } + + /** + * New builder. + * + * @return a CreateTargetOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the accountId. + * + * The target account ID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the trustedProfileId. + * + * The trusted profile ID. + * + * @return the trustedProfileId + */ + public String trustedProfileId() { + return trustedProfileId; + } + + /** + * Gets the name. + * + * The target name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the credentials. + * + * Customer credential to access for a specific service to scan. + * + * @return the credentials + */ + public List credentials() { + return credentials; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Credential.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Credential.java new file mode 100644 index 00000000..9d780324 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Credential.java @@ -0,0 +1,156 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * Credential. + */ +public class Credential extends GenericModel { + + @SerializedName("secret_crn") + protected String secretCrn; + protected List resources; + + /** + * Builder. + */ + public static class Builder { + private String secretCrn; + private List resources; + + /** + * Instantiates a new Builder from an existing Credential instance. + * + * @param credential the instance to initialize the Builder with + */ + private Builder(Credential credential) { + this.secretCrn = credential.secretCrn; + this.resources = credential.resources; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param secretCrn the secretCrn + * @param resources the resources + */ + public Builder(String secretCrn, List resources) { + this.secretCrn = secretCrn; + this.resources = resources; + } + + /** + * Builds a Credential. + * + * @return the new Credential instance + */ + public Credential build() { + return new Credential(this); + } + + /** + * Adds a new element to resources. + * + * @param resources the new element to be added + * @return the Credential builder + */ + public Builder addResources(Resource resources) { + com.ibm.cloud.sdk.core.util.Validator.notNull(resources, + "resources cannot be null"); + if (this.resources == null) { + this.resources = new ArrayList(); + } + this.resources.add(resources); + return this; + } + + /** + * Set the secretCrn. + * + * @param secretCrn the secretCrn + * @return the Credential builder + */ + public Builder secretCrn(String secretCrn) { + this.secretCrn = secretCrn; + return this; + } + + /** + * Set the resources. + * Existing resources will be replaced. + * + * @param resources the resources + * @return the Credential builder + */ + public Builder resources(List resources) { + this.resources = resources; + return this; + } + } + + protected Credential() { } + + protected Credential(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.secretCrn, + "secretCrn cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.resources, + "resources cannot be null"); + secretCrn = builder.secretCrn; + resources = builder.resources; + } + + /** + * New builder. + * + * @return a Credential builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the secretCrn. + * + * The CRN of the secret. + * + * @return the secretCrn + */ + public String secretCrn() { + return secretCrn; + } + + /** + * Gets the resources. + * + * Credential having service name and instance crn. + * + * @return the resources + */ + public List resources() { + return resources; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialResponse.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialResponse.java new file mode 100644 index 00000000..e875f484 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialResponse.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * CredentialResponse. + */ +public class CredentialResponse extends GenericModel { + + protected String type; + @SerializedName("secret_crn") + protected String secretCrn; + @SerializedName("secret_name") + protected String secretName; + protected List resources; + + protected CredentialResponse() { } + + /** + * Gets the type. + * + * The type of the credential. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the secretCrn. + * + * The CRN of the secret. + * + * @return the secretCrn + */ + public String getSecretCrn() { + return secretCrn; + } + + /** + * Gets the secretName. + * + * The name of the secret. + * + * @return the secretName + */ + public String getSecretName() { + return secretName; + } + + /** + * Gets the resources. + * + * Credential having service name and instance crn. + * + * @return the resources + */ + public List getResources() { + return resources; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DateRange.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DateRange.java new file mode 100644 index 00000000..c1f4ecb0 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DateRange.java @@ -0,0 +1,139 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Date range. + */ +public class DateRange extends GenericModel { + + @SerializedName("start_date") + protected Date startDate; + @SerializedName("end_date") + protected Date endDate; + + /** + * Builder. + */ + public static class Builder { + private Date startDate; + private Date endDate; + + /** + * Instantiates a new Builder from an existing DateRange instance. + * + * @param dateRange the instance to initialize the Builder with + */ + private Builder(DateRange dateRange) { + this.startDate = dateRange.startDate; + this.endDate = dateRange.endDate; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param startDate the startDate + * @param endDate the endDate + */ + public Builder(Date startDate, Date endDate) { + this.startDate = startDate; + this.endDate = endDate; + } + + /** + * Builds a DateRange. + * + * @return the new DateRange instance + */ + public DateRange build() { + return new DateRange(this); + } + + /** + * Set the startDate. + * + * @param startDate the startDate + * @return the DateRange builder + */ + public Builder startDate(Date startDate) { + this.startDate = startDate; + return this; + } + + /** + * Set the endDate. + * + * @param endDate the endDate + * @return the DateRange builder + */ + public Builder endDate(Date endDate) { + this.endDate = endDate; + return this; + } + } + + protected DateRange() { } + + protected DateRange(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.startDate, + "startDate cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.endDate, + "endDate cannot be null"); + startDate = builder.startDate; + endDate = builder.endDate; + } + + /** + * New builder. + * + * @return a DateRange builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the startDate. + * + * date/time for the start of the range. + * + * @return the startDate + */ + public Date startDate() { + return startDate; + } + + /** + * Gets the endDate. + * + * date/time for the end of the range. + * + * @return the endDate + */ + public Date endDate() { + return endDate; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParameters.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParameters.java new file mode 100644 index 00000000..970aba2a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParameters.java @@ -0,0 +1,230 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The parameters of the profile that are inherently set by the profile. + */ +public class DefaultParameters extends GenericModel { + + @SerializedName("assessment_type") + protected String assessmentType; + @SerializedName("assessment_id") + protected String assessmentId; + @SerializedName("parameter_name") + protected String parameterName; + @SerializedName("parameter_default_value") + protected String parameterDefaultValue; + @SerializedName("parameter_display_name") + protected String parameterDisplayName; + @SerializedName("parameter_type") + protected String parameterType; + + /** + * Builder. + */ + public static class Builder { + private String assessmentType; + private String assessmentId; + private String parameterName; + private String parameterDefaultValue; + private String parameterDisplayName; + private String parameterType; + + /** + * Instantiates a new Builder from an existing DefaultParameters instance. + * + * @param defaultParameters the instance to initialize the Builder with + */ + private Builder(DefaultParameters defaultParameters) { + this.assessmentType = defaultParameters.assessmentType; + this.assessmentId = defaultParameters.assessmentId; + this.parameterName = defaultParameters.parameterName; + this.parameterDefaultValue = defaultParameters.parameterDefaultValue; + this.parameterDisplayName = defaultParameters.parameterDisplayName; + this.parameterType = defaultParameters.parameterType; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a DefaultParameters. + * + * @return the new DefaultParameters instance + */ + public DefaultParameters build() { + return new DefaultParameters(this); + } + + /** + * Set the assessmentType. + * + * @param assessmentType the assessmentType + * @return the DefaultParameters builder + */ + public Builder assessmentType(String assessmentType) { + this.assessmentType = assessmentType; + return this; + } + + /** + * Set the assessmentId. + * + * @param assessmentId the assessmentId + * @return the DefaultParameters builder + */ + public Builder assessmentId(String assessmentId) { + this.assessmentId = assessmentId; + return this; + } + + /** + * Set the parameterName. + * + * @param parameterName the parameterName + * @return the DefaultParameters builder + */ + public Builder parameterName(String parameterName) { + this.parameterName = parameterName; + return this; + } + + /** + * Set the parameterDefaultValue. + * + * @param parameterDefaultValue the parameterDefaultValue + * @return the DefaultParameters builder + */ + public Builder parameterDefaultValue(String parameterDefaultValue) { + this.parameterDefaultValue = parameterDefaultValue; + return this; + } + + /** + * Set the parameterDisplayName. + * + * @param parameterDisplayName the parameterDisplayName + * @return the DefaultParameters builder + */ + public Builder parameterDisplayName(String parameterDisplayName) { + this.parameterDisplayName = parameterDisplayName; + return this; + } + + /** + * Set the parameterType. + * + * @param parameterType the parameterType + * @return the DefaultParameters builder + */ + public Builder parameterType(String parameterType) { + this.parameterType = parameterType; + return this; + } + } + + protected DefaultParameters() { } + + protected DefaultParameters(Builder builder) { + assessmentType = builder.assessmentType; + assessmentId = builder.assessmentId; + parameterName = builder.parameterName; + parameterDefaultValue = builder.parameterDefaultValue; + parameterDisplayName = builder.parameterDisplayName; + parameterType = builder.parameterType; + } + + /** + * New builder. + * + * @return a DefaultParameters builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the assessmentType. + * + * The type of the implementation. + * + * @return the assessmentType + */ + public String assessmentType() { + return assessmentType; + } + + /** + * Gets the assessmentId. + * + * The implementation ID of the parameter. + * + * @return the assessmentId + */ + public String assessmentId() { + return assessmentId; + } + + /** + * Gets the parameterName. + * + * The parameter's name. + * + * @return the parameterName + */ + public String parameterName() { + return parameterName; + } + + /** + * Gets the parameterDefaultValue. + * + * The default value of the parameter. + * + * @return the parameterDefaultValue + */ + public String parameterDefaultValue() { + return parameterDefaultValue; + } + + /** + * Gets the parameterDisplayName. + * + * The parameter display name. + * + * @return the parameterDisplayName + */ + public String parameterDisplayName() { + return parameterDisplayName; + } + + /** + * Gets the parameterType. + * + * The parameter type. + * + * @return the parameterType + */ + public String parameterType() { + return parameterType; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersChanges.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersChanges.java new file mode 100644 index 00000000..2d6badcd --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersChanges.java @@ -0,0 +1,104 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Shows details of the parameters that were changed. + */ +public class DefaultParametersChanges extends GenericModel { + + @SerializedName("total_added") + protected Long totalAdded; + @SerializedName("total_removed") + protected Long totalRemoved; + @SerializedName("total_updated") + protected Long totalUpdated; + protected List added; + protected List removed; + protected List updated; + + protected DefaultParametersChanges() { } + + /** + * Gets the totalAdded. + * + * Number of parameters added. + * + * @return the totalAdded + */ + public Long getTotalAdded() { + return totalAdded; + } + + /** + * Gets the totalRemoved. + * + * Number of parameters removed. + * + * @return the totalRemoved + */ + public Long getTotalRemoved() { + return totalRemoved; + } + + /** + * Gets the totalUpdated. + * + * Number of parameters updated. + * + * @return the totalUpdated + */ + public Long getTotalUpdated() { + return totalUpdated; + } + + /** + * Gets the added. + * + * List of parameters added. + * + * @return the added + */ + public List getAdded() { + return added; + } + + /** + * Gets the removed. + * + * List of parameters removed. + * + * @return the removed + */ + public List getRemoved() { + return removed; + } + + /** + * Gets the updated. + * + * List of parameters updated. + * + * @return the updated + */ + public List getUpdated() { + return updated; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersDifference.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersDifference.java new file mode 100644 index 00000000..a52f454b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersDifference.java @@ -0,0 +1,50 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * Details the difference between the current parameters compared to the latest. + */ +public class DefaultParametersDifference extends GenericModel { + + protected DefaultParameters current; + protected DefaultParameters latest; + + protected DefaultParametersDifference() { } + + /** + * Gets the current. + * + * The parameters of the profile that are inherently set by the profile. + * + * @return the current + */ + public DefaultParameters getCurrent() { + return current; + } + + /** + * Gets the latest. + * + * The parameters of the profile that are inherently set by the profile. + * + * @return the latest + */ + public DefaultParameters getLatest() { + return latest; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomControlLibraryOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomControlLibraryOptions.java index 349d80ca..332f345f 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomControlLibraryOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomControlLibraryOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,17 @@ */ public class DeleteCustomControlLibraryOptions extends GenericModel { - protected String controlLibrariesId; - protected String xCorrelationId; - protected String xRequestId; + protected String instanceId; + protected String controlLibraryId; + protected String accountId; /** * Builder. */ public static class Builder { - private String controlLibrariesId; - private String xCorrelationId; - private String xRequestId; + private String instanceId; + private String controlLibraryId; + private String accountId; /** * Instantiates a new Builder from an existing DeleteCustomControlLibraryOptions instance. @@ -37,9 +38,9 @@ public static class Builder { * @param deleteCustomControlLibraryOptions the instance to initialize the Builder with */ private Builder(DeleteCustomControlLibraryOptions deleteCustomControlLibraryOptions) { - this.controlLibrariesId = deleteCustomControlLibraryOptions.controlLibrariesId; - this.xCorrelationId = deleteCustomControlLibraryOptions.xCorrelationId; - this.xRequestId = deleteCustomControlLibraryOptions.xRequestId; + this.instanceId = deleteCustomControlLibraryOptions.instanceId; + this.controlLibraryId = deleteCustomControlLibraryOptions.controlLibraryId; + this.accountId = deleteCustomControlLibraryOptions.accountId; } /** @@ -51,10 +52,12 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param controlLibrariesId the controlLibrariesId + * @param instanceId the instanceId + * @param controlLibraryId the controlLibraryId */ - public Builder(String controlLibrariesId) { - this.controlLibrariesId = controlLibrariesId; + public Builder(String instanceId, String controlLibraryId) { + this.instanceId = instanceId; + this.controlLibraryId = controlLibraryId; } /** @@ -67,35 +70,35 @@ public DeleteCustomControlLibraryOptions build() { } /** - * Set the controlLibrariesId. + * Set the instanceId. * - * @param controlLibrariesId the controlLibrariesId + * @param instanceId the instanceId * @return the DeleteCustomControlLibraryOptions builder */ - public Builder controlLibrariesId(String controlLibrariesId) { - this.controlLibrariesId = controlLibrariesId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. + * Set the controlLibraryId. * - * @param xCorrelationId the xCorrelationId + * @param controlLibraryId the controlLibraryId * @return the DeleteCustomControlLibraryOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder controlLibraryId(String controlLibraryId) { + this.controlLibraryId = controlLibraryId; return this; } /** - * Set the xRequestId. + * Set the accountId. * - * @param xRequestId the xRequestId + * @param accountId the accountId * @return the DeleteCustomControlLibraryOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } } @@ -103,11 +106,13 @@ public Builder xRequestId(String xRequestId) { protected DeleteCustomControlLibraryOptions() { } protected DeleteCustomControlLibraryOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.controlLibrariesId, - "controlLibrariesId cannot be empty"); - controlLibrariesId = builder.controlLibrariesId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.controlLibraryId, + "controlLibraryId cannot be empty"); + instanceId = builder.instanceId; + controlLibraryId = builder.controlLibraryId; + accountId = builder.accountId; } /** @@ -120,40 +125,36 @@ public Builder newBuilder() { } /** - * Gets the controlLibrariesId. + * Gets the instanceId. * - * The control library ID. + * The ID of the Security and Compliance Center instance. * - * @return the controlLibrariesId + * @return the instanceId */ - public String controlLibrariesId() { - return controlLibrariesId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. + * Gets the controlLibraryId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The control library ID. * - * @return the xCorrelationId + * @return the controlLibraryId */ - public String xCorrelationId() { - return xCorrelationId; + public String controlLibraryId() { + return controlLibraryId; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } } 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 aea57c50..921aa54c 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,17 @@ */ public class DeleteCustomProfileOptions extends GenericModel { + protected String instanceId; protected String profileId; - protected String xCorrelationId; - protected String xRequestId; + protected String accountId; /** * Builder. */ public static class Builder { + private String instanceId; private String profileId; - private String xCorrelationId; - private String xRequestId; + private String accountId; /** * Instantiates a new Builder from an existing DeleteCustomProfileOptions instance. @@ -37,9 +38,9 @@ public static class Builder { * @param deleteCustomProfileOptions the instance to initialize the Builder with */ private Builder(DeleteCustomProfileOptions deleteCustomProfileOptions) { + this.instanceId = deleteCustomProfileOptions.instanceId; this.profileId = deleteCustomProfileOptions.profileId; - this.xCorrelationId = deleteCustomProfileOptions.xCorrelationId; - this.xRequestId = deleteCustomProfileOptions.xRequestId; + this.accountId = deleteCustomProfileOptions.accountId; } /** @@ -51,9 +52,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param profileId the profileId */ - public Builder(String profileId) { + public Builder(String instanceId, String profileId) { + this.instanceId = instanceId; this.profileId = profileId; } @@ -67,35 +70,35 @@ public DeleteCustomProfileOptions build() { } /** - * Set the profileId. + * Set the instanceId. * - * @param profileId the profileId + * @param instanceId the instanceId * @return the DeleteCustomProfileOptions builder */ - public Builder profileId(String profileId) { - this.profileId = profileId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. + * Set the profileId. * - * @param xCorrelationId the xCorrelationId + * @param profileId the profileId * @return the DeleteCustomProfileOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } /** - * Set the xRequestId. + * Set the accountId. * - * @param xRequestId the xRequestId + * @param accountId the accountId * @return the DeleteCustomProfileOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } } @@ -103,11 +106,13 @@ public Builder xRequestId(String xRequestId) { protected DeleteCustomProfileOptions() { } protected DeleteCustomProfileOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, "profileId cannot be empty"); + instanceId = builder.instanceId; profileId = builder.profileId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + accountId = builder.accountId; } /** @@ -120,40 +125,36 @@ public Builder newBuilder() { } /** - * Gets the profileId. + * Gets the instanceId. * - * The profile ID. + * The ID of the Security and Compliance Center instance. * - * @return the profileId + * @return the instanceId */ - public String profileId() { - return profileId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. + * Gets the profileId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The profile ID. * - * @return the xCorrelationId + * @return the profileId */ - public String xCorrelationId() { - return xCorrelationId; + public String profileId() { + return profileId; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } } 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 55c596e1..f927be5e 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,19 +20,19 @@ */ public class DeleteProfileAttachmentOptions extends GenericModel { - protected String attachmentId; + protected String instanceId; protected String profileId; - protected String xCorrelationId; - protected String xRequestId; + protected String attachmentId; + protected String accountId; /** * Builder. */ public static class Builder { - private String attachmentId; + private String instanceId; private String profileId; - private String xCorrelationId; - private String xRequestId; + private String attachmentId; + private String accountId; /** * Instantiates a new Builder from an existing DeleteProfileAttachmentOptions instance. @@ -39,10 +40,10 @@ public static class Builder { * @param deleteProfileAttachmentOptions the instance to initialize the Builder with */ private Builder(DeleteProfileAttachmentOptions deleteProfileAttachmentOptions) { - this.attachmentId = deleteProfileAttachmentOptions.attachmentId; + this.instanceId = deleteProfileAttachmentOptions.instanceId; this.profileId = deleteProfileAttachmentOptions.profileId; - this.xCorrelationId = deleteProfileAttachmentOptions.xCorrelationId; - this.xRequestId = deleteProfileAttachmentOptions.xRequestId; + this.attachmentId = deleteProfileAttachmentOptions.attachmentId; + this.accountId = deleteProfileAttachmentOptions.accountId; } /** @@ -54,12 +55,14 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param attachmentId the attachmentId + * @param instanceId the instanceId * @param profileId the profileId + * @param attachmentId the attachmentId */ - public Builder(String attachmentId, String profileId) { - this.attachmentId = attachmentId; + public Builder(String instanceId, String profileId, String attachmentId) { + this.instanceId = instanceId; this.profileId = profileId; + this.attachmentId = attachmentId; } /** @@ -72,13 +75,13 @@ public DeleteProfileAttachmentOptions build() { } /** - * Set the attachmentId. + * Set the instanceId. * - * @param attachmentId the attachmentId + * @param instanceId the instanceId * @return the DeleteProfileAttachmentOptions builder */ - public Builder attachmentId(String attachmentId) { - this.attachmentId = attachmentId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } @@ -94,24 +97,24 @@ public Builder profileId(String profileId) { } /** - * Set the xCorrelationId. + * Set the attachmentId. * - * @param xCorrelationId the xCorrelationId + * @param attachmentId the attachmentId * @return the DeleteProfileAttachmentOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder attachmentId(String attachmentId) { + this.attachmentId = attachmentId; return this; } /** - * Set the xRequestId. + * Set the accountId. * - * @param xRequestId the xRequestId + * @param accountId the accountId * @return the DeleteProfileAttachmentOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } } @@ -119,14 +122,16 @@ public Builder xRequestId(String xRequestId) { 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.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, "profileId cannot be empty"); - attachmentId = builder.attachmentId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.attachmentId, + "attachmentId cannot be empty"); + instanceId = builder.instanceId; profileId = builder.profileId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + attachmentId = builder.attachmentId; + accountId = builder.accountId; } /** @@ -139,14 +144,14 @@ public Builder newBuilder() { } /** - * Gets the attachmentId. + * Gets the instanceId. * - * The attachment ID. + * The ID of the Security and Compliance Center instance. * - * @return the attachmentId + * @return the instanceId */ - public String attachmentId() { - return attachmentId; + public String instanceId() { + return instanceId; } /** @@ -161,29 +166,25 @@ public String profileId() { } /** - * Gets the xCorrelationId. + * Gets the attachmentId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The attachment ID. * - * @return the xCorrelationId + * @return the attachmentId */ - public String xCorrelationId() { - return xCorrelationId; + public String attachmentId() { + return attachmentId; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProviderTypeInstanceOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProviderTypeInstanceOptions.java index f94e8ce1..af0faa25 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProviderTypeInstanceOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProviderTypeInstanceOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,19 +20,17 @@ */ public class DeleteProviderTypeInstanceOptions extends GenericModel { + protected String instanceId; protected String providerTypeId; protected String providerTypeInstanceId; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String providerTypeId; private String providerTypeInstanceId; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing DeleteProviderTypeInstanceOptions instance. @@ -39,10 +38,9 @@ public static class Builder { * @param deleteProviderTypeInstanceOptions the instance to initialize the Builder with */ private Builder(DeleteProviderTypeInstanceOptions deleteProviderTypeInstanceOptions) { + this.instanceId = deleteProviderTypeInstanceOptions.instanceId; this.providerTypeId = deleteProviderTypeInstanceOptions.providerTypeId; this.providerTypeInstanceId = deleteProviderTypeInstanceOptions.providerTypeInstanceId; - this.xCorrelationId = deleteProviderTypeInstanceOptions.xCorrelationId; - this.xRequestId = deleteProviderTypeInstanceOptions.xRequestId; } /** @@ -54,10 +52,12 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param providerTypeId the providerTypeId * @param providerTypeInstanceId the providerTypeInstanceId */ - public Builder(String providerTypeId, String providerTypeInstanceId) { + public Builder(String instanceId, String providerTypeId, String providerTypeInstanceId) { + this.instanceId = instanceId; this.providerTypeId = providerTypeId; this.providerTypeInstanceId = providerTypeInstanceId; } @@ -71,6 +71,17 @@ public DeleteProviderTypeInstanceOptions build() { return new DeleteProviderTypeInstanceOptions(this); } + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the DeleteProviderTypeInstanceOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + /** * Set the providerTypeId. * @@ -92,41 +103,20 @@ public Builder providerTypeInstanceId(String providerTypeInstanceId) { this.providerTypeInstanceId = providerTypeInstanceId; return this; } - - /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the DeleteProviderTypeInstanceOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. - * - * @param xRequestId the xRequestId - * @return the DeleteProviderTypeInstanceOptions builder - */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; - return this; - } } protected DeleteProviderTypeInstanceOptions() { } protected DeleteProviderTypeInstanceOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerTypeId, "providerTypeId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerTypeInstanceId, "providerTypeInstanceId cannot be empty"); + instanceId = builder.instanceId; providerTypeId = builder.providerTypeId; providerTypeInstanceId = builder.providerTypeInstanceId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -138,6 +128,17 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + /** * Gets the providerTypeId. * @@ -159,31 +160,5 @@ public String providerTypeId() { public String providerTypeInstanceId() { return providerTypeInstanceId; } - - /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this headers is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this headers is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xRequestId - */ - public String xRequestId() { - return xRequestId; - } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteRuleOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteRuleOptions.java index ad8df5e5..4ce9128a 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteRuleOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteRuleOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,15 @@ */ public class DeleteRuleOptions extends GenericModel { + protected String instanceId; protected String ruleId; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String ruleId; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing DeleteRuleOptions instance. @@ -37,9 +36,8 @@ public static class Builder { * @param deleteRuleOptions the instance to initialize the Builder with */ private Builder(DeleteRuleOptions deleteRuleOptions) { + this.instanceId = deleteRuleOptions.instanceId; this.ruleId = deleteRuleOptions.ruleId; - this.xCorrelationId = deleteRuleOptions.xCorrelationId; - this.xRequestId = deleteRuleOptions.xRequestId; } /** @@ -51,9 +49,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param ruleId the ruleId */ - public Builder(String ruleId) { + public Builder(String instanceId, String ruleId) { + this.instanceId = instanceId; this.ruleId = ruleId; } @@ -67,35 +67,24 @@ public DeleteRuleOptions build() { } /** - * Set the ruleId. + * Set the instanceId. * - * @param ruleId the ruleId + * @param instanceId the instanceId * @return the DeleteRuleOptions builder */ - public Builder ruleId(String ruleId) { - this.ruleId = ruleId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the DeleteRuleOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. + * Set the ruleId. * - * @param xRequestId the xRequestId + * @param ruleId the ruleId * @return the DeleteRuleOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder ruleId(String ruleId) { + this.ruleId = ruleId; return this; } } @@ -103,11 +92,12 @@ public Builder xRequestId(String xRequestId) { protected DeleteRuleOptions() { } protected DeleteRuleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.ruleId, "ruleId cannot be empty"); + instanceId = builder.instanceId; ruleId = builder.ruleId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -120,40 +110,25 @@ public Builder newBuilder() { } /** - * Gets the ruleId. + * Gets the instanceId. * - * The ID of the corresponding rule. + * The ID of the Security and Compliance Center instance. * - * @return the ruleId + * @return the instanceId */ - public String ruleId() { - return ruleId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the ruleId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of a rule/assessment. * - * @return the xRequestId + * @return the ruleId */ - public String xRequestId() { - return xRequestId; + public String ruleId() { + return ruleId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteScopeOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteScopeOptions.java new file mode 100644 index 00000000..ddbe93b9 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteScopeOptions.java @@ -0,0 +1,134 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 deleteScope options. + */ +public class DeleteScopeOptions extends GenericModel { + + protected String instanceId; + protected String scopeId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String scopeId; + + /** + * Instantiates a new Builder from an existing DeleteScopeOptions instance. + * + * @param deleteScopeOptions the instance to initialize the Builder with + */ + private Builder(DeleteScopeOptions deleteScopeOptions) { + this.instanceId = deleteScopeOptions.instanceId; + this.scopeId = deleteScopeOptions.scopeId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param scopeId the scopeId + */ + public Builder(String instanceId, String scopeId) { + this.instanceId = instanceId; + this.scopeId = scopeId; + } + + /** + * Builds a DeleteScopeOptions. + * + * @return the new DeleteScopeOptions instance + */ + public DeleteScopeOptions build() { + return new DeleteScopeOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the DeleteScopeOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the DeleteScopeOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + } + + protected DeleteScopeOptions() { } + + protected DeleteScopeOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.scopeId, + "scopeId cannot be empty"); + instanceId = builder.instanceId; + scopeId = builder.scopeId; + } + + /** + * New builder. + * + * @return a DeleteScopeOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope being targeted. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteSubscopeOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteSubscopeOptions.java new file mode 100644 index 00000000..c7ed3098 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteSubscopeOptions.java @@ -0,0 +1,164 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 deleteSubscope options. + */ +public class DeleteSubscopeOptions extends GenericModel { + + protected String instanceId; + protected String scopeId; + protected String subscopeId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String scopeId; + private String subscopeId; + + /** + * Instantiates a new Builder from an existing DeleteSubscopeOptions instance. + * + * @param deleteSubscopeOptions the instance to initialize the Builder with + */ + private Builder(DeleteSubscopeOptions deleteSubscopeOptions) { + this.instanceId = deleteSubscopeOptions.instanceId; + this.scopeId = deleteSubscopeOptions.scopeId; + this.subscopeId = deleteSubscopeOptions.subscopeId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param scopeId the scopeId + * @param subscopeId the subscopeId + */ + public Builder(String instanceId, String scopeId, String subscopeId) { + this.instanceId = instanceId; + this.scopeId = scopeId; + this.subscopeId = subscopeId; + } + + /** + * Builds a DeleteSubscopeOptions. + * + * @return the new DeleteSubscopeOptions instance + */ + public DeleteSubscopeOptions build() { + return new DeleteSubscopeOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the DeleteSubscopeOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the DeleteSubscopeOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the subscopeId. + * + * @param subscopeId the subscopeId + * @return the DeleteSubscopeOptions builder + */ + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; + return this; + } + } + + protected DeleteSubscopeOptions() { } + + protected DeleteSubscopeOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.scopeId, + "scopeId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.subscopeId, + "subscopeId cannot be empty"); + instanceId = builder.instanceId; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; + } + + /** + * New builder. + * + * @return a DeleteSubscopeOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope being targeted. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The ID of the scope being targeted. + * + * @return the subscopeId + */ + public String subscopeId() { + return subscopeId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteTargetOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteTargetOptions.java new file mode 100644 index 00000000..b371b31d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteTargetOptions.java @@ -0,0 +1,134 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 deleteTarget options. + */ +public class DeleteTargetOptions extends GenericModel { + + protected String instanceId; + protected String targetId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String targetId; + + /** + * Instantiates a new Builder from an existing DeleteTargetOptions instance. + * + * @param deleteTargetOptions the instance to initialize the Builder with + */ + private Builder(DeleteTargetOptions deleteTargetOptions) { + this.instanceId = deleteTargetOptions.instanceId; + this.targetId = deleteTargetOptions.targetId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param targetId the targetId + */ + public Builder(String instanceId, String targetId) { + this.instanceId = instanceId; + this.targetId = targetId; + } + + /** + * Builds a DeleteTargetOptions. + * + * @return the new DeleteTargetOptions instance + */ + public DeleteTargetOptions build() { + return new DeleteTargetOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the DeleteTargetOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the targetId. + * + * @param targetId the targetId + * @return the DeleteTargetOptions builder + */ + public Builder targetId(String targetId) { + this.targetId = targetId; + return this; + } + } + + protected DeleteTargetOptions() { } + + protected DeleteTargetOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.targetId, + "targetId cannot be empty"); + instanceId = builder.instanceId; + targetId = builder.targetId; + } + + /** + * New builder. + * + * @return a DeleteTargetOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the targetId. + * + * The target ID. + * + * @return the targetId + */ + public String targetId() { + return targetId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Endpoint.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Endpoint.java new file mode 100644 index 00000000..072ed402 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Endpoint.java @@ -0,0 +1,76 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The service configurations endpoint. + */ +public class Endpoint extends GenericModel { + + protected String host; + protected String path; + protected String region; + @SerializedName("advisory_call_limit") + protected Long advisoryCallLimit; + + protected Endpoint() { } + + /** + * Gets the host. + * + * The endpoint host. + * + * @return the host + */ + public String getHost() { + return host; + } + + /** + * Gets the path. + * + * The endpoint path. + * + * @return the path + */ + public String getPath() { + return path; + } + + /** + * Gets the region. + * + * The endpoint region. + * + * @return the region + */ + public String getRegion() { + return region; + } + + /** + * Gets the advisoryCallLimit. + * + * The endpoints advisory call limit. + * + * @return the advisoryCallLimit + */ + public Long getAdvisoryCallLimit() { + return advisoryCallLimit; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvalStats.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvalStats.java index 21aa0da6..1a1ed223 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvalStats.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvalStats.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; @@ -32,6 +33,8 @@ public interface Status { String UNABLE_TO_PERFORM = "unable_to_perform"; /** user_evaluation_required. */ String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; } protected String status; @@ -43,6 +46,8 @@ public interface Status { protected Long failureCount; @SerializedName("error_count") protected Long errorCount; + @SerializedName("skipped_count") + protected Long skippedCount; @SerializedName("completed_count") protected Long completedCount; @@ -103,6 +108,17 @@ public Long getErrorCount() { return errorCount; } + /** + * Gets the skippedCount. + * + * The number of assessments with no corresponding evaluations. + * + * @return the skippedCount + */ + public Long getSkippedCount() { + return skippedCount; + } + /** * Gets the completedCount. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Evaluation.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Evaluation.java index 2e7d56b2..1836623d 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Evaluation.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Evaluation.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; @@ -34,35 +35,26 @@ public interface Status { String SKIPPED = "skipped"; } - @SerializedName("home_account_id") - protected String homeAccountId; @SerializedName("report_id") protected String reportId; - @SerializedName("control_id") - protected String controlId; + @SerializedName("home_account_id") + protected String homeAccountId; @SerializedName("component_id") protected String componentId; + @SerializedName("component_name") + protected String componentName; protected Assessment assessment; @SerializedName("evaluate_time") protected String evaluateTime; protected TargetInfo target; protected String status; protected String reason; - protected EvalDetails details; + protected EvaluationDetails details; + @SerializedName("evaluated_by") + protected String evaluatedBy; protected Evaluation() { } - /** - * Gets the homeAccountId. - * - * The ID of the home account. - * - * @return the homeAccountId - */ - public String getHomeAccountId() { - return homeAccountId; - } - /** * Gets the reportId. * @@ -75,14 +67,14 @@ public String getReportId() { } /** - * Gets the controlId. + * Gets the homeAccountId. * - * The control ID. + * The ID of the home account. * - * @return the controlId + * @return the homeAccountId */ - public String getControlId() { - return controlId; + public String getHomeAccountId() { + return homeAccountId; } /** @@ -96,6 +88,17 @@ public String getComponentId() { return componentId; } + /** + * Gets the componentName. + * + * The components name. + * + * @return the componentName + */ + public String getComponentName() { + return componentName; + } + /** * Gets the assessment. * @@ -154,12 +157,23 @@ public String getReason() { /** * Gets the details. * - * The evaluation details. + * A list of details related to the Evaluation. * * @return the details */ - public EvalDetails getDetails() { + public EvaluationDetails getDetails() { return details; } + + /** + * Gets the evaluatedBy. + * + * By whom the evaluation was made for erictree results. + * + * @return the evaluatedBy + */ + public String getEvaluatedBy() { + return evaluatedBy; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationDetails.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationDetails.java new file mode 100644 index 00000000..fb781de7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationDetails.java @@ -0,0 +1,55 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A list of details related to the Evaluation. + */ +public class EvaluationDetails extends GenericModel { + + @SerializedName("properties") + protected List xProperties; + @SerializedName("provider_info") + protected EvaluationProviderInfo providerInfo; + + protected EvaluationDetails() { } + + /** + * Gets the xProperties. + * + * Details the evaluations that were incorrect. + * + * @return the xProperties + */ + public List getXProperties() { + return xProperties; + } + + /** + * Gets the providerInfo. + * + * The source provider of the evaluation. + * + * @return the providerInfo + */ + public EvaluationProviderInfo getProviderInfo() { + return providerInfo; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPage.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPage.java index 9ea665c1..acf2817b 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPage.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPage.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -22,35 +23,23 @@ */ public class EvaluationPage extends GenericModel { + protected Long limit; @SerializedName("total_count") protected Long totalCount; - protected Long limit; - protected String start; - protected PageHRef first; - protected PageHRef next; - @SerializedName("home_account_id") - protected String homeAccountId; + protected PageHRefFirst first; + protected PageHRefNext next; @SerializedName("report_id") protected String reportId; + @SerializedName("home_account_id") + protected String homeAccountId; protected List evaluations; protected EvaluationPage() { } - /** - * Gets the totalCount. - * - * The total number of resources that are in the collection. - * - * @return the totalCount - */ - public Long getTotalCount() { - return totalCount; - } - /** * Gets the limit. * - * The requested page limi.t. + * The requested page limit. * * @return the limit */ @@ -59,58 +48,58 @@ public Long getLimit() { } /** - * Gets the start. + * Gets the totalCount. * - * The token of the next page, when it's present. + * The total number of resources that are in the collection. * - * @return the start + * @return the totalCount */ - public String getStart() { - return start; + public Long getTotalCount() { + return totalCount; } /** * Gets the first. * - * The page reference. + * A page reference. * * @return the first */ - public PageHRef getFirst() { + public PageHRefFirst getFirst() { return first; } /** * Gets the next. * - * The page reference. + * A page reference. * * @return the next */ - public PageHRef getNext() { + public PageHRefNext getNext() { return next; } /** - * Gets the homeAccountId. + * Gets the reportId. * - * The ID of the home account. + * The ID of the report. * - * @return the homeAccountId + * @return the reportId */ - public String getHomeAccountId() { - return homeAccountId; + public String getReportId() { + return reportId; } /** - * Gets the reportId. + * Gets the homeAccountId. * - * The ID of the report. + * The ID of the home account. * - * @return the reportId + * @return the homeAccountId */ - public String getReportId() { - return reportId; + public String getHomeAccountId() { + return homeAccountId; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProperty.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProperty.java new file mode 100644 index 00000000..02c1c0c7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProperty.java @@ -0,0 +1,142 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * An aspect of the evaluation. + */ +public class EvaluationProperty extends GenericModel { + + /** + * The operator used during the evaluation. + */ + 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 property; + @SerializedName("property_description") + protected String propertyDescription; + protected String operator; + @SerializedName("expected_value") + protected Object expectedValue; + @SerializedName("found_value") + protected Object foundValue; + + protected EvaluationProperty() { } + + /** + * Gets the property. + * + * The attribute of the resource. + * + * @return the property + */ + public String getProperty() { + return property; + } + + /** + * Gets the propertyDescription. + * + * An explanation of the resourcer. + * + * @return the propertyDescription + */ + public String getPropertyDescription() { + return propertyDescription; + } + + /** + * Gets the operator. + * + * The operator used during the evaluation. + * + * @return the operator + */ + public String getOperator() { + return operator; + } + + /** + * Gets the expectedValue. + * + * The value can be of any type. + * + * @return the expectedValue + */ + public Object getExpectedValue() { + return expectedValue; + } + + /** + * Gets the foundValue. + * + * The value can be of any type. + * + * @return the foundValue + */ + public Object getFoundValue() { + return foundValue; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProviderInfo.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProviderInfo.java new file mode 100644 index 00000000..4a74a43c --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProviderInfo.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The source provider of the evaluation. + */ +public class EvaluationProviderInfo extends GenericModel { + + @SerializedName("provider_type") + protected String providerType; + + protected EvaluationProviderInfo() { } + + /** + * Gets the providerType. + * + * Details the source of the evaluation. + * + * @return the providerType + */ + public String getProviderType() { + return providerType; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotifications.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotifications.java index da4de0fe..1ec76c7f 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotifications.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotifications.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; @@ -33,119 +34,8 @@ public class EventNotifications extends GenericModel { @SerializedName("source_name") protected String sourceName; - /** - * Builder. - */ - public static class Builder { - private String instanceCrn; - private Date updatedOn; - private String sourceId; - private String sourceDescription; - private String sourceName; - - /** - * Instantiates a new Builder from an existing EventNotifications instance. - * - * @param eventNotifications the instance to initialize the Builder with - */ - private Builder(EventNotifications eventNotifications) { - this.instanceCrn = eventNotifications.instanceCrn; - this.updatedOn = eventNotifications.updatedOn; - this.sourceId = eventNotifications.sourceId; - this.sourceDescription = eventNotifications.sourceDescription; - this.sourceName = eventNotifications.sourceName; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a EventNotifications. - * - * @return the new EventNotifications instance - */ - public EventNotifications build() { - return new EventNotifications(this); - } - - /** - * Set the instanceCrn. - * - * @param instanceCrn the instanceCrn - * @return the EventNotifications builder - */ - public Builder instanceCrn(String instanceCrn) { - this.instanceCrn = instanceCrn; - return this; - } - - /** - * Set the updatedOn. - * - * @param updatedOn the updatedOn - * @return the EventNotifications builder - */ - public Builder updatedOn(Date updatedOn) { - this.updatedOn = updatedOn; - return this; - } - - /** - * Set the sourceId. - * - * @param sourceId the sourceId - * @return the EventNotifications builder - */ - public Builder sourceId(String sourceId) { - this.sourceId = sourceId; - return this; - } - - /** - * Set the sourceDescription. - * - * @param sourceDescription the sourceDescription - * @return the EventNotifications builder - */ - public Builder sourceDescription(String sourceDescription) { - this.sourceDescription = sourceDescription; - return this; - } - - /** - * Set the sourceName. - * - * @param sourceName the sourceName - * @return the EventNotifications builder - */ - public Builder sourceName(String sourceName) { - this.sourceName = sourceName; - return this; - } - } - protected EventNotifications() { } - protected EventNotifications(Builder builder) { - instanceCrn = builder.instanceCrn; - updatedOn = builder.updatedOn; - sourceId = builder.sourceId; - sourceDescription = builder.sourceDescription; - sourceName = builder.sourceName; - } - - /** - * New builder. - * - * @return a EventNotifications builder - */ - public Builder newBuilder() { - return new Builder(this); - } - /** * Gets the instanceCrn. * @@ -153,7 +43,7 @@ public Builder newBuilder() { * * @return the instanceCrn */ - public String instanceCrn() { + public String getInstanceCrn() { return instanceCrn; } @@ -164,7 +54,7 @@ public String instanceCrn() { * * @return the updatedOn */ - public Date updatedOn() { + public Date getUpdatedOn() { return updatedOn; } @@ -175,7 +65,7 @@ public Date updatedOn() { * * @return the sourceId */ - public String sourceId() { + public String getSourceId() { return sourceId; } @@ -186,7 +76,7 @@ public String sourceId() { * * @return the sourceDescription */ - public String sourceDescription() { + public String getSourceDescription() { return sourceDescription; } @@ -197,7 +87,7 @@ public String sourceDescription() { * * @return the sourceName */ - public String sourceName() { + public String getSourceName() { return sourceName; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsPrototype.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsPrototype.java new file mode 100644 index 00000000..a8e93c0b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsPrototype.java @@ -0,0 +1,149 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The payload to connect an Event Notification instance with a Security and Compliance Center instance. + */ +public class EventNotificationsPrototype extends GenericModel { + + @SerializedName("instance_crn") + protected String instanceCrn; + @SerializedName("source_description") + protected String sourceDescription; + @SerializedName("source_name") + protected String sourceName; + + /** + * Builder. + */ + public static class Builder { + private String instanceCrn; + private String sourceDescription; + private String sourceName; + + /** + * Instantiates a new Builder from an existing EventNotificationsPrototype instance. + * + * @param eventNotificationsPrototype the instance to initialize the Builder with + */ + private Builder(EventNotificationsPrototype eventNotificationsPrototype) { + this.instanceCrn = eventNotificationsPrototype.instanceCrn; + this.sourceDescription = eventNotificationsPrototype.sourceDescription; + this.sourceName = eventNotificationsPrototype.sourceName; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a EventNotificationsPrototype. + * + * @return the new EventNotificationsPrototype instance + */ + public EventNotificationsPrototype build() { + return new EventNotificationsPrototype(this); + } + + /** + * Set the instanceCrn. + * + * @param instanceCrn the instanceCrn + * @return the EventNotificationsPrototype builder + */ + public Builder instanceCrn(String instanceCrn) { + this.instanceCrn = instanceCrn; + return this; + } + + /** + * Set the sourceDescription. + * + * @param sourceDescription the sourceDescription + * @return the EventNotificationsPrototype builder + */ + public Builder sourceDescription(String sourceDescription) { + this.sourceDescription = sourceDescription; + return this; + } + + /** + * Set the sourceName. + * + * @param sourceName the sourceName + * @return the EventNotificationsPrototype builder + */ + public Builder sourceName(String sourceName) { + this.sourceName = sourceName; + return this; + } + } + + protected EventNotificationsPrototype() { } + + protected EventNotificationsPrototype(Builder builder) { + instanceCrn = builder.instanceCrn; + sourceDescription = builder.sourceDescription; + sourceName = builder.sourceName; + } + + /** + * New builder. + * + * @return a EventNotificationsPrototype builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceCrn. + * + * The CRN of the Event Notification instance to connect. + * + * @return the instanceCrn + */ + public String instanceCrn() { + return instanceCrn; + } + + /** + * Gets the sourceDescription. + * + * The description of the source of the Event Notifications. + * + * @return the sourceDescription + */ + public String sourceDescription() { + return sourceDescription; + } + + /** + * Gets the sourceName. + * + * The name of the source of the Event Notifications. + * + * @return the sourceName + */ + public String sourceName() { + return sourceName; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetControlLibraryOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetControlLibraryOptions.java index e115ea66..5b42d27a 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetControlLibraryOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetControlLibraryOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,17 @@ */ public class GetControlLibraryOptions extends GenericModel { - protected String controlLibrariesId; - protected String xCorrelationId; - protected String xRequestId; + protected String instanceId; + protected String controlLibraryId; + protected String accountId; /** * Builder. */ public static class Builder { - private String controlLibrariesId; - private String xCorrelationId; - private String xRequestId; + private String instanceId; + private String controlLibraryId; + private String accountId; /** * Instantiates a new Builder from an existing GetControlLibraryOptions instance. @@ -37,9 +38,9 @@ public static class Builder { * @param getControlLibraryOptions the instance to initialize the Builder with */ private Builder(GetControlLibraryOptions getControlLibraryOptions) { - this.controlLibrariesId = getControlLibraryOptions.controlLibrariesId; - this.xCorrelationId = getControlLibraryOptions.xCorrelationId; - this.xRequestId = getControlLibraryOptions.xRequestId; + this.instanceId = getControlLibraryOptions.instanceId; + this.controlLibraryId = getControlLibraryOptions.controlLibraryId; + this.accountId = getControlLibraryOptions.accountId; } /** @@ -51,10 +52,12 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param controlLibrariesId the controlLibrariesId + * @param instanceId the instanceId + * @param controlLibraryId the controlLibraryId */ - public Builder(String controlLibrariesId) { - this.controlLibrariesId = controlLibrariesId; + public Builder(String instanceId, String controlLibraryId) { + this.instanceId = instanceId; + this.controlLibraryId = controlLibraryId; } /** @@ -67,35 +70,35 @@ public GetControlLibraryOptions build() { } /** - * Set the controlLibrariesId. + * Set the instanceId. * - * @param controlLibrariesId the controlLibrariesId + * @param instanceId the instanceId * @return the GetControlLibraryOptions builder */ - public Builder controlLibrariesId(String controlLibrariesId) { - this.controlLibrariesId = controlLibrariesId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. + * Set the controlLibraryId. * - * @param xCorrelationId the xCorrelationId + * @param controlLibraryId the controlLibraryId * @return the GetControlLibraryOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder controlLibraryId(String controlLibraryId) { + this.controlLibraryId = controlLibraryId; return this; } /** - * Set the xRequestId. + * Set the accountId. * - * @param xRequestId the xRequestId + * @param accountId the accountId * @return the GetControlLibraryOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } } @@ -103,11 +106,13 @@ public Builder xRequestId(String xRequestId) { protected GetControlLibraryOptions() { } protected GetControlLibraryOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.controlLibrariesId, - "controlLibrariesId cannot be empty"); - controlLibrariesId = builder.controlLibrariesId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.controlLibraryId, + "controlLibraryId cannot be empty"); + instanceId = builder.instanceId; + controlLibraryId = builder.controlLibraryId; + accountId = builder.accountId; } /** @@ -120,40 +125,36 @@ public Builder newBuilder() { } /** - * Gets the controlLibrariesId. + * Gets the instanceId. * - * The control library ID. + * The ID of the Security and Compliance Center instance. * - * @return the controlLibrariesId + * @return the instanceId */ - public String controlLibrariesId() { - return controlLibrariesId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. + * Gets the controlLibraryId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The control library ID. * - * @return the xCorrelationId + * @return the controlLibraryId */ - public String xCorrelationId() { - return xCorrelationId; + public String controlLibraryId() { + return controlLibraryId; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetLatestReportsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetLatestReportsOptions.java index 9b99103e..201b9284 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetLatestReportsOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetLatestReportsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,16 +20,27 @@ */ public class GetLatestReportsOptions extends GenericModel { - protected String xCorrelationId; - protected String xRequestId; + /** + * This field sorts controls by using a valid sort field. To learn more, see + * [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + */ + public interface Sort { + /** profile_name. */ + String PROFILE_NAME = "profile_name"; + /** scope_id. */ + String SCOPE_ID = "scope_id"; + /** created_on. */ + String CREATED_ON = "created_on"; + } + + protected String instanceId; protected String sort; /** * Builder. */ public static class Builder { - private String xCorrelationId; - private String xRequestId; + private String instanceId; private String sort; /** @@ -37,8 +49,7 @@ public static class Builder { * @param getLatestReportsOptions the instance to initialize the Builder with */ private Builder(GetLatestReportsOptions getLatestReportsOptions) { - this.xCorrelationId = getLatestReportsOptions.xCorrelationId; - this.xRequestId = getLatestReportsOptions.xRequestId; + this.instanceId = getLatestReportsOptions.instanceId; this.sort = getLatestReportsOptions.sort; } @@ -49,33 +60,31 @@ public Builder() { } /** - * Builds a GetLatestReportsOptions. + * Instantiates a new builder with required properties. * - * @return the new GetLatestReportsOptions instance + * @param instanceId the instanceId */ - public GetLatestReportsOptions build() { - return new GetLatestReportsOptions(this); + public Builder(String instanceId) { + this.instanceId = instanceId; } /** - * Set the xCorrelationId. + * Builds a GetLatestReportsOptions. * - * @param xCorrelationId the xCorrelationId - * @return the GetLatestReportsOptions builder + * @return the new GetLatestReportsOptions instance */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; + public GetLatestReportsOptions build() { + return new GetLatestReportsOptions(this); } /** - * Set the xRequestId. + * Set the instanceId. * - * @param xRequestId the xRequestId + * @param instanceId the instanceId * @return the GetLatestReportsOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } @@ -94,8 +103,9 @@ public Builder sort(String sort) { protected GetLatestReportsOptions() { } protected GetLatestReportsOptions(Builder builder) { - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; sort = builder.sort; } @@ -109,35 +119,20 @@ public Builder newBuilder() { } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xRequestId + * @return the instanceId */ - public String xRequestId() { - return xRequestId; + public String instanceId() { + return instanceId; } /** * Gets the sort. * - * This field sorts results by using a valid sort field. To learn more, see + * This field sorts controls by using a valid sort field. To learn more, see * [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). * * @return the sort 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 4fd305d4..5617ce73 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,19 +20,19 @@ */ public class GetProfileAttachmentOptions extends GenericModel { - protected String attachmentId; + protected String instanceId; protected String profileId; - protected String xCorrelationId; - protected String xRequestId; + protected String attachmentId; + protected String accountId; /** * Builder. */ public static class Builder { - private String attachmentId; + private String instanceId; private String profileId; - private String xCorrelationId; - private String xRequestId; + private String attachmentId; + private String accountId; /** * Instantiates a new Builder from an existing GetProfileAttachmentOptions instance. @@ -39,10 +40,10 @@ public static class Builder { * @param getProfileAttachmentOptions the instance to initialize the Builder with */ private Builder(GetProfileAttachmentOptions getProfileAttachmentOptions) { - this.attachmentId = getProfileAttachmentOptions.attachmentId; + this.instanceId = getProfileAttachmentOptions.instanceId; this.profileId = getProfileAttachmentOptions.profileId; - this.xCorrelationId = getProfileAttachmentOptions.xCorrelationId; - this.xRequestId = getProfileAttachmentOptions.xRequestId; + this.attachmentId = getProfileAttachmentOptions.attachmentId; + this.accountId = getProfileAttachmentOptions.accountId; } /** @@ -54,12 +55,14 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param attachmentId the attachmentId + * @param instanceId the instanceId * @param profileId the profileId + * @param attachmentId the attachmentId */ - public Builder(String attachmentId, String profileId) { - this.attachmentId = attachmentId; + public Builder(String instanceId, String profileId, String attachmentId) { + this.instanceId = instanceId; this.profileId = profileId; + this.attachmentId = attachmentId; } /** @@ -72,13 +75,13 @@ public GetProfileAttachmentOptions build() { } /** - * Set the attachmentId. + * Set the instanceId. * - * @param attachmentId the attachmentId + * @param instanceId the instanceId * @return the GetProfileAttachmentOptions builder */ - public Builder attachmentId(String attachmentId) { - this.attachmentId = attachmentId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } @@ -94,24 +97,24 @@ public Builder profileId(String profileId) { } /** - * Set the xCorrelationId. + * Set the attachmentId. * - * @param xCorrelationId the xCorrelationId + * @param attachmentId the attachmentId * @return the GetProfileAttachmentOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder attachmentId(String attachmentId) { + this.attachmentId = attachmentId; return this; } /** - * Set the xRequestId. + * Set the accountId. * - * @param xRequestId the xRequestId + * @param accountId the accountId * @return the GetProfileAttachmentOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } } @@ -119,14 +122,16 @@ public Builder xRequestId(String xRequestId) { 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.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, "profileId cannot be empty"); - attachmentId = builder.attachmentId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.attachmentId, + "attachmentId cannot be empty"); + instanceId = builder.instanceId; profileId = builder.profileId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + attachmentId = builder.attachmentId; + accountId = builder.accountId; } /** @@ -139,14 +144,14 @@ public Builder newBuilder() { } /** - * Gets the attachmentId. + * Gets the instanceId. * - * The attachment ID. + * The ID of the Security and Compliance Center instance. * - * @return the attachmentId + * @return the instanceId */ - public String attachmentId() { - return attachmentId; + public String instanceId() { + return instanceId; } /** @@ -161,29 +166,25 @@ public String profileId() { } /** - * Gets the xCorrelationId. + * Gets the attachmentId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The attachment ID. * - * @return the xCorrelationId + * @return the attachmentId */ - public String xCorrelationId() { - return xCorrelationId; + public String attachmentId() { + return attachmentId; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } } 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 f2715f56..802a6790 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,17 @@ */ public class GetProfileOptions extends GenericModel { + protected String instanceId; protected String profileId; - protected String xCorrelationId; - protected String xRequestId; + protected String accountId; /** * Builder. */ public static class Builder { + private String instanceId; private String profileId; - private String xCorrelationId; - private String xRequestId; + private String accountId; /** * Instantiates a new Builder from an existing GetProfileOptions instance. @@ -37,9 +38,9 @@ public static class Builder { * @param getProfileOptions the instance to initialize the Builder with */ private Builder(GetProfileOptions getProfileOptions) { + this.instanceId = getProfileOptions.instanceId; this.profileId = getProfileOptions.profileId; - this.xCorrelationId = getProfileOptions.xCorrelationId; - this.xRequestId = getProfileOptions.xRequestId; + this.accountId = getProfileOptions.accountId; } /** @@ -51,9 +52,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param profileId the profileId */ - public Builder(String profileId) { + public Builder(String instanceId, String profileId) { + this.instanceId = instanceId; this.profileId = profileId; } @@ -67,35 +70,35 @@ public GetProfileOptions build() { } /** - * Set the profileId. + * Set the instanceId. * - * @param profileId the profileId + * @param instanceId the instanceId * @return the GetProfileOptions builder */ - public Builder profileId(String profileId) { - this.profileId = profileId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. + * Set the profileId. * - * @param xCorrelationId the xCorrelationId + * @param profileId the profileId * @return the GetProfileOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } /** - * Set the xRequestId. + * Set the accountId. * - * @param xRequestId the xRequestId + * @param accountId the accountId * @return the GetProfileOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } } @@ -103,11 +106,13 @@ public Builder xRequestId(String xRequestId) { protected GetProfileOptions() { } protected GetProfileOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, "profileId cannot be empty"); + instanceId = builder.instanceId; profileId = builder.profileId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + accountId = builder.accountId; } /** @@ -120,40 +125,36 @@ public Builder newBuilder() { } /** - * Gets the profileId. + * Gets the instanceId. * - * The profile ID. + * The ID of the Security and Compliance Center instance. * - * @return the profileId + * @return the instanceId */ - public String profileId() { - return profileId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. + * Gets the profileId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The profile ID. * - * @return the xCorrelationId + * @return the profileId */ - public String xCorrelationId() { - return xCorrelationId; + public String profileId() { + return profileId; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeByIdOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeByIdOptions.java index a9b279a4..b8296b42 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeByIdOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeByIdOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,15 @@ */ public class GetProviderTypeByIdOptions extends GenericModel { + protected String instanceId; protected String providerTypeId; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String providerTypeId; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing GetProviderTypeByIdOptions instance. @@ -37,9 +36,8 @@ public static class Builder { * @param getProviderTypeByIdOptions the instance to initialize the Builder with */ private Builder(GetProviderTypeByIdOptions getProviderTypeByIdOptions) { + this.instanceId = getProviderTypeByIdOptions.instanceId; this.providerTypeId = getProviderTypeByIdOptions.providerTypeId; - this.xCorrelationId = getProviderTypeByIdOptions.xCorrelationId; - this.xRequestId = getProviderTypeByIdOptions.xRequestId; } /** @@ -51,9 +49,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param providerTypeId the providerTypeId */ - public Builder(String providerTypeId) { + public Builder(String instanceId, String providerTypeId) { + this.instanceId = instanceId; this.providerTypeId = providerTypeId; } @@ -67,35 +67,24 @@ public GetProviderTypeByIdOptions build() { } /** - * Set the providerTypeId. - * - * @param providerTypeId the providerTypeId - * @return the GetProviderTypeByIdOptions builder - */ - public Builder providerTypeId(String providerTypeId) { - this.providerTypeId = providerTypeId; - return this; - } - - /** - * Set the xCorrelationId. + * Set the instanceId. * - * @param xCorrelationId the xCorrelationId + * @param instanceId the instanceId * @return the GetProviderTypeByIdOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xRequestId. + * Set the providerTypeId. * - * @param xRequestId the xRequestId + * @param providerTypeId the providerTypeId * @return the GetProviderTypeByIdOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder providerTypeId(String providerTypeId) { + this.providerTypeId = providerTypeId; return this; } } @@ -103,11 +92,12 @@ public Builder xRequestId(String xRequestId) { protected GetProviderTypeByIdOptions() { } protected GetProviderTypeByIdOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerTypeId, "providerTypeId cannot be empty"); + instanceId = builder.instanceId; providerTypeId = builder.providerTypeId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -120,40 +110,25 @@ public Builder newBuilder() { } /** - * Gets the providerTypeId. - * - * The provider type ID. - * - * @return the providerTypeId - */ - public String providerTypeId() { - return providerTypeId; - } - - /** - * Gets the xCorrelationId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this headers is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xCorrelationId + * @return the instanceId */ - public String xCorrelationId() { - return xCorrelationId; + public String instanceId() { + return instanceId; } /** - * Gets the xRequestId. + * Gets the providerTypeId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this headers is not supplied in a request, the service generates a random (version 4) UUID. + * The provider type ID. * - * @return the xRequestId + * @return the providerTypeId */ - public String xRequestId() { - return xRequestId; + public String providerTypeId() { + return providerTypeId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeInstanceOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeInstanceOptions.java index 1b277f99..2eddfd74 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeInstanceOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeInstanceOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,19 +20,17 @@ */ public class GetProviderTypeInstanceOptions extends GenericModel { + protected String instanceId; protected String providerTypeId; protected String providerTypeInstanceId; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String providerTypeId; private String providerTypeInstanceId; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing GetProviderTypeInstanceOptions instance. @@ -39,10 +38,9 @@ public static class Builder { * @param getProviderTypeInstanceOptions the instance to initialize the Builder with */ private Builder(GetProviderTypeInstanceOptions getProviderTypeInstanceOptions) { + this.instanceId = getProviderTypeInstanceOptions.instanceId; this.providerTypeId = getProviderTypeInstanceOptions.providerTypeId; this.providerTypeInstanceId = getProviderTypeInstanceOptions.providerTypeInstanceId; - this.xCorrelationId = getProviderTypeInstanceOptions.xCorrelationId; - this.xRequestId = getProviderTypeInstanceOptions.xRequestId; } /** @@ -54,10 +52,12 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param providerTypeId the providerTypeId * @param providerTypeInstanceId the providerTypeInstanceId */ - public Builder(String providerTypeId, String providerTypeInstanceId) { + public Builder(String instanceId, String providerTypeId, String providerTypeInstanceId) { + this.instanceId = instanceId; this.providerTypeId = providerTypeId; this.providerTypeInstanceId = providerTypeInstanceId; } @@ -71,6 +71,17 @@ public GetProviderTypeInstanceOptions build() { return new GetProviderTypeInstanceOptions(this); } + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetProviderTypeInstanceOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + /** * Set the providerTypeId. * @@ -92,41 +103,20 @@ public Builder providerTypeInstanceId(String providerTypeInstanceId) { this.providerTypeInstanceId = providerTypeInstanceId; return this; } - - /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the GetProviderTypeInstanceOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. - * - * @param xRequestId the xRequestId - * @return the GetProviderTypeInstanceOptions builder - */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; - return this; - } } protected GetProviderTypeInstanceOptions() { } protected GetProviderTypeInstanceOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerTypeId, "providerTypeId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerTypeInstanceId, "providerTypeInstanceId cannot be empty"); + instanceId = builder.instanceId; providerTypeId = builder.providerTypeId; providerTypeInstanceId = builder.providerTypeInstanceId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -138,6 +128,17 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + /** * Gets the providerTypeId. * @@ -159,31 +160,5 @@ public String providerTypeId() { public String providerTypeInstanceId() { return providerTypeInstanceId; } - - /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this headers is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this headers is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xRequestId - */ - public String xRequestId() { - return xRequestId; - } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportControlsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportControlsOptions.java index 575b984b..4d2e46ab 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportControlsOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportControlsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -31,6 +32,8 @@ public interface Status { String UNABLE_TO_PERFORM = "unable_to_perform"; /** user_evaluation_required. */ String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; } /** @@ -46,29 +49,31 @@ public interface Sort { String STATUS = "status"; } + protected String instanceId; protected String reportId; - protected String xCorrelationId; - protected String xRequestId; protected String controlId; protected String controlName; protected String controlDescription; protected String controlCategory; protected String status; protected String sort; + protected String scopeId; + protected String subscopeId; /** * Builder. */ public static class Builder { + private String instanceId; private String reportId; - private String xCorrelationId; - private String xRequestId; private String controlId; private String controlName; private String controlDescription; private String controlCategory; private String status; private String sort; + private String scopeId; + private String subscopeId; /** * Instantiates a new Builder from an existing GetReportControlsOptions instance. @@ -76,15 +81,16 @@ public static class Builder { * @param getReportControlsOptions the instance to initialize the Builder with */ private Builder(GetReportControlsOptions getReportControlsOptions) { + this.instanceId = getReportControlsOptions.instanceId; this.reportId = getReportControlsOptions.reportId; - this.xCorrelationId = getReportControlsOptions.xCorrelationId; - this.xRequestId = getReportControlsOptions.xRequestId; this.controlId = getReportControlsOptions.controlId; this.controlName = getReportControlsOptions.controlName; this.controlDescription = getReportControlsOptions.controlDescription; this.controlCategory = getReportControlsOptions.controlCategory; this.status = getReportControlsOptions.status; this.sort = getReportControlsOptions.sort; + this.scopeId = getReportControlsOptions.scopeId; + this.subscopeId = getReportControlsOptions.subscopeId; } /** @@ -96,9 +102,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param reportId the reportId */ - public Builder(String reportId) { + public Builder(String instanceId, String reportId) { + this.instanceId = instanceId; this.reportId = reportId; } @@ -112,35 +120,24 @@ public GetReportControlsOptions build() { } /** - * Set the reportId. + * Set the instanceId. * - * @param reportId the reportId + * @param instanceId the instanceId * @return the GetReportControlsOptions builder */ - public Builder reportId(String reportId) { - this.reportId = reportId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the GetReportControlsOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. + * Set the reportId. * - * @param xRequestId the xRequestId + * @param reportId the reportId * @return the GetReportControlsOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder reportId(String reportId) { + this.reportId = reportId; return this; } @@ -209,22 +206,47 @@ public Builder sort(String sort) { this.sort = sort; return this; } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the GetReportControlsOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the subscopeId. + * + * @param subscopeId the subscopeId + * @return the GetReportControlsOptions builder + */ + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; + return this; + } } protected GetReportControlsOptions() { } protected GetReportControlsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, "reportId cannot be empty"); + instanceId = builder.instanceId; reportId = builder.reportId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; controlId = builder.controlId; controlName = builder.controlName; controlDescription = builder.controlDescription; controlCategory = builder.controlCategory; status = builder.status; sort = builder.sort; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; } /** @@ -237,40 +259,25 @@ public Builder newBuilder() { } /** - * Gets the reportId. + * Gets the instanceId. * - * The ID of the scan that is associated with a report. + * The ID of the Security and Compliance Center instance. * - * @return the reportId + * @return the instanceId */ - public String reportId() { - return reportId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the reportId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the scan that is associated with a report. * - * @return the xRequestId + * @return the reportId */ - public String xRequestId() { - return xRequestId; + public String reportId() { + return reportId; } /** @@ -339,5 +346,27 @@ public String status() { public String sort() { return sort; } + + /** + * Gets the scopeId. + * + * The ID of the scope. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The ID of the subscope. + * + * @return the subscopeId + */ + public String subscopeId() { + return subscopeId; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportDownloadFileOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportDownloadFileOptions.java new file mode 100644 index 00000000..16f3b055 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportDownloadFileOptions.java @@ -0,0 +1,186 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 getReportDownloadFile options. + */ +public class GetReportDownloadFileOptions extends GenericModel { + + protected String instanceId; + protected String reportId; + protected String accept; + protected Boolean excludeSummary; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String reportId; + private String accept; + private Boolean excludeSummary; + + /** + * Instantiates a new Builder from an existing GetReportDownloadFileOptions instance. + * + * @param getReportDownloadFileOptions the instance to initialize the Builder with + */ + private Builder(GetReportDownloadFileOptions getReportDownloadFileOptions) { + this.instanceId = getReportDownloadFileOptions.instanceId; + this.reportId = getReportDownloadFileOptions.reportId; + this.accept = getReportDownloadFileOptions.accept; + this.excludeSummary = getReportDownloadFileOptions.excludeSummary; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param reportId the reportId + */ + public Builder(String instanceId, String reportId) { + this.instanceId = instanceId; + this.reportId = reportId; + } + + /** + * Builds a GetReportDownloadFileOptions. + * + * @return the new GetReportDownloadFileOptions instance + */ + public GetReportDownloadFileOptions build() { + return new GetReportDownloadFileOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetReportDownloadFileOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the reportId. + * + * @param reportId the reportId + * @return the GetReportDownloadFileOptions builder + */ + public Builder reportId(String reportId) { + this.reportId = reportId; + return this; + } + + /** + * Set the accept. + * + * @param accept the accept + * @return the GetReportDownloadFileOptions builder + */ + public Builder accept(String accept) { + this.accept = accept; + return this; + } + + /** + * Set the excludeSummary. + * + * @param excludeSummary the excludeSummary + * @return the GetReportDownloadFileOptions builder + */ + public Builder excludeSummary(Boolean excludeSummary) { + this.excludeSummary = excludeSummary; + return this; + } + } + + protected GetReportDownloadFileOptions() { } + + protected GetReportDownloadFileOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, + "reportId cannot be empty"); + instanceId = builder.instanceId; + reportId = builder.reportId; + accept = builder.accept; + excludeSummary = builder.excludeSummary; + } + + /** + * New builder. + * + * @return a GetReportDownloadFileOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the reportId. + * + * The ID of the scan that is associated with a report. + * + * @return the reportId + */ + public String reportId() { + return reportId; + } + + /** + * Gets the accept. + * + * The type of the response: application/csv or application/pdf. + * + * @return the accept + */ + public String accept() { + return accept; + } + + /** + * Gets the excludeSummary. + * + * The indication of whether report summary metadata must be excluded. + * + * @return the excludeSummary + */ + public Boolean excludeSummary() { + return excludeSummary; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportOptions.java index 0c08b7d1..dd36951e 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -20,16 +21,18 @@ public class GetReportOptions extends GenericModel { protected String reportId; - protected String xCorrelationId; - protected String xRequestId; + protected String instanceId; + protected String scopeId; + protected String subscopeId; /** * Builder. */ public static class Builder { private String reportId; - private String xCorrelationId; - private String xRequestId; + private String instanceId; + private String scopeId; + private String subscopeId; /** * Instantiates a new Builder from an existing GetReportOptions instance. @@ -38,8 +41,9 @@ public static class Builder { */ private Builder(GetReportOptions getReportOptions) { this.reportId = getReportOptions.reportId; - this.xCorrelationId = getReportOptions.xCorrelationId; - this.xRequestId = getReportOptions.xRequestId; + this.instanceId = getReportOptions.instanceId; + this.scopeId = getReportOptions.scopeId; + this.subscopeId = getReportOptions.subscopeId; } /** @@ -52,9 +56,11 @@ public Builder() { * Instantiates a new builder with required properties. * * @param reportId the reportId + * @param instanceId the instanceId */ - public Builder(String reportId) { + public Builder(String reportId, String instanceId) { this.reportId = reportId; + this.instanceId = instanceId; } /** @@ -78,24 +84,35 @@ public Builder reportId(String reportId) { } /** - * Set the xCorrelationId. + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetReportOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the scopeId. * - * @param xCorrelationId the xCorrelationId + * @param scopeId the scopeId * @return the GetReportOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; return this; } /** - * Set the xRequestId. + * Set the subscopeId. * - * @param xRequestId the xRequestId + * @param subscopeId the subscopeId * @return the GetReportOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; return this; } } @@ -105,9 +122,12 @@ protected GetReportOptions() { } protected GetReportOptions(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, "reportId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); reportId = builder.reportId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + instanceId = builder.instanceId; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; } /** @@ -131,29 +151,36 @@ public String reportId() { } /** - * Gets the xCorrelationId. + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the scopeId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the scope. * - * @return the xCorrelationId + * @return the scopeId */ - public String xCorrelationId() { - return xCorrelationId; + public String scopeId() { + return scopeId; } /** - * Gets the xRequestId. + * Gets the subscopeId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the subscope. * - * @return the xRequestId + * @return the subscopeId */ - public String xRequestId() { - return xRequestId; + public String subscopeId() { + return subscopeId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportRuleOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportRuleOptions.java index 090ccafb..838cbbc2 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportRuleOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportRuleOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,19 +20,17 @@ */ public class GetReportRuleOptions extends GenericModel { + protected String instanceId; protected String reportId; protected String ruleId; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String reportId; private String ruleId; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing GetReportRuleOptions instance. @@ -39,10 +38,9 @@ public static class Builder { * @param getReportRuleOptions the instance to initialize the Builder with */ private Builder(GetReportRuleOptions getReportRuleOptions) { + this.instanceId = getReportRuleOptions.instanceId; this.reportId = getReportRuleOptions.reportId; this.ruleId = getReportRuleOptions.ruleId; - this.xCorrelationId = getReportRuleOptions.xCorrelationId; - this.xRequestId = getReportRuleOptions.xRequestId; } /** @@ -54,10 +52,12 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param reportId the reportId * @param ruleId the ruleId */ - public Builder(String reportId, String ruleId) { + public Builder(String instanceId, String reportId, String ruleId) { + this.instanceId = instanceId; this.reportId = reportId; this.ruleId = ruleId; } @@ -71,6 +71,17 @@ public GetReportRuleOptions build() { return new GetReportRuleOptions(this); } + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetReportRuleOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + /** * Set the reportId. * @@ -92,41 +103,20 @@ public Builder ruleId(String ruleId) { this.ruleId = ruleId; return this; } - - /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the GetReportRuleOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. - * - * @param xRequestId the xRequestId - * @return the GetReportRuleOptions builder - */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; - return this; - } } protected GetReportRuleOptions() { } protected GetReportRuleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, "reportId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.ruleId, "ruleId cannot be empty"); + instanceId = builder.instanceId; reportId = builder.reportId; ruleId = builder.ruleId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -138,6 +128,17 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + /** * Gets the reportId. * @@ -152,38 +153,12 @@ public String reportId() { /** * Gets the ruleId. * - * The ID of a rule in a report. + * The ID of the rule within a report. * * @return the ruleId */ public String ruleId() { return ruleId; } - - /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xRequestId - */ - public String xRequestId() { - return xRequestId; - } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportSummaryOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportSummaryOptions.java index 8087c710..3280fc7f 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportSummaryOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportSummaryOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,15 @@ */ public class GetReportSummaryOptions extends GenericModel { + protected String instanceId; protected String reportId; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String reportId; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing GetReportSummaryOptions instance. @@ -37,9 +36,8 @@ public static class Builder { * @param getReportSummaryOptions the instance to initialize the Builder with */ private Builder(GetReportSummaryOptions getReportSummaryOptions) { + this.instanceId = getReportSummaryOptions.instanceId; this.reportId = getReportSummaryOptions.reportId; - this.xCorrelationId = getReportSummaryOptions.xCorrelationId; - this.xRequestId = getReportSummaryOptions.xRequestId; } /** @@ -51,9 +49,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param reportId the reportId */ - public Builder(String reportId) { + public Builder(String instanceId, String reportId) { + this.instanceId = instanceId; this.reportId = reportId; } @@ -67,35 +67,24 @@ public GetReportSummaryOptions build() { } /** - * Set the reportId. - * - * @param reportId the reportId - * @return the GetReportSummaryOptions builder - */ - public Builder reportId(String reportId) { - this.reportId = reportId; - return this; - } - - /** - * Set the xCorrelationId. + * Set the instanceId. * - * @param xCorrelationId the xCorrelationId + * @param instanceId the instanceId * @return the GetReportSummaryOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xRequestId. + * Set the reportId. * - * @param xRequestId the xRequestId + * @param reportId the reportId * @return the GetReportSummaryOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder reportId(String reportId) { + this.reportId = reportId; return this; } } @@ -103,11 +92,12 @@ public Builder xRequestId(String xRequestId) { protected GetReportSummaryOptions() { } protected GetReportSummaryOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, "reportId cannot be empty"); + instanceId = builder.instanceId; reportId = builder.reportId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -120,40 +110,25 @@ public Builder newBuilder() { } /** - * Gets the reportId. - * - * The ID of the scan that is associated with a report. - * - * @return the reportId - */ - public String reportId() { - return reportId; - } - - /** - * Gets the xCorrelationId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xCorrelationId + * @return the instanceId */ - public String xCorrelationId() { - return xCorrelationId; + public String instanceId() { + return instanceId; } /** - * Gets the xRequestId. + * Gets the reportId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the scan that is associated with a report. * - * @return the xRequestId + * @return the reportId */ - public String xRequestId() { - return xRequestId; + public String reportId() { + return reportId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportTagsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportTagsOptions.java index 08f34659..747eb492 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportTagsOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportTagsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,15 @@ */ public class GetReportTagsOptions extends GenericModel { + protected String instanceId; protected String reportId; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String reportId; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing GetReportTagsOptions instance. @@ -37,9 +36,8 @@ public static class Builder { * @param getReportTagsOptions the instance to initialize the Builder with */ private Builder(GetReportTagsOptions getReportTagsOptions) { + this.instanceId = getReportTagsOptions.instanceId; this.reportId = getReportTagsOptions.reportId; - this.xCorrelationId = getReportTagsOptions.xCorrelationId; - this.xRequestId = getReportTagsOptions.xRequestId; } /** @@ -51,9 +49,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param reportId the reportId */ - public Builder(String reportId) { + public Builder(String instanceId, String reportId) { + this.instanceId = instanceId; this.reportId = reportId; } @@ -67,35 +67,24 @@ public GetReportTagsOptions build() { } /** - * Set the reportId. - * - * @param reportId the reportId - * @return the GetReportTagsOptions builder - */ - public Builder reportId(String reportId) { - this.reportId = reportId; - return this; - } - - /** - * Set the xCorrelationId. + * Set the instanceId. * - * @param xCorrelationId the xCorrelationId + * @param instanceId the instanceId * @return the GetReportTagsOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xRequestId. + * Set the reportId. * - * @param xRequestId the xRequestId + * @param reportId the reportId * @return the GetReportTagsOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder reportId(String reportId) { + this.reportId = reportId; return this; } } @@ -103,11 +92,12 @@ public Builder xRequestId(String xRequestId) { protected GetReportTagsOptions() { } protected GetReportTagsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, "reportId cannot be empty"); + instanceId = builder.instanceId; reportId = builder.reportId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -120,40 +110,25 @@ public Builder newBuilder() { } /** - * Gets the reportId. - * - * The ID of the scan that is associated with a report. - * - * @return the reportId - */ - public String reportId() { - return reportId; - } - - /** - * Gets the xCorrelationId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xCorrelationId + * @return the instanceId */ - public String xCorrelationId() { - return xCorrelationId; + public String instanceId() { + return instanceId; } /** - * Gets the xRequestId. + * Gets the reportId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the scan that is associated with a report. * - * @return the xRequestId + * @return the reportId */ - public String xRequestId() { - return xRequestId; + public String reportId() { + return reportId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportViolationsDriftOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportViolationsDriftOptions.java index 1588dfd9..a34d2366 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportViolationsDriftOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportViolationsDriftOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,19 +20,21 @@ */ public class GetReportViolationsDriftOptions extends GenericModel { + protected String instanceId; protected String reportId; - protected String xCorrelationId; - protected String xRequestId; protected Long scanTimeDuration; + protected String scopeId; + protected String subscopeId; /** * Builder. */ public static class Builder { + private String instanceId; private String reportId; - private String xCorrelationId; - private String xRequestId; private Long scanTimeDuration; + private String scopeId; + private String subscopeId; /** * Instantiates a new Builder from an existing GetReportViolationsDriftOptions instance. @@ -39,10 +42,11 @@ public static class Builder { * @param getReportViolationsDriftOptions the instance to initialize the Builder with */ private Builder(GetReportViolationsDriftOptions getReportViolationsDriftOptions) { + this.instanceId = getReportViolationsDriftOptions.instanceId; this.reportId = getReportViolationsDriftOptions.reportId; - this.xCorrelationId = getReportViolationsDriftOptions.xCorrelationId; - this.xRequestId = getReportViolationsDriftOptions.xRequestId; this.scanTimeDuration = getReportViolationsDriftOptions.scanTimeDuration; + this.scopeId = getReportViolationsDriftOptions.scopeId; + this.subscopeId = getReportViolationsDriftOptions.subscopeId; } /** @@ -54,9 +58,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param reportId the reportId */ - public Builder(String reportId) { + public Builder(String instanceId, String reportId) { + this.instanceId = instanceId; this.reportId = reportId; } @@ -69,6 +75,17 @@ public GetReportViolationsDriftOptions build() { return new GetReportViolationsDriftOptions(this); } + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetReportViolationsDriftOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + /** * Set the reportId. * @@ -81,35 +98,35 @@ public Builder reportId(String reportId) { } /** - * Set the xCorrelationId. + * Set the scanTimeDuration. * - * @param xCorrelationId the xCorrelationId + * @param scanTimeDuration the scanTimeDuration * @return the GetReportViolationsDriftOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder scanTimeDuration(long scanTimeDuration) { + this.scanTimeDuration = scanTimeDuration; return this; } /** - * Set the xRequestId. + * Set the scopeId. * - * @param xRequestId the xRequestId + * @param scopeId the scopeId * @return the GetReportViolationsDriftOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; return this; } /** - * Set the scanTimeDuration. + * Set the subscopeId. * - * @param scanTimeDuration the scanTimeDuration + * @param subscopeId the subscopeId * @return the GetReportViolationsDriftOptions builder */ - public Builder scanTimeDuration(long scanTimeDuration) { - this.scanTimeDuration = scanTimeDuration; + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; return this; } } @@ -117,12 +134,15 @@ public Builder scanTimeDuration(long scanTimeDuration) { protected GetReportViolationsDriftOptions() { } protected GetReportViolationsDriftOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, "reportId cannot be empty"); + instanceId = builder.instanceId; reportId = builder.reportId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; scanTimeDuration = builder.scanTimeDuration; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; } /** @@ -134,6 +154,17 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + /** * Gets the reportId. * @@ -146,40 +177,36 @@ public String reportId() { } /** - * Gets the xCorrelationId. + * Gets the scanTimeDuration. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The duration of the `scan_time` timestamp in number of days. * - * @return the xCorrelationId + * @return the scanTimeDuration */ - public String xCorrelationId() { - return xCorrelationId; + public Long scanTimeDuration() { + return scanTimeDuration; } /** - * Gets the xRequestId. + * Gets the scopeId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the scope. * - * @return the xRequestId + * @return the scopeId */ - public String xRequestId() { - return xRequestId; + public String scopeId() { + return scopeId; } /** - * Gets the scanTimeDuration. + * Gets the subscopeId. * - * The duration of the `scan_time` timestamp in number of days. + * The ID of the subscope. * - * @return the scanTimeDuration + * @return the subscopeId */ - public Long scanTimeDuration() { - return scanTimeDuration; + public String subscopeId() { + return subscopeId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetRuleOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetRuleOptions.java index c9ef224c..d29a8cb5 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetRuleOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetRuleOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,15 @@ */ public class GetRuleOptions extends GenericModel { + protected String instanceId; protected String ruleId; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String ruleId; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing GetRuleOptions instance. @@ -37,9 +36,8 @@ public static class Builder { * @param getRuleOptions the instance to initialize the Builder with */ private Builder(GetRuleOptions getRuleOptions) { + this.instanceId = getRuleOptions.instanceId; this.ruleId = getRuleOptions.ruleId; - this.xCorrelationId = getRuleOptions.xCorrelationId; - this.xRequestId = getRuleOptions.xRequestId; } /** @@ -51,9 +49,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param ruleId the ruleId */ - public Builder(String ruleId) { + public Builder(String instanceId, String ruleId) { + this.instanceId = instanceId; this.ruleId = ruleId; } @@ -67,35 +67,24 @@ public GetRuleOptions build() { } /** - * Set the ruleId. + * Set the instanceId. * - * @param ruleId the ruleId + * @param instanceId the instanceId * @return the GetRuleOptions builder */ - public Builder ruleId(String ruleId) { - this.ruleId = ruleId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the GetRuleOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. + * Set the ruleId. * - * @param xRequestId the xRequestId + * @param ruleId the ruleId * @return the GetRuleOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder ruleId(String ruleId) { + this.ruleId = ruleId; return this; } } @@ -103,11 +92,12 @@ public Builder xRequestId(String xRequestId) { protected GetRuleOptions() { } protected GetRuleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.ruleId, "ruleId cannot be empty"); + instanceId = builder.instanceId; ruleId = builder.ruleId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -120,40 +110,25 @@ public Builder newBuilder() { } /** - * Gets the ruleId. + * Gets the instanceId. * - * The ID of the corresponding rule. + * The ID of the Security and Compliance Center instance. * - * @return the ruleId + * @return the instanceId */ - public String ruleId() { - return ruleId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the ruleId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of a rule/assessment. * - * @return the xRequestId + * @return the ruleId */ - public String xRequestId() { - return xRequestId; + public String ruleId() { + return ruleId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportDownloadFileOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportDownloadFileOptions.java new file mode 100644 index 00000000..96f99365 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportDownloadFileOptions.java @@ -0,0 +1,190 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 getScanReportDownloadFile options. + */ +public class GetScanReportDownloadFileOptions extends GenericModel { + + protected String instanceId; + protected String reportId; + protected String jobId; + protected String accept; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String reportId; + private String jobId; + private String accept; + + /** + * Instantiates a new Builder from an existing GetScanReportDownloadFileOptions instance. + * + * @param getScanReportDownloadFileOptions the instance to initialize the Builder with + */ + private Builder(GetScanReportDownloadFileOptions getScanReportDownloadFileOptions) { + this.instanceId = getScanReportDownloadFileOptions.instanceId; + this.reportId = getScanReportDownloadFileOptions.reportId; + this.jobId = getScanReportDownloadFileOptions.jobId; + this.accept = getScanReportDownloadFileOptions.accept; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param reportId the reportId + * @param jobId the jobId + */ + public Builder(String instanceId, String reportId, String jobId) { + this.instanceId = instanceId; + this.reportId = reportId; + this.jobId = jobId; + } + + /** + * Builds a GetScanReportDownloadFileOptions. + * + * @return the new GetScanReportDownloadFileOptions instance + */ + public GetScanReportDownloadFileOptions build() { + return new GetScanReportDownloadFileOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetScanReportDownloadFileOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the reportId. + * + * @param reportId the reportId + * @return the GetScanReportDownloadFileOptions builder + */ + public Builder reportId(String reportId) { + this.reportId = reportId; + return this; + } + + /** + * Set the jobId. + * + * @param jobId the jobId + * @return the GetScanReportDownloadFileOptions builder + */ + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + + /** + * Set the accept. + * + * @param accept the accept + * @return the GetScanReportDownloadFileOptions builder + */ + public Builder accept(String accept) { + this.accept = accept; + return this; + } + } + + protected GetScanReportDownloadFileOptions() { } + + protected GetScanReportDownloadFileOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, + "reportId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.jobId, + "jobId cannot be empty"); + instanceId = builder.instanceId; + reportId = builder.reportId; + jobId = builder.jobId; + accept = builder.accept; + } + + /** + * New builder. + * + * @return a GetScanReportDownloadFileOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the reportId. + * + * The ID of the scan that is associated with a report. + * + * @return the reportId + */ + public String reportId() { + return reportId; + } + + /** + * Gets the jobId. + * + * The ID of the scan_result. + * + * @return the jobId + */ + public String jobId() { + return jobId; + } + + /** + * Gets the accept. + * + * The type of the response: application/csv or application/pdf. + * + * @return the accept + */ + public String accept() { + return accept; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportOptions.java new file mode 100644 index 00000000..a4a9f6e2 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportOptions.java @@ -0,0 +1,164 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 getScanReport options. + */ +public class GetScanReportOptions extends GenericModel { + + protected String instanceId; + protected String reportId; + protected String jobId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String reportId; + private String jobId; + + /** + * Instantiates a new Builder from an existing GetScanReportOptions instance. + * + * @param getScanReportOptions the instance to initialize the Builder with + */ + private Builder(GetScanReportOptions getScanReportOptions) { + this.instanceId = getScanReportOptions.instanceId; + this.reportId = getScanReportOptions.reportId; + this.jobId = getScanReportOptions.jobId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param reportId the reportId + * @param jobId the jobId + */ + public Builder(String instanceId, String reportId, String jobId) { + this.instanceId = instanceId; + this.reportId = reportId; + this.jobId = jobId; + } + + /** + * Builds a GetScanReportOptions. + * + * @return the new GetScanReportOptions instance + */ + public GetScanReportOptions build() { + return new GetScanReportOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetScanReportOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the reportId. + * + * @param reportId the reportId + * @return the GetScanReportOptions builder + */ + public Builder reportId(String reportId) { + this.reportId = reportId; + return this; + } + + /** + * Set the jobId. + * + * @param jobId the jobId + * @return the GetScanReportOptions builder + */ + public Builder jobId(String jobId) { + this.jobId = jobId; + return this; + } + } + + protected GetScanReportOptions() { } + + protected GetScanReportOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, + "reportId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.jobId, + "jobId cannot be empty"); + instanceId = builder.instanceId; + reportId = builder.reportId; + jobId = builder.jobId; + } + + /** + * New builder. + * + * @return a GetScanReportOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the reportId. + * + * The ID of the scan that is associated with a report. + * + * @return the reportId + */ + public String reportId() { + return reportId; + } + + /** + * Gets the jobId. + * + * The ID of the scan_result. + * + * @return the jobId + */ + public String jobId() { + return jobId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScopeOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScopeOptions.java new file mode 100644 index 00000000..b8f864d7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScopeOptions.java @@ -0,0 +1,134 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 getScope options. + */ +public class GetScopeOptions extends GenericModel { + + protected String instanceId; + protected String scopeId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String scopeId; + + /** + * Instantiates a new Builder from an existing GetScopeOptions instance. + * + * @param getScopeOptions the instance to initialize the Builder with + */ + private Builder(GetScopeOptions getScopeOptions) { + this.instanceId = getScopeOptions.instanceId; + this.scopeId = getScopeOptions.scopeId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param scopeId the scopeId + */ + public Builder(String instanceId, String scopeId) { + this.instanceId = instanceId; + this.scopeId = scopeId; + } + + /** + * Builds a GetScopeOptions. + * + * @return the new GetScopeOptions instance + */ + public GetScopeOptions build() { + return new GetScopeOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetScopeOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the GetScopeOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + } + + protected GetScopeOptions() { } + + protected GetScopeOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.scopeId, + "scopeId cannot be empty"); + instanceId = builder.instanceId; + scopeId = builder.scopeId; + } + + /** + * New builder. + * + * @return a GetScopeOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope being targeted. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetServiceOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetServiceOptions.java new file mode 100644 index 00000000..ef9f6bf7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetServiceOptions.java @@ -0,0 +1,104 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 getService options. + */ +public class GetServiceOptions extends GenericModel { + + protected String servicesName; + + /** + * Builder. + */ + public static class Builder { + private String servicesName; + + /** + * Instantiates a new Builder from an existing GetServiceOptions instance. + * + * @param getServiceOptions the instance to initialize the Builder with + */ + private Builder(GetServiceOptions getServiceOptions) { + this.servicesName = getServiceOptions.servicesName; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param servicesName the servicesName + */ + public Builder(String servicesName) { + this.servicesName = servicesName; + } + + /** + * Builds a GetServiceOptions. + * + * @return the new GetServiceOptions instance + */ + public GetServiceOptions build() { + return new GetServiceOptions(this); + } + + /** + * Set the servicesName. + * + * @param servicesName the servicesName + * @return the GetServiceOptions builder + */ + public Builder servicesName(String servicesName) { + this.servicesName = servicesName; + return this; + } + } + + protected GetServiceOptions() { } + + protected GetServiceOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.servicesName, + "servicesName cannot be empty"); + servicesName = builder.servicesName; + } + + /** + * New builder. + * + * @return a GetServiceOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the servicesName. + * + * The name of the corresponding service. + * + * @return the servicesName + */ + public String servicesName() { + return servicesName; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSettingsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSettingsOptions.java index c946a5f8..107b4473 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSettingsOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSettingsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,15 +20,13 @@ */ public class GetSettingsOptions extends GenericModel { - protected String xCorrelationId; - protected String xRequestId; + protected String instanceId; /** * Builder. */ public static class Builder { - private String xCorrelationId; - private String xRequestId; + private String instanceId; /** * Instantiates a new Builder from an existing GetSettingsOptions instance. @@ -35,8 +34,7 @@ public static class Builder { * @param getSettingsOptions the instance to initialize the Builder with */ private Builder(GetSettingsOptions getSettingsOptions) { - this.xCorrelationId = getSettingsOptions.xCorrelationId; - this.xRequestId = getSettingsOptions.xRequestId; + this.instanceId = getSettingsOptions.instanceId; } /** @@ -46,33 +44,31 @@ public Builder() { } /** - * Builds a GetSettingsOptions. + * Instantiates a new builder with required properties. * - * @return the new GetSettingsOptions instance + * @param instanceId the instanceId */ - public GetSettingsOptions build() { - return new GetSettingsOptions(this); + public Builder(String instanceId) { + this.instanceId = instanceId; } /** - * Set the xCorrelationId. + * Builds a GetSettingsOptions. * - * @param xCorrelationId the xCorrelationId - * @return the GetSettingsOptions builder + * @return the new GetSettingsOptions instance */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; + public GetSettingsOptions build() { + return new GetSettingsOptions(this); } /** - * Set the xRequestId. + * Set the instanceId. * - * @param xRequestId the xRequestId + * @param instanceId the instanceId * @return the GetSettingsOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } } @@ -80,8 +76,9 @@ public Builder xRequestId(String xRequestId) { protected GetSettingsOptions() { } protected GetSettingsOptions(Builder builder) { - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; } /** @@ -94,29 +91,14 @@ public Builder newBuilder() { } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request, and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request, and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xRequestId + * @return the instanceId */ - public String xRequestId() { - return xRequestId; + public String instanceId() { + return instanceId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSubscopeOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSubscopeOptions.java new file mode 100644 index 00000000..4c59d944 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSubscopeOptions.java @@ -0,0 +1,164 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 getSubscope options. + */ +public class GetSubscopeOptions extends GenericModel { + + protected String instanceId; + protected String scopeId; + protected String subscopeId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String scopeId; + private String subscopeId; + + /** + * Instantiates a new Builder from an existing GetSubscopeOptions instance. + * + * @param getSubscopeOptions the instance to initialize the Builder with + */ + private Builder(GetSubscopeOptions getSubscopeOptions) { + this.instanceId = getSubscopeOptions.instanceId; + this.scopeId = getSubscopeOptions.scopeId; + this.subscopeId = getSubscopeOptions.subscopeId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param scopeId the scopeId + * @param subscopeId the subscopeId + */ + public Builder(String instanceId, String scopeId, String subscopeId) { + this.instanceId = instanceId; + this.scopeId = scopeId; + this.subscopeId = subscopeId; + } + + /** + * Builds a GetSubscopeOptions. + * + * @return the new GetSubscopeOptions instance + */ + public GetSubscopeOptions build() { + return new GetSubscopeOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetSubscopeOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the GetSubscopeOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the subscopeId. + * + * @param subscopeId the subscopeId + * @return the GetSubscopeOptions builder + */ + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; + return this; + } + } + + protected GetSubscopeOptions() { } + + protected GetSubscopeOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.scopeId, + "scopeId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.subscopeId, + "subscopeId cannot be empty"); + instanceId = builder.instanceId; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; + } + + /** + * New builder. + * + * @return a GetSubscopeOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope being targeted. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The ID of the scope being targeted. + * + * @return the subscopeId + */ + public String subscopeId() { + return subscopeId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetTargetOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetTargetOptions.java new file mode 100644 index 00000000..13957be2 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetTargetOptions.java @@ -0,0 +1,134 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 getTarget options. + */ +public class GetTargetOptions extends GenericModel { + + protected String instanceId; + protected String targetId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String targetId; + + /** + * Instantiates a new Builder from an existing GetTargetOptions instance. + * + * @param getTargetOptions the instance to initialize the Builder with + */ + private Builder(GetTargetOptions getTargetOptions) { + this.instanceId = getTargetOptions.instanceId; + this.targetId = getTargetOptions.targetId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param targetId the targetId + */ + public Builder(String instanceId, String targetId) { + this.instanceId = instanceId; + this.targetId = targetId; + } + + /** + * Builds a GetTargetOptions. + * + * @return the new GetTargetOptions instance + */ + public GetTargetOptions build() { + return new GetTargetOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the GetTargetOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the targetId. + * + * @param targetId the targetId + * @return the GetTargetOptions builder + */ + public Builder targetId(String targetId) { + this.targetId = targetId; + return this; + } + } + + protected GetTargetOptions() { } + + protected GetTargetOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.targetId, + "targetId cannot be empty"); + instanceId = builder.instanceId; + targetId = builder.targetId; + } + + /** + * New builder. + * + * @return a GetTargetOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the targetId. + * + * The target ID. + * + * @return the targetId + */ + public String targetId() { + return targetId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Import.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Import.java index 7abb403f..79b04606 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Import.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Import.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -22,13 +23,13 @@ */ public class Import extends GenericModel { - protected List parameters; + protected List parameters; /** * Builder. */ public static class Builder { - private List parameters; + private List parameters; /** * Instantiates a new Builder from an existing Import instance. @@ -55,16 +56,16 @@ public Import build() { } /** - * Adds an parameters to parameters. + * Adds a new element to parameters. * - * @param parameters the new parameters + * @param parameters the new element to be added * @return the Import builder */ - public Builder addParameters(Parameter parameters) { + public Builder addParameters(RuleParameter parameters) { com.ibm.cloud.sdk.core.util.Validator.notNull(parameters, "parameters cannot be null"); if (this.parameters == null) { - this.parameters = new ArrayList(); + this.parameters = new ArrayList(); } this.parameters.add(parameters); return this; @@ -77,7 +78,7 @@ public Builder addParameters(Parameter parameters) { * @param parameters the parameters * @return the Import builder */ - public Builder parameters(List parameters) { + public Builder parameters(List parameters) { this.parameters = parameters; return this; } @@ -105,7 +106,7 @@ public Builder newBuilder() { * * @return the parameters */ - public List parameters() { + public List parameters() { return parameters; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/InstanceAttachmentsPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/InstanceAttachmentsPager.java new file mode 100644 index 00000000..6123460a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/InstanceAttachmentsPager.java @@ -0,0 +1,108 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * InstanceAttachmentsPager can be used to simplify the use of the "listInstanceAttachments" method. + */ +public class InstanceAttachmentsPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListInstanceAttachmentsOptions options; + protected SecurityAndComplianceCenterApi client; + protected PageContext pageContext; + + // Hide the default ctor. + protected InstanceAttachmentsPager() { } + + /** + * Constructs a new InstanceAttachmentsPager instance with the specified client and options model instance. + * @param client the SecurityAndComplianceCenterApi instance to be used to invoke the "listInstanceAttachments" method + * @param options the ListInstanceAttachmentsOptions instance to be used to invoke the "listInstanceAttachments" method + */ + public InstanceAttachmentsPager(SecurityAndComplianceCenterApi client, ListInstanceAttachmentsOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<ProfileAttachment> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListInstanceAttachmentsOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ProfileAttachmentCollection result = client.listInstanceAttachments(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getAttachments(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<ProfileAttachment> containing all results returned by the "listInstanceAttachments" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LabelType.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LabelType.java index cc18f4df..5ecb4bb1 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LabelType.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LabelType.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScan.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScan.java index ac8c04f7..91e0a45f 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScan.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScan.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; @@ -17,139 +18,46 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The details of the last scan of an attachment. + * The last scan performed on a profile attachment. */ public class LastScan extends GenericModel { - /** - * The status of the last scan of an attachment. - */ - public interface Status { - /** in_progress. */ - String IN_PROGRESS = "in_progress"; - /** completed. */ - String COMPLETED = "completed"; - } - protected String id; protected String status; protected Date time; - /** - * Builder. - */ - public static class Builder { - private String id; - private String status; - private Date time; - - /** - * Instantiates a new Builder from an existing LastScan instance. - * - * @param lastScan the instance to initialize the Builder with - */ - private Builder(LastScan lastScan) { - this.id = lastScan.id; - this.status = lastScan.status; - this.time = lastScan.time; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a LastScan. - * - * @return the new LastScan instance - */ - public LastScan build() { - return new LastScan(this); - } - - /** - * Set the id. - * - * @param id the id - * @return the LastScan builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the status. - * - * @param status the status - * @return the LastScan builder - */ - public Builder status(String status) { - this.status = status; - return this; - } - - /** - * Set the time. - * - * @param time the time - * @return the LastScan builder - */ - public Builder time(Date time) { - this.time = time; - return this; - } - } - protected LastScan() { } - protected LastScan(Builder builder) { - id = builder.id; - status = builder.status; - time = builder.time; - } - - /** - * New builder. - * - * @return a LastScan builder - */ - public Builder newBuilder() { - return new Builder(this); - } - /** * Gets the id. * - * The ID of the last scan of an attachment. + * The ID of the last scan. * * @return the id */ - public String id() { + public String getId() { return id; } /** * Gets the status. * - * The status of the last scan of an attachment. + * Details the state of the last scan. * * @return the status */ - public String status() { + public String getStatus() { return status; } /** * Gets the time. * - * The time when the last scan started. + * The last time the scan ran. * * @return the time */ - public Date time() { + public Date getTime() { return time; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Link.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Link.java new file mode 100644 index 00000000..86e42ada --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Link.java @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * Link. + */ +public class Link extends GenericModel { + + protected String description; + protected String href; + + protected Link() { } + + /** + * Gets the description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the href. + * + * URL. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListControlLibrariesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListControlLibrariesOptions.java index 52fe17c2..5db21967 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListControlLibrariesOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListControlLibrariesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,20 +20,18 @@ */ public class ListControlLibrariesOptions extends GenericModel { - protected String xCorrelationId; - protected String xRequestId; + protected String instanceId; + protected String accountId; protected Long limit; - protected String controlLibraryType; protected String start; /** * Builder. */ public static class Builder { - private String xCorrelationId; - private String xRequestId; + private String instanceId; + private String accountId; private Long limit; - private String controlLibraryType; private String start; /** @@ -41,10 +40,9 @@ public static class Builder { * @param listControlLibrariesOptions the instance to initialize the Builder with */ private Builder(ListControlLibrariesOptions listControlLibrariesOptions) { - this.xCorrelationId = listControlLibrariesOptions.xCorrelationId; - this.xRequestId = listControlLibrariesOptions.xRequestId; + this.instanceId = listControlLibrariesOptions.instanceId; + this.accountId = listControlLibrariesOptions.accountId; this.limit = listControlLibrariesOptions.limit; - this.controlLibraryType = listControlLibrariesOptions.controlLibraryType; this.start = listControlLibrariesOptions.start; } @@ -54,6 +52,15 @@ private Builder(ListControlLibrariesOptions listControlLibrariesOptions) { public Builder() { } + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + */ + public Builder(String instanceId) { + this.instanceId = instanceId; + } + /** * Builds a ListControlLibrariesOptions. * @@ -64,24 +71,24 @@ public ListControlLibrariesOptions build() { } /** - * Set the xCorrelationId. + * Set the instanceId. * - * @param xCorrelationId the xCorrelationId + * @param instanceId the instanceId * @return the ListControlLibrariesOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xRequestId. + * Set the accountId. * - * @param xRequestId the xRequestId + * @param accountId the accountId * @return the ListControlLibrariesOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } @@ -96,17 +103,6 @@ public Builder limit(long limit) { return this; } - /** - * Set the controlLibraryType. - * - * @param controlLibraryType the controlLibraryType - * @return the ListControlLibrariesOptions builder - */ - public Builder controlLibraryType(String controlLibraryType) { - this.controlLibraryType = controlLibraryType; - return this; - } - /** * Set the start. * @@ -122,10 +118,11 @@ public Builder start(String start) { protected ListControlLibrariesOptions() { } protected ListControlLibrariesOptions(Builder builder) { - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; + accountId = builder.accountId; limit = builder.limit; - controlLibraryType = builder.controlLibraryType; start = builder.start; } @@ -139,35 +136,31 @@ public Builder newBuilder() { } /** - * Gets the xCorrelationId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xCorrelationId + * @return the instanceId */ - public String xCorrelationId() { - return xCorrelationId; + public String instanceId() { + return instanceId; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } /** * Gets the limit. * - * The field that indicates how many resources to return, unless the response is the last page of resources. + * The indication of how many resources to return, unless the response is the last page of resources. * * @return the limit */ @@ -175,17 +168,6 @@ public Long limit() { return limit; } - /** - * Gets the controlLibraryType. - * - * The field that indicate how you want the resources to be filtered by. - * - * @return the controlLibraryType - */ - public String controlLibraryType() { - return controlLibraryType; - } - /** * Gets the start. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListInstanceAttachmentsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListInstanceAttachmentsOptions.java new file mode 100644 index 00000000..9a0ac445 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListInstanceAttachmentsOptions.java @@ -0,0 +1,283 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 listInstanceAttachments options. + */ +public class ListInstanceAttachmentsOptions extends GenericModel { + + /** + * The sorted collection of attachments. The available values are `created_on` and `scope_type`. + */ + public interface Sort { + /** created_on. */ + String CREATED_ON = "created_on"; + /** scope_type. */ + String SCOPE_TYPE = "scope_type"; + } + + /** + * The collection of attachments that is sorted in ascending order. To sort the collection in descending order, use + * the `DESC` schema. + */ + public interface Direction { + /** desc. */ + String DESC = "desc"; + /** asc. */ + String ASC = "asc"; + } + + protected String instanceId; + protected String accountId; + protected String versionGroupLabel; + protected Long limit; + protected String sort; + protected String direction; + protected String start; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String accountId; + private String versionGroupLabel; + private Long limit; + private String sort; + private String direction; + private String start; + + /** + * Instantiates a new Builder from an existing ListInstanceAttachmentsOptions instance. + * + * @param listInstanceAttachmentsOptions the instance to initialize the Builder with + */ + private Builder(ListInstanceAttachmentsOptions listInstanceAttachmentsOptions) { + this.instanceId = listInstanceAttachmentsOptions.instanceId; + this.accountId = listInstanceAttachmentsOptions.accountId; + this.versionGroupLabel = listInstanceAttachmentsOptions.versionGroupLabel; + this.limit = listInstanceAttachmentsOptions.limit; + this.sort = listInstanceAttachmentsOptions.sort; + this.direction = listInstanceAttachmentsOptions.direction; + this.start = listInstanceAttachmentsOptions.start; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + */ + public Builder(String instanceId) { + this.instanceId = instanceId; + } + + /** + * Builds a ListInstanceAttachmentsOptions. + * + * @return the new ListInstanceAttachmentsOptions instance + */ + public ListInstanceAttachmentsOptions build() { + return new ListInstanceAttachmentsOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ListInstanceAttachmentsOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListInstanceAttachmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the versionGroupLabel. + * + * @param versionGroupLabel the versionGroupLabel + * @return the ListInstanceAttachmentsOptions builder + */ + public Builder versionGroupLabel(String versionGroupLabel) { + this.versionGroupLabel = versionGroupLabel; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListInstanceAttachmentsOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListInstanceAttachmentsOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the direction. + * + * @param direction the direction + * @return the ListInstanceAttachmentsOptions builder + */ + public Builder direction(String direction) { + this.direction = direction; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListInstanceAttachmentsOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + } + + protected ListInstanceAttachmentsOptions() { } + + protected ListInstanceAttachmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; + accountId = builder.accountId; + versionGroupLabel = builder.versionGroupLabel; + limit = builder.limit; + sort = builder.sort; + direction = builder.direction; + start = builder.start; + } + + /** + * New builder. + * + * @return a ListInstanceAttachmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the accountId. + * + * The user account ID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the versionGroupLabel. + * + * The profile version group label. + * + * @return the versionGroupLabel + */ + public String versionGroupLabel() { + return versionGroupLabel; + } + + /** + * Gets the limit. + * + * The number of items that are retrieved in a collection. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the sort. + * + * The sorted collection of attachments. The available values are `created_on` and `scope_type`. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the direction. + * + * The collection of attachments that is sorted in ascending order. To sort the collection in descending order, use + * the `DESC` schema. + * + * @return the direction + */ + public String direction() { + return direction; + } + + /** + * Gets the start. + * + * The reference to the first item in the results page. Take the value from the `next` field that is in the response + * from the previous page. + * + * @return the start + */ + public String start() { + return start; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileAttachmentsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileAttachmentsOptions.java new file mode 100644 index 00000000..02b82f36 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileAttachmentsOptions.java @@ -0,0 +1,160 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 listProfileAttachments options. + */ +public class ListProfileAttachmentsOptions extends GenericModel { + + protected String instanceId; + protected String profileId; + protected String accountId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String profileId; + private String accountId; + + /** + * Instantiates a new Builder from an existing ListProfileAttachmentsOptions instance. + * + * @param listProfileAttachmentsOptions the instance to initialize the Builder with + */ + private Builder(ListProfileAttachmentsOptions listProfileAttachmentsOptions) { + this.instanceId = listProfileAttachmentsOptions.instanceId; + this.profileId = listProfileAttachmentsOptions.profileId; + this.accountId = listProfileAttachmentsOptions.accountId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param profileId the profileId + */ + public Builder(String instanceId, String profileId) { + this.instanceId = instanceId; + this.profileId = profileId; + } + + /** + * Builds a ListProfileAttachmentsOptions. + * + * @return the new ListProfileAttachmentsOptions instance + */ + public ListProfileAttachmentsOptions build() { + return new ListProfileAttachmentsOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ListProfileAttachmentsOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the profileId. + * + * @param profileId the profileId + * @return the ListProfileAttachmentsOptions builder + */ + public Builder profileId(String profileId) { + this.profileId = profileId; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ListProfileAttachmentsOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + } + + protected ListProfileAttachmentsOptions() { } + + protected ListProfileAttachmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); + instanceId = builder.instanceId; + profileId = builder.profileId; + accountId = builder.accountId; + } + + /** + * New builder. + * + * @return a ListProfileAttachmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the profileId. + * + * The profile ID. + * + * @return the profileId + */ + public String profileId() { + return profileId; + } + + /** + * Gets the accountId. + * + * The user account ID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileParametersOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileParametersOptions.java new file mode 100644 index 00000000..953b0e84 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileParametersOptions.java @@ -0,0 +1,134 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 listProfileParameters options. + */ +public class ListProfileParametersOptions extends GenericModel { + + protected String instanceId; + protected String profileId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String profileId; + + /** + * Instantiates a new Builder from an existing ListProfileParametersOptions instance. + * + * @param listProfileParametersOptions the instance to initialize the Builder with + */ + private Builder(ListProfileParametersOptions listProfileParametersOptions) { + this.instanceId = listProfileParametersOptions.instanceId; + this.profileId = listProfileParametersOptions.profileId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param profileId the profileId + */ + public Builder(String instanceId, String profileId) { + this.instanceId = instanceId; + this.profileId = profileId; + } + + /** + * Builds a ListProfileParametersOptions. + * + * @return the new ListProfileParametersOptions instance + */ + public ListProfileParametersOptions build() { + return new ListProfileParametersOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ListProfileParametersOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the profileId. + * + * @param profileId the profileId + * @return the ListProfileParametersOptions builder + */ + public Builder profileId(String profileId) { + this.profileId = profileId; + return this; + } + } + + protected ListProfileParametersOptions() { } + + protected ListProfileParametersOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); + instanceId = builder.instanceId; + profileId = builder.profileId; + } + + /** + * New builder. + * + * @return a ListProfileParametersOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the profileId. + * + * The profile ID. + * + * @return the profileId + */ + 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/ListProfilesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfilesOptions.java index b6ad2ba2..32312592 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfilesOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfilesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,20 +20,18 @@ */ public class ListProfilesOptions extends GenericModel { - protected String xCorrelationId; - protected String xRequestId; + protected String instanceId; + protected String accountId; protected Long limit; - protected String profileType; protected String start; /** * Builder. */ public static class Builder { - private String xCorrelationId; - private String xRequestId; + private String instanceId; + private String accountId; private Long limit; - private String profileType; private String start; /** @@ -41,10 +40,9 @@ public static class Builder { * @param listProfilesOptions the instance to initialize the Builder with */ private Builder(ListProfilesOptions listProfilesOptions) { - this.xCorrelationId = listProfilesOptions.xCorrelationId; - this.xRequestId = listProfilesOptions.xRequestId; + this.instanceId = listProfilesOptions.instanceId; + this.accountId = listProfilesOptions.accountId; this.limit = listProfilesOptions.limit; - this.profileType = listProfilesOptions.profileType; this.start = listProfilesOptions.start; } @@ -54,6 +52,15 @@ private Builder(ListProfilesOptions listProfilesOptions) { public Builder() { } + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + */ + public Builder(String instanceId) { + this.instanceId = instanceId; + } + /** * Builds a ListProfilesOptions. * @@ -64,24 +71,24 @@ public ListProfilesOptions build() { } /** - * Set the xCorrelationId. + * Set the instanceId. * - * @param xCorrelationId the xCorrelationId + * @param instanceId the instanceId * @return the ListProfilesOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xRequestId. + * Set the accountId. * - * @param xRequestId the xRequestId + * @param accountId the accountId * @return the ListProfilesOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } @@ -96,17 +103,6 @@ public Builder limit(long limit) { return this; } - /** - * Set the profileType. - * - * @param profileType the profileType - * @return the ListProfilesOptions builder - */ - public Builder profileType(String profileType) { - this.profileType = profileType; - return this; - } - /** * Set the start. * @@ -122,10 +118,11 @@ public Builder start(String start) { protected ListProfilesOptions() { } protected ListProfilesOptions(Builder builder) { - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; + accountId = builder.accountId; limit = builder.limit; - profileType = builder.profileType; start = builder.start; } @@ -139,29 +136,25 @@ public Builder newBuilder() { } /** - * Gets the xCorrelationId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request, and repeated in a response header for the - * corresponding response. The same value is used for downstream requests, and retries of those requests. If a value - * of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xCorrelationId + * @return the instanceId */ - public String xCorrelationId() { - return xCorrelationId; + public String instanceId() { + return instanceId; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } /** @@ -175,17 +168,6 @@ public Long limit() { return limit; } - /** - * Gets the profileType. - * - * The field that indicate how you want the resources to be filtered by. - * - * @return the profileType - */ - public String profileType() { - return profileType; - } - /** * Gets the start. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypeInstancesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypeInstancesOptions.java index 2faac151..9e4f8a94 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypeInstancesOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypeInstancesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,17 +20,15 @@ */ public class ListProviderTypeInstancesOptions extends GenericModel { + protected String instanceId; protected String providerTypeId; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String providerTypeId; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing ListProviderTypeInstancesOptions instance. @@ -37,9 +36,8 @@ public static class Builder { * @param listProviderTypeInstancesOptions the instance to initialize the Builder with */ private Builder(ListProviderTypeInstancesOptions listProviderTypeInstancesOptions) { + this.instanceId = listProviderTypeInstancesOptions.instanceId; this.providerTypeId = listProviderTypeInstancesOptions.providerTypeId; - this.xCorrelationId = listProviderTypeInstancesOptions.xCorrelationId; - this.xRequestId = listProviderTypeInstancesOptions.xRequestId; } /** @@ -51,9 +49,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param providerTypeId the providerTypeId */ - public Builder(String providerTypeId) { + public Builder(String instanceId, String providerTypeId) { + this.instanceId = instanceId; this.providerTypeId = providerTypeId; } @@ -67,35 +67,24 @@ public ListProviderTypeInstancesOptions build() { } /** - * Set the providerTypeId. - * - * @param providerTypeId the providerTypeId - * @return the ListProviderTypeInstancesOptions builder - */ - public Builder providerTypeId(String providerTypeId) { - this.providerTypeId = providerTypeId; - return this; - } - - /** - * Set the xCorrelationId. + * Set the instanceId. * - * @param xCorrelationId the xCorrelationId + * @param instanceId the instanceId * @return the ListProviderTypeInstancesOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xRequestId. + * Set the providerTypeId. * - * @param xRequestId the xRequestId + * @param providerTypeId the providerTypeId * @return the ListProviderTypeInstancesOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder providerTypeId(String providerTypeId) { + this.providerTypeId = providerTypeId; return this; } } @@ -103,11 +92,12 @@ public Builder xRequestId(String xRequestId) { protected ListProviderTypeInstancesOptions() { } protected ListProviderTypeInstancesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerTypeId, "providerTypeId cannot be empty"); + instanceId = builder.instanceId; providerTypeId = builder.providerTypeId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -120,40 +110,25 @@ public Builder newBuilder() { } /** - * Gets the providerTypeId. - * - * The provider type ID. - * - * @return the providerTypeId - */ - public String providerTypeId() { - return providerTypeId; - } - - /** - * Gets the xCorrelationId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this headers is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xCorrelationId + * @return the instanceId */ - public String xCorrelationId() { - return xCorrelationId; + public String instanceId() { + return instanceId; } /** - * Gets the xRequestId. + * Gets the providerTypeId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this headers is not supplied in a request, the service generates a random (version 4) UUID. + * The provider type ID. * - * @return the xRequestId + * @return the providerTypeId */ - public String xRequestId() { - return xRequestId; + public String providerTypeId() { + return providerTypeId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypesOptions.java index 00f022b5..61fc7b25 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypesOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,15 +20,13 @@ */ public class ListProviderTypesOptions extends GenericModel { - protected String xCorrelationId; - protected String xRequestId; + protected String instanceId; /** * Builder. */ public static class Builder { - private String xCorrelationId; - private String xRequestId; + private String instanceId; /** * Instantiates a new Builder from an existing ListProviderTypesOptions instance. @@ -35,8 +34,7 @@ public static class Builder { * @param listProviderTypesOptions the instance to initialize the Builder with */ private Builder(ListProviderTypesOptions listProviderTypesOptions) { - this.xCorrelationId = listProviderTypesOptions.xCorrelationId; - this.xRequestId = listProviderTypesOptions.xRequestId; + this.instanceId = listProviderTypesOptions.instanceId; } /** @@ -46,33 +44,31 @@ public Builder() { } /** - * Builds a ListProviderTypesOptions. + * Instantiates a new builder with required properties. * - * @return the new ListProviderTypesOptions instance + * @param instanceId the instanceId */ - public ListProviderTypesOptions build() { - return new ListProviderTypesOptions(this); + public Builder(String instanceId) { + this.instanceId = instanceId; } /** - * Set the xCorrelationId. + * Builds a ListProviderTypesOptions. * - * @param xCorrelationId the xCorrelationId - * @return the ListProviderTypesOptions builder + * @return the new ListProviderTypesOptions instance */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; + public ListProviderTypesOptions build() { + return new ListProviderTypesOptions(this); } /** - * Set the xRequestId. + * Set the instanceId. * - * @param xRequestId the xRequestId + * @param instanceId the instanceId * @return the ListProviderTypesOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } } @@ -80,8 +76,9 @@ public Builder xRequestId(String xRequestId) { protected ListProviderTypesOptions() { } protected ListProviderTypesOptions(Builder builder) { - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; } /** @@ -94,29 +91,14 @@ public Builder newBuilder() { } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this headers is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this headers is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xRequestId + * @return the instanceId */ - public String xRequestId() { - return xRequestId; + public String instanceId() { + return instanceId; } } 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 50c24557..acde38be 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -33,9 +34,23 @@ public interface Status { String SKIPPED = "skipped"; } + /** + * This field sorts resources by using a valid sort field. To learn more, see + * [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + */ + public interface Sort { + /** assessment_id. */ + String ASSESSMENT_ID = "assessment_id"; + /** target_id. */ + String TARGET_ID = "target_id"; + /** target_name. */ + String TARGET_NAME = "target_name"; + /** status. */ + String STATUS = "status"; + } + + protected String instanceId; protected String reportId; - protected String xCorrelationId; - protected String xRequestId; protected String assessmentId; protected String assessmentMethod; protected String componentId; @@ -45,14 +60,16 @@ public interface Status { protected String status; protected String start; protected Long limit; + protected String sort; + protected String scopeId; + protected String subscopeId; /** * Builder. */ public static class Builder { + private String instanceId; private String reportId; - private String xCorrelationId; - private String xRequestId; private String assessmentId; private String assessmentMethod; private String componentId; @@ -62,6 +79,9 @@ public static class Builder { private String status; private String start; private Long limit; + private String sort; + private String scopeId; + private String subscopeId; /** * Instantiates a new Builder from an existing ListReportEvaluationsOptions instance. @@ -69,9 +89,8 @@ public static class Builder { * @param listReportEvaluationsOptions the instance to initialize the Builder with */ private Builder(ListReportEvaluationsOptions listReportEvaluationsOptions) { + this.instanceId = listReportEvaluationsOptions.instanceId; this.reportId = listReportEvaluationsOptions.reportId; - this.xCorrelationId = listReportEvaluationsOptions.xCorrelationId; - this.xRequestId = listReportEvaluationsOptions.xRequestId; this.assessmentId = listReportEvaluationsOptions.assessmentId; this.assessmentMethod = listReportEvaluationsOptions.assessmentMethod; this.componentId = listReportEvaluationsOptions.componentId; @@ -81,6 +100,9 @@ private Builder(ListReportEvaluationsOptions listReportEvaluationsOptions) { this.status = listReportEvaluationsOptions.status; this.start = listReportEvaluationsOptions.start; this.limit = listReportEvaluationsOptions.limit; + this.sort = listReportEvaluationsOptions.sort; + this.scopeId = listReportEvaluationsOptions.scopeId; + this.subscopeId = listReportEvaluationsOptions.subscopeId; } /** @@ -92,9 +114,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param reportId the reportId */ - public Builder(String reportId) { + public Builder(String instanceId, String reportId) { + this.instanceId = instanceId; this.reportId = reportId; } @@ -108,35 +132,24 @@ public ListReportEvaluationsOptions build() { } /** - * Set the reportId. + * Set the instanceId. * - * @param reportId the reportId + * @param instanceId the instanceId * @return the ListReportEvaluationsOptions builder */ - public Builder reportId(String reportId) { - this.reportId = reportId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the ListReportEvaluationsOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. + * Set the reportId. * - * @param xRequestId the xRequestId + * @param reportId the reportId * @return the ListReportEvaluationsOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder reportId(String reportId) { + this.reportId = reportId; return this; } @@ -238,16 +251,50 @@ public Builder limit(long limit) { this.limit = limit; return this; } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListReportEvaluationsOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the ListReportEvaluationsOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the subscopeId. + * + * @param subscopeId the subscopeId + * @return the ListReportEvaluationsOptions builder + */ + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; + return this; + } } protected ListReportEvaluationsOptions() { } protected ListReportEvaluationsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, "reportId cannot be empty"); + instanceId = builder.instanceId; reportId = builder.reportId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; assessmentId = builder.assessmentId; assessmentMethod = builder.assessmentMethod; componentId = builder.componentId; @@ -257,6 +304,9 @@ protected ListReportEvaluationsOptions(Builder builder) { status = builder.status; start = builder.start; limit = builder.limit; + sort = builder.sort; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; } /** @@ -269,40 +319,25 @@ public Builder newBuilder() { } /** - * Gets the reportId. + * Gets the instanceId. * - * The ID of the scan that is associated with a report. + * The ID of the Security and Compliance Center instance. * - * @return the reportId + * @return the instanceId */ - public String reportId() { - return reportId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the reportId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the scan that is associated with a report. * - * @return the xRequestId + * @return the reportId */ - public String xRequestId() { - return xRequestId; + public String reportId() { + return reportId; } /** @@ -396,12 +431,46 @@ public String start() { /** * Gets the limit. * - * The indication of many resources to return, unless the response is the last page of resources. + * The indication of many resources to return, unless the response is the last page of resources. * * @return the limit */ public Long limit() { return limit; } + + /** + * Gets the sort. + * + * This field sorts resources by using a valid sort field. To learn more, see + * [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the scopeId. + * + * The ID of the scope. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The ID of the subscope. + * + * @return the subscopeId + */ + public String subscopeId() { + return subscopeId; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportResourcesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportResourcesOptions.java index f42f5a5c..7fbadec9 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportResourcesOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportResourcesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -31,6 +32,8 @@ public interface Status { String UNABLE_TO_PERFORM = "unable_to_perform"; /** user_evaluation_required. */ String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; } /** @@ -48,9 +51,8 @@ public interface Sort { String STATUS = "status"; } + protected String instanceId; protected String reportId; - protected String xCorrelationId; - protected String xRequestId; protected String id; protected String resourceName; protected String accountId; @@ -59,14 +61,15 @@ public interface Sort { protected String sort; protected String start; protected Long limit; + protected String scopeId; + protected String subscopeId; /** * Builder. */ public static class Builder { + private String instanceId; private String reportId; - private String xCorrelationId; - private String xRequestId; private String id; private String resourceName; private String accountId; @@ -75,6 +78,8 @@ public static class Builder { private String sort; private String start; private Long limit; + private String scopeId; + private String subscopeId; /** * Instantiates a new Builder from an existing ListReportResourcesOptions instance. @@ -82,9 +87,8 @@ public static class Builder { * @param listReportResourcesOptions the instance to initialize the Builder with */ private Builder(ListReportResourcesOptions listReportResourcesOptions) { + this.instanceId = listReportResourcesOptions.instanceId; this.reportId = listReportResourcesOptions.reportId; - this.xCorrelationId = listReportResourcesOptions.xCorrelationId; - this.xRequestId = listReportResourcesOptions.xRequestId; this.id = listReportResourcesOptions.id; this.resourceName = listReportResourcesOptions.resourceName; this.accountId = listReportResourcesOptions.accountId; @@ -93,6 +97,8 @@ private Builder(ListReportResourcesOptions listReportResourcesOptions) { this.sort = listReportResourcesOptions.sort; this.start = listReportResourcesOptions.start; this.limit = listReportResourcesOptions.limit; + this.scopeId = listReportResourcesOptions.scopeId; + this.subscopeId = listReportResourcesOptions.subscopeId; } /** @@ -104,9 +110,11 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param reportId the reportId */ - public Builder(String reportId) { + public Builder(String instanceId, String reportId) { + this.instanceId = instanceId; this.reportId = reportId; } @@ -120,35 +128,24 @@ public ListReportResourcesOptions build() { } /** - * Set the reportId. + * Set the instanceId. * - * @param reportId the reportId + * @param instanceId the instanceId * @return the ListReportResourcesOptions builder */ - public Builder reportId(String reportId) { - this.reportId = reportId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the ListReportResourcesOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. + * Set the reportId. * - * @param xRequestId the xRequestId + * @param reportId the reportId * @return the ListReportResourcesOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder reportId(String reportId) { + this.reportId = reportId; return this; } @@ -239,16 +236,39 @@ public Builder limit(long limit) { this.limit = limit; return this; } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the ListReportResourcesOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the subscopeId. + * + * @param subscopeId the subscopeId + * @return the ListReportResourcesOptions builder + */ + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; + return this; + } } protected ListReportResourcesOptions() { } protected ListReportResourcesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, "reportId cannot be empty"); + instanceId = builder.instanceId; reportId = builder.reportId; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; id = builder.id; resourceName = builder.resourceName; accountId = builder.accountId; @@ -257,6 +277,8 @@ protected ListReportResourcesOptions(Builder builder) { sort = builder.sort; start = builder.start; limit = builder.limit; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; } /** @@ -269,40 +291,25 @@ public Builder newBuilder() { } /** - * Gets the reportId. + * Gets the instanceId. * - * The ID of the scan that is associated with a report. + * The ID of the Security and Compliance Center instance. * - * @return the reportId + * @return the instanceId */ - public String reportId() { - return reportId; + public String instanceId() { + return instanceId; } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the reportId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the scan that is associated with a report. * - * @return the xRequestId + * @return the reportId */ - public String xRequestId() { - return xRequestId; + public String reportId() { + return reportId; } /** @@ -330,7 +337,7 @@ public String resourceName() { /** * Gets the accountId. * - * The ID of the account owning a resource. + * The user account ID. * * @return the accountId */ @@ -386,12 +393,34 @@ public String start() { /** * Gets the limit. * - * The indication of many resources to return, unless the response is the last page of resources. + * The indication of many resources to return, unless the response is the last page of resources. * * @return the limit */ public Long limit() { return limit; } + + /** + * Gets the scopeId. + * + * The ID of the scope. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The ID of the subscope. + * + * @return the subscopeId + */ + public String subscopeId() { + return subscopeId; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportsOptions.java index 8a18b090..939f9570 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportsOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -29,11 +30,26 @@ public interface Type { String SCHEDULED = "scheduled"; } - protected String xCorrelationId; - protected String xRequestId; - protected String attachmentId; + /** + * This field sorts results by using a valid sort field. + */ + public interface Sort { + /** profile_name. */ + String PROFILE_NAME = "profile_name"; + /** scope_id. */ + String SCOPE_ID = "scope_id"; + /** group_id. */ + String GROUP_ID = "group_id"; + /** created_on. */ + String CREATED_ON = "created_on"; + /** type. */ + String TYPE = "type"; + } + + protected String instanceId; + protected String reportAttachmentId; protected String groupId; - protected String profileId; + protected String reportProfileId; protected String type; protected String start; protected Long limit; @@ -43,11 +59,10 @@ public interface Type { * Builder. */ public static class Builder { - private String xCorrelationId; - private String xRequestId; - private String attachmentId; + private String instanceId; + private String reportAttachmentId; private String groupId; - private String profileId; + private String reportProfileId; private String type; private String start; private Long limit; @@ -59,11 +74,10 @@ public static class Builder { * @param listReportsOptions the instance to initialize the Builder with */ private Builder(ListReportsOptions listReportsOptions) { - this.xCorrelationId = listReportsOptions.xCorrelationId; - this.xRequestId = listReportsOptions.xRequestId; - this.attachmentId = listReportsOptions.attachmentId; + this.instanceId = listReportsOptions.instanceId; + this.reportAttachmentId = listReportsOptions.reportAttachmentId; this.groupId = listReportsOptions.groupId; - this.profileId = listReportsOptions.profileId; + this.reportProfileId = listReportsOptions.reportProfileId; this.type = listReportsOptions.type; this.start = listReportsOptions.start; this.limit = listReportsOptions.limit; @@ -77,44 +91,42 @@ public Builder() { } /** - * Builds a ListReportsOptions. + * Instantiates a new builder with required properties. * - * @return the new ListReportsOptions instance + * @param instanceId the instanceId */ - public ListReportsOptions build() { - return new ListReportsOptions(this); + public Builder(String instanceId) { + this.instanceId = instanceId; } /** - * Set the xCorrelationId. + * Builds a ListReportsOptions. * - * @param xCorrelationId the xCorrelationId - * @return the ListReportsOptions builder + * @return the new ListReportsOptions instance */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; + public ListReportsOptions build() { + return new ListReportsOptions(this); } /** - * Set the xRequestId. + * Set the instanceId. * - * @param xRequestId the xRequestId + * @param instanceId the instanceId * @return the ListReportsOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the attachmentId. + * Set the reportAttachmentId. * - * @param attachmentId the attachmentId + * @param reportAttachmentId the reportAttachmentId * @return the ListReportsOptions builder */ - public Builder attachmentId(String attachmentId) { - this.attachmentId = attachmentId; + public Builder reportAttachmentId(String reportAttachmentId) { + this.reportAttachmentId = reportAttachmentId; return this; } @@ -130,13 +142,13 @@ public Builder groupId(String groupId) { } /** - * Set the profileId. + * Set the reportProfileId. * - * @param profileId the profileId + * @param reportProfileId the reportProfileId * @return the ListReportsOptions builder */ - public Builder profileId(String profileId) { - this.profileId = profileId; + public Builder reportProfileId(String reportProfileId) { + this.reportProfileId = reportProfileId; return this; } @@ -188,11 +200,12 @@ public Builder sort(String sort) { protected ListReportsOptions() { } protected ListReportsOptions(Builder builder) { - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; - attachmentId = builder.attachmentId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; + reportAttachmentId = builder.reportAttachmentId; groupId = builder.groupId; - profileId = builder.profileId; + reportProfileId = builder.reportProfileId; type = builder.type; start = builder.start; limit = builder.limit; @@ -209,40 +222,25 @@ public Builder newBuilder() { } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xRequestId + * @return the instanceId */ - public String xRequestId() { - return xRequestId; + public String instanceId() { + return instanceId; } /** - * Gets the attachmentId. + * Gets the reportAttachmentId. * * The ID of the attachment. * - * @return the attachmentId + * @return the reportAttachmentId */ - public String attachmentId() { - return attachmentId; + public String reportAttachmentId() { + return reportAttachmentId; } /** @@ -257,14 +255,14 @@ public String groupId() { } /** - * Gets the profileId. + * Gets the reportProfileId. * * The ID of the profile. * - * @return the profileId + * @return the reportProfileId */ - public String profileId() { - return profileId; + public String reportProfileId() { + return reportProfileId; } /** @@ -292,7 +290,7 @@ public String start() { /** * Gets the limit. * - * The indication of many resources to return, unless the response is the last page of resources. + * The indication of many resources to return, unless the response is the last page of resources. * * @return the limit */ @@ -303,8 +301,7 @@ public Long limit() { /** * Gets the sort. * - * This field sorts results by using a valid sort field. To learn more, see - * [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + * This field sorts results by using a valid sort field. * * @return the sort */ diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListRulesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListRulesOptions.java index 16429dc1..73e7e707 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListRulesOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListRulesOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,21 +20,49 @@ */ public class ListRulesOptions extends GenericModel { - protected String xCorrelationId; - protected String xRequestId; + /** + * The list of only user-defined, or system-defined rules. + */ + public interface Type { + /** user_defined. */ + String USER_DEFINED = "user_defined"; + /** system_defined. */ + String SYSTEM_DEFINED = "system_defined"; + } + + /** + * Field used to sort rules. Rules can be sorted in ascending or descending order. + */ + public interface Sort { + /** description. */ + String DESCRIPTION = "description"; + /** service_display_name. */ + String SERVICE_DISPLAY_NAME = "service_display_name"; + /** type. */ + String TYPE = "type"; + /** updated_on. */ + String UPDATED_ON = "updated_on"; + } + + protected String instanceId; + protected Long limit; + protected String start; protected String type; protected String search; protected String serviceName; + protected String sort; /** * Builder. */ public static class Builder { - private String xCorrelationId; - private String xRequestId; + private String instanceId; + private Long limit; + private String start; private String type; private String search; private String serviceName; + private String sort; /** * Instantiates a new Builder from an existing ListRulesOptions instance. @@ -41,11 +70,13 @@ public static class Builder { * @param listRulesOptions the instance to initialize the Builder with */ private Builder(ListRulesOptions listRulesOptions) { - this.xCorrelationId = listRulesOptions.xCorrelationId; - this.xRequestId = listRulesOptions.xRequestId; + this.instanceId = listRulesOptions.instanceId; + this.limit = listRulesOptions.limit; + this.start = listRulesOptions.start; this.type = listRulesOptions.type; this.search = listRulesOptions.search; this.serviceName = listRulesOptions.serviceName; + this.sort = listRulesOptions.sort; } /** @@ -54,6 +85,15 @@ private Builder(ListRulesOptions listRulesOptions) { public Builder() { } + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + */ + public Builder(String instanceId) { + this.instanceId = instanceId; + } + /** * Builds a ListRulesOptions. * @@ -64,24 +104,35 @@ public ListRulesOptions build() { } /** - * Set the xCorrelationId. + * Set the instanceId. * - * @param xCorrelationId the xCorrelationId + * @param instanceId the instanceId * @return the ListRulesOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the xRequestId. + * Set the limit. * - * @param xRequestId the xRequestId + * @param limit the limit * @return the ListRulesOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListRulesOptions builder + */ + public Builder start(String start) { + this.start = start; return this; } @@ -117,16 +168,31 @@ public Builder serviceName(String serviceName) { this.serviceName = serviceName; return this; } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListRulesOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } } protected ListRulesOptions() { } protected ListRulesOptions(Builder builder) { - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; + limit = builder.limit; + start = builder.start; type = builder.type; search = builder.search; serviceName = builder.serviceName; + sort = builder.sort; } /** @@ -139,29 +205,36 @@ public Builder newBuilder() { } /** - * Gets the xCorrelationId. + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the limit. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The indication of how many resources to return, unless the response is the last page of resources. * - * @return the xCorrelationId + * @return the limit */ - public String xCorrelationId() { - return xCorrelationId; + public Long limit() { + return limit; } /** - * Gets the xRequestId. + * Gets the start. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * Determine what resource to start the page on or after. * - * @return the xRequestId + * @return the start */ - public String xRequestId() { - return xRequestId; + public String start() { + return start; } /** @@ -196,5 +269,16 @@ public String search() { public String serviceName() { return serviceName; } + + /** + * Gets the sort. + * + * Field used to sort rules. Rules can be sorted in ascending or descending order. + * + * @return the sort + */ + public String sort() { + return sort; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScanReportsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScanReportsOptions.java new file mode 100644 index 00000000..985b5af6 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScanReportsOptions.java @@ -0,0 +1,226 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 listScanReports options. + */ +public class ListScanReportsOptions extends GenericModel { + + /** + * This field sorts results by using a valid sort field. + */ + public interface Sort { + /** status. */ + String STATUS = "status"; + /** scope_id. */ + String SCOPE_ID = "scope_id"; + /** subscope_id. */ + String SUBSCOPE_ID = "subscope_id"; + /** created_on. */ + String CREATED_ON = "created_on"; + } + + protected String instanceId; + protected String reportId; + protected String scopeId; + protected String subscopeId; + protected String sort; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String reportId; + private String scopeId; + private String subscopeId; + private String sort; + + /** + * Instantiates a new Builder from an existing ListScanReportsOptions instance. + * + * @param listScanReportsOptions the instance to initialize the Builder with + */ + private Builder(ListScanReportsOptions listScanReportsOptions) { + this.instanceId = listScanReportsOptions.instanceId; + this.reportId = listScanReportsOptions.reportId; + this.scopeId = listScanReportsOptions.scopeId; + this.subscopeId = listScanReportsOptions.subscopeId; + this.sort = listScanReportsOptions.sort; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param reportId the reportId + */ + public Builder(String instanceId, String reportId) { + this.instanceId = instanceId; + this.reportId = reportId; + } + + /** + * Builds a ListScanReportsOptions. + * + * @return the new ListScanReportsOptions instance + */ + public ListScanReportsOptions build() { + return new ListScanReportsOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ListScanReportsOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the reportId. + * + * @param reportId the reportId + * @return the ListScanReportsOptions builder + */ + public Builder reportId(String reportId) { + this.reportId = reportId; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the ListScanReportsOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the subscopeId. + * + * @param subscopeId the subscopeId + * @return the ListScanReportsOptions builder + */ + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListScanReportsOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + } + + protected ListScanReportsOptions() { } + + protected ListScanReportsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.reportId, + "reportId cannot be empty"); + instanceId = builder.instanceId; + reportId = builder.reportId; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; + sort = builder.sort; + } + + /** + * New builder. + * + * @return a ListScanReportsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the reportId. + * + * The ID of the scan that is associated with a report. + * + * @return the reportId + */ + public String reportId() { + return reportId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The ID of the subscope. + * + * @return the subscopeId + */ + public String subscopeId() { + return subscopeId; + } + + /** + * Gets the sort. + * + * This field sorts results by using a valid sort field. + * + * @return the sort + */ + public String sort() { + return sort; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScopesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScopesOptions.java new file mode 100644 index 00000000..e9693eee --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScopesOptions.java @@ -0,0 +1,234 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 listScopes options. + */ +public class ListScopesOptions extends GenericModel { + + protected String instanceId; + protected Long limit; + protected String start; + protected String name; + protected String description; + protected String environment; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private Long limit; + private String start; + private String name; + private String description; + private String environment; + + /** + * Instantiates a new Builder from an existing ListScopesOptions instance. + * + * @param listScopesOptions the instance to initialize the Builder with + */ + private Builder(ListScopesOptions listScopesOptions) { + this.instanceId = listScopesOptions.instanceId; + this.limit = listScopesOptions.limit; + this.start = listScopesOptions.start; + this.name = listScopesOptions.name; + this.description = listScopesOptions.description; + this.environment = listScopesOptions.environment; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + */ + public Builder(String instanceId) { + this.instanceId = instanceId; + } + + /** + * Builds a ListScopesOptions. + * + * @return the new ListScopesOptions instance + */ + public ListScopesOptions build() { + return new ListScopesOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ListScopesOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListScopesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListScopesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListScopesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ListScopesOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the environment. + * + * @param environment the environment + * @return the ListScopesOptions builder + */ + public Builder environment(String environment) { + this.environment = environment; + return this; + } + } + + protected ListScopesOptions() { } + + protected ListScopesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; + limit = builder.limit; + start = builder.start; + name = builder.name; + description = builder.description; + environment = builder.environment; + } + + /** + * New builder. + * + * @return a ListScopesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the limit. + * + * The indication of how many resources to return, unless the response is the last page of resources. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Determine what resource to start the page on or after. + * + * @return the start + */ + public String start() { + return start; + } + + /** + * Gets the name. + * + * determine name of scope returned in response. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * determine descriptions of scope returned in response. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the environment. + * + * determine environment of scopes returned in response. + * + * @return the environment + */ + public String environment() { + return environment; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListServicesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListServicesOptions.java new file mode 100644 index 00000000..06ee784f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListServicesOptions.java @@ -0,0 +1,29 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 listServices options. + */ +public class ListServicesOptions extends GenericModel { + + /** + * Construct a new instance of ListServicesOptions. + */ + public ListServicesOptions() { + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListSubscopesOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListSubscopesOptions.java new file mode 100644 index 00000000..26de0803 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListSubscopesOptions.java @@ -0,0 +1,264 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 listSubscopes options. + */ +public class ListSubscopesOptions extends GenericModel { + + protected String instanceId; + protected String scopeId; + protected Long limit; + protected String start; + protected String name; + protected String description; + protected String environment; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String scopeId; + private Long limit; + private String start; + private String name; + private String description; + private String environment; + + /** + * Instantiates a new Builder from an existing ListSubscopesOptions instance. + * + * @param listSubscopesOptions the instance to initialize the Builder with + */ + private Builder(ListSubscopesOptions listSubscopesOptions) { + this.instanceId = listSubscopesOptions.instanceId; + this.scopeId = listSubscopesOptions.scopeId; + this.limit = listSubscopesOptions.limit; + this.start = listSubscopesOptions.start; + this.name = listSubscopesOptions.name; + this.description = listSubscopesOptions.description; + this.environment = listSubscopesOptions.environment; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param scopeId the scopeId + */ + public Builder(String instanceId, String scopeId) { + this.instanceId = instanceId; + this.scopeId = scopeId; + } + + /** + * Builds a ListSubscopesOptions. + * + * @return the new ListSubscopesOptions instance + */ + public ListSubscopesOptions build() { + return new ListSubscopesOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ListSubscopesOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the ListSubscopesOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the limit. + * + * @param limit the limit + * @return the ListSubscopesOptions builder + */ + public Builder limit(long limit) { + this.limit = limit; + return this; + } + + /** + * Set the start. + * + * @param start the start + * @return the ListSubscopesOptions builder + */ + public Builder start(String start) { + this.start = start; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ListSubscopesOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ListSubscopesOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the environment. + * + * @param environment the environment + * @return the ListSubscopesOptions builder + */ + public Builder environment(String environment) { + this.environment = environment; + return this; + } + } + + protected ListSubscopesOptions() { } + + protected ListSubscopesOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.scopeId, + "scopeId cannot be empty"); + instanceId = builder.instanceId; + scopeId = builder.scopeId; + limit = builder.limit; + start = builder.start; + name = builder.name; + description = builder.description; + environment = builder.environment; + } + + /** + * New builder. + * + * @return a ListSubscopesOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope being targeted. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the limit. + * + * The indication of how many resources to return, unless the response is the last page of resources. + * + * @return the limit + */ + public Long limit() { + return limit; + } + + /** + * Gets the start. + * + * Determine what resource to start the page on or after. + * + * @return the start + */ + public String start() { + return start; + } + + /** + * Gets the name. + * + * determine name of subscope returned in response. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * determine descriptions of subscopes returned in response. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the environment. + * + * determine environment of subscopes returned in response. + * + * @return the environment + */ + public String environment() { + return environment; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListTargetsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListTargetsOptions.java new file mode 100644 index 00000000..fe886135 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListTargetsOptions.java @@ -0,0 +1,104 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 listTargets options. + */ +public class ListTargetsOptions extends GenericModel { + + protected String instanceId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + + /** + * Instantiates a new Builder from an existing ListTargetsOptions instance. + * + * @param listTargetsOptions the instance to initialize the Builder with + */ + private Builder(ListTargetsOptions listTargetsOptions) { + this.instanceId = listTargetsOptions.instanceId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + */ + public Builder(String instanceId) { + this.instanceId = instanceId; + } + + /** + * Builds a ListTargetsOptions. + * + * @return the new ListTargetsOptions instance + */ + public ListTargetsOptions build() { + return new ListTargetsOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ListTargetsOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + } + + protected ListTargetsOptions() { } + + protected ListTargetsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; + } + + /** + * New builder. + * + * @return a ListTargetsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayload.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayload.java new file mode 100644 index 00000000..3236820b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayload.java @@ -0,0 +1,82 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * MultiCloudScopePayload. + * + * Classes which extend this class: + * - MultiCloudScopePayloadById + * - MultiCloudScopePayloadByProperties + */ +public class MultiCloudScopePayload extends GenericModel { + + protected String id; + protected String description; + protected String environment; + @SerializedName("properties") + protected List xProperties; + + protected MultiCloudScopePayload() { } + + /** + * Gets the id. + * + * The UUID of the scope made. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the description. + * + * The details of a newly created scope. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the environment. + * + * The environment that relates to this scope. + * + * @return the environment + */ + public String environment() { + return environment; + } + + /** + * Gets the xProperties. + * + * The properties supported for scoping by this environment. + * + * @return the xProperties + */ + public List xProperties() { + return xProperties; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadById.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadById.java new file mode 100644 index 00000000..1b6ad19b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadById.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 payload to reference a previously made scope object. + */ +public class MultiCloudScopePayloadById extends MultiCloudScopePayload { + + + /** + * Builder. + */ + public static class Builder { + private String id; + + /** + * Instantiates a new Builder from an existing MultiCloudScopePayloadById instance. + * + * @param multiCloudScopePayloadById the instance to initialize the Builder with + */ + public Builder(MultiCloudScopePayload multiCloudScopePayloadById) { + this.id = multiCloudScopePayloadById.id; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a MultiCloudScopePayloadById. + * + * @return the new MultiCloudScopePayloadById instance + */ + public MultiCloudScopePayloadById build() { + return new MultiCloudScopePayloadById(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the MultiCloudScopePayloadById builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + } + + protected MultiCloudScopePayloadById() { } + + protected MultiCloudScopePayloadById(Builder builder) { + id = builder.id; + } + + /** + * New builder. + * + * @return a MultiCloudScopePayloadById 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/MultiCloudScopePayloadByProperties.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadByProperties.java new file mode 100644 index 00000000..edcb4c3f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadByProperties.java @@ -0,0 +1,138 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * The payload to create a new Scope from a Profile Attachment. + */ +public class MultiCloudScopePayloadByProperties extends MultiCloudScopePayload { + + + /** + * Builder. + */ + public static class Builder { + private String description; + private String environment; + private List xProperties; + + /** + * Instantiates a new Builder from an existing MultiCloudScopePayloadByProperties instance. + * + * @param multiCloudScopePayloadByProperties the instance to initialize the Builder with + */ + public Builder(MultiCloudScopePayload multiCloudScopePayloadByProperties) { + this.description = multiCloudScopePayloadByProperties.description; + this.environment = multiCloudScopePayloadByProperties.environment; + this.xProperties = multiCloudScopePayloadByProperties.xProperties; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param xProperties the xProperties + */ + public Builder(List xProperties) { + this.xProperties = xProperties; + } + + /** + * Builds a MultiCloudScopePayloadByProperties. + * + * @return the new MultiCloudScopePayloadByProperties instance + */ + public MultiCloudScopePayloadByProperties build() { + return new MultiCloudScopePayloadByProperties(this); + } + + /** + * Adds a new element to xProperties. + * + * @param xProperties the new element to be added + * @return the MultiCloudScopePayloadByProperties builder + */ + public Builder addXProperties(ScopeProperty xProperties) { + com.ibm.cloud.sdk.core.util.Validator.notNull(xProperties, + "xProperties cannot be null"); + if (this.xProperties == null) { + this.xProperties = new ArrayList(); + } + this.xProperties.add(xProperties); + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the MultiCloudScopePayloadByProperties builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the environment. + * + * @param environment the environment + * @return the MultiCloudScopePayloadByProperties builder + */ + public Builder environment(String environment) { + this.environment = environment; + return this; + } + + /** + * Set the xProperties. + * Existing xProperties will be replaced. + * + * @param xProperties the xProperties + * @return the MultiCloudScopePayloadByProperties builder + */ + public Builder xProperties(List xProperties) { + this.xProperties = xProperties; + return this; + } + } + + protected MultiCloudScopePayloadByProperties() { } + + protected MultiCloudScopePayloadByProperties(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.xProperties, + "xProperties cannot be null"); + description = builder.description; + environment = builder.environment; + xProperties = builder.xProperties; + } + + /** + * New builder. + * + * @return a MultiCloudScopePayloadByProperties 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/ObjectStorage.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStorage.java index e48f7b09..6a6bdc61 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStorage.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStorage.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; @@ -32,119 +33,8 @@ public class ObjectStorage extends GenericModel { @SerializedName("updated_on") protected Date updatedOn; - /** - * Builder. - */ - public static class Builder { - private String instanceCrn; - private String bucket; - private String bucketLocation; - private String bucketEndpoint; - private Date updatedOn; - - /** - * Instantiates a new Builder from an existing ObjectStorage instance. - * - * @param objectStorage the instance to initialize the Builder with - */ - private Builder(ObjectStorage objectStorage) { - this.instanceCrn = objectStorage.instanceCrn; - this.bucket = objectStorage.bucket; - this.bucketLocation = objectStorage.bucketLocation; - this.bucketEndpoint = objectStorage.bucketEndpoint; - this.updatedOn = objectStorage.updatedOn; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a ObjectStorage. - * - * @return the new ObjectStorage instance - */ - public ObjectStorage build() { - return new ObjectStorage(this); - } - - /** - * Set the instanceCrn. - * - * @param instanceCrn the instanceCrn - * @return the ObjectStorage builder - */ - public Builder instanceCrn(String instanceCrn) { - this.instanceCrn = instanceCrn; - return this; - } - - /** - * Set the bucket. - * - * @param bucket the bucket - * @return the ObjectStorage builder - */ - public Builder bucket(String bucket) { - this.bucket = bucket; - return this; - } - - /** - * Set the bucketLocation. - * - * @param bucketLocation the bucketLocation - * @return the ObjectStorage builder - */ - public Builder bucketLocation(String bucketLocation) { - this.bucketLocation = bucketLocation; - return this; - } - - /** - * Set the bucketEndpoint. - * - * @param bucketEndpoint the bucketEndpoint - * @return the ObjectStorage builder - */ - public Builder bucketEndpoint(String bucketEndpoint) { - this.bucketEndpoint = bucketEndpoint; - return this; - } - - /** - * Set the updatedOn. - * - * @param updatedOn the updatedOn - * @return the ObjectStorage builder - */ - public Builder updatedOn(Date updatedOn) { - this.updatedOn = updatedOn; - return this; - } - } - protected ObjectStorage() { } - protected ObjectStorage(Builder builder) { - instanceCrn = builder.instanceCrn; - bucket = builder.bucket; - bucketLocation = builder.bucketLocation; - bucketEndpoint = builder.bucketEndpoint; - updatedOn = builder.updatedOn; - } - - /** - * New builder. - * - * @return a ObjectStorage builder - */ - public Builder newBuilder() { - return new Builder(this); - } - /** * Gets the instanceCrn. * @@ -152,7 +42,7 @@ public Builder newBuilder() { * * @return the instanceCrn */ - public String instanceCrn() { + public String getInstanceCrn() { return instanceCrn; } @@ -163,7 +53,7 @@ public String instanceCrn() { * * @return the bucket */ - public String bucket() { + public String getBucket() { return bucket; } @@ -174,7 +64,7 @@ public String bucket() { * * @return the bucketLocation */ - public String bucketLocation() { + public String getBucketLocation() { return bucketLocation; } @@ -185,7 +75,7 @@ public String bucketLocation() { * * @return the bucketEndpoint */ - public String bucketEndpoint() { + public String getBucketEndpoint() { return bucketEndpoint; } @@ -196,7 +86,7 @@ public String bucketEndpoint() { * * @return the updatedOn */ - public Date updatedOn() { + public Date getUpdatedOn() { return updatedOn; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStoragePrototype.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStoragePrototype.java new file mode 100644 index 00000000..8d0e1257 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStoragePrototype.java @@ -0,0 +1,121 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The payload to connect a Cloud Object Storage instance to an Security and Compliance Center instance. + */ +public class ObjectStoragePrototype extends GenericModel { + + protected String bucket; + @SerializedName("instance_crn") + protected String instanceCrn; + + /** + * Builder. + */ + public static class Builder { + private String bucket; + private String instanceCrn; + + /** + * Instantiates a new Builder from an existing ObjectStoragePrototype instance. + * + * @param objectStoragePrototype the instance to initialize the Builder with + */ + private Builder(ObjectStoragePrototype objectStoragePrototype) { + this.bucket = objectStoragePrototype.bucket; + this.instanceCrn = objectStoragePrototype.instanceCrn; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ObjectStoragePrototype. + * + * @return the new ObjectStoragePrototype instance + */ + public ObjectStoragePrototype build() { + return new ObjectStoragePrototype(this); + } + + /** + * Set the bucket. + * + * @param bucket the bucket + * @return the ObjectStoragePrototype builder + */ + public Builder bucket(String bucket) { + this.bucket = bucket; + return this; + } + + /** + * Set the instanceCrn. + * + * @param instanceCrn the instanceCrn + * @return the ObjectStoragePrototype builder + */ + public Builder instanceCrn(String instanceCrn) { + this.instanceCrn = instanceCrn; + return this; + } + } + + protected ObjectStoragePrototype() { } + + protected ObjectStoragePrototype(Builder builder) { + bucket = builder.bucket; + instanceCrn = builder.instanceCrn; + } + + /** + * New builder. + * + * @return a ObjectStoragePrototype builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the bucket. + * + * The connected Cloud Object Storage bucket name. + * + * @return the bucket + */ + public String bucket() { + return bucket; + } + + /** + * Gets the instanceCrn. + * + * The connected Cloud Object Storage instance CRN. + * + * @return the instanceCrn + */ + public String instanceCrn() { + return instanceCrn; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefFirst.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefFirst.java index 0b64dd19..6b28d6b5 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefFirst.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefFirst.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -26,7 +27,7 @@ protected PageHRefFirst() { } /** * Gets the href. * - * A URL for the first and next page. + * The URL for the first page. * * @return the href */ diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefNext.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefNext.java index e266cab3..6294e4f5 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefNext.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefNext.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -27,7 +28,7 @@ protected PageHRefNext() { } /** * Gets the href. * - * A URL for the first and next page. + * The URL for the next page. * * @return the href */ @@ -38,7 +39,7 @@ public String getHref() { /** * Gets the start. * - * The token of the next page when present. + * The token of the next page, when it's present. * * @return the start */ diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Parameter.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Parameter.java index 704daa3a..7dbd54ad 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Parameter.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Parameter.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,50 +10,40 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The rule import parameter. + * The details of a parameter used during an assessment. */ public class Parameter extends GenericModel { - /** - * The property type. - */ - public interface Type { - /** string. */ - String STRING = "string"; - /** numeric. */ - String NUMERIC = "numeric"; - /** general. */ - String GENERAL = "general"; - /** boolean. */ - String X_BOOLEAN = "boolean"; - /** string_list. */ - String STRING_LIST = "string_list"; - /** ip_list. */ - String IP_LIST = "ip_list"; - /** timestamp. */ - String TIMESTAMP = "timestamp"; - } - - protected String name; - @SerializedName("display_name") - protected String displayName; - protected String description; - protected String type; + @SerializedName("assessment_type") + protected String assessmentType; + @SerializedName("assessment_id") + protected String assessmentId; + @SerializedName("parameter_name") + protected String parameterName; + @SerializedName("parameter_display_name") + protected String parameterDisplayName; + @SerializedName("parameter_type") + protected String parameterType; + @SerializedName("parameter_value") + protected Object parameterValue; /** * Builder. */ public static class Builder { - private String name; - private String displayName; - private String description; - private String type; + private String assessmentType; + private String assessmentId; + private String parameterName; + private String parameterDisplayName; + private String parameterType; + private Object parameterValue; /** * Instantiates a new Builder from an existing Parameter instance. @@ -61,10 +51,12 @@ public static class Builder { * @param parameter the instance to initialize the Builder with */ private Builder(Parameter parameter) { - this.name = parameter.name; - this.displayName = parameter.displayName; - this.description = parameter.description; - this.type = parameter.type; + this.assessmentType = parameter.assessmentType; + this.assessmentId = parameter.assessmentId; + this.parameterName = parameter.parameterName; + this.parameterDisplayName = parameter.parameterDisplayName; + this.parameterType = parameter.parameterType; + this.parameterValue = parameter.parameterValue; } /** @@ -83,46 +75,68 @@ public Parameter build() { } /** - * Set the name. + * Set the assessmentType. + * + * @param assessmentType the assessmentType + * @return the Parameter builder + */ + public Builder assessmentType(String assessmentType) { + this.assessmentType = assessmentType; + return this; + } + + /** + * Set the assessmentId. * - * @param name the name + * @param assessmentId the assessmentId * @return the Parameter builder */ - public Builder name(String name) { - this.name = name; + public Builder assessmentId(String assessmentId) { + this.assessmentId = assessmentId; return this; } /** - * Set the displayName. + * Set the parameterName. * - * @param displayName the displayName + * @param parameterName the parameterName * @return the Parameter builder */ - public Builder displayName(String displayName) { - this.displayName = displayName; + public Builder parameterName(String parameterName) { + this.parameterName = parameterName; return this; } /** - * Set the description. + * Set the parameterDisplayName. * - * @param description the description + * @param parameterDisplayName the parameterDisplayName * @return the Parameter builder */ - public Builder description(String description) { - this.description = description; + public Builder parameterDisplayName(String parameterDisplayName) { + this.parameterDisplayName = parameterDisplayName; return this; } /** - * Set the type. + * Set the parameterType. * - * @param type the type + * @param parameterType the parameterType * @return the Parameter builder */ - public Builder type(String type) { - this.type = type; + public Builder parameterType(String parameterType) { + this.parameterType = parameterType; + return this; + } + + /** + * Set the parameterValue. + * + * @param parameterValue the parameterValue + * @return the Parameter builder + */ + public Builder parameterValue(Object parameterValue) { + this.parameterValue = parameterValue; return this; } } @@ -130,10 +144,12 @@ public Builder type(String type) { protected Parameter() { } protected Parameter(Builder builder) { - name = builder.name; - displayName = builder.displayName; - description = builder.description; - type = builder.type; + assessmentType = builder.assessmentType; + assessmentId = builder.assessmentId; + parameterName = builder.parameterName; + parameterDisplayName = builder.parameterDisplayName; + parameterType = builder.parameterType; + parameterValue = builder.parameterValue; } /** @@ -146,47 +162,69 @@ public Builder newBuilder() { } /** - * Gets the name. + * Gets the assessmentType. + * + * The type of evaluation. + * + * @return the assessmentType + */ + public String assessmentType() { + return assessmentType; + } + + /** + * Gets the assessmentId. + * + * The ID of the assessment. + * + * @return the assessmentId + */ + public String assessmentId() { + return assessmentId; + } + + /** + * Gets the parameterName. * - * The import parameter name. + * The parameter name. * - * @return the name + * @return the parameterName */ - public String name() { - return name; + public String parameterName() { + return parameterName; } /** - * Gets the displayName. + * Gets the parameterDisplayName. * - * The display name of the property. + * The parameter display name. * - * @return the displayName + * @return the parameterDisplayName */ - public String displayName() { - return displayName; + public String parameterDisplayName() { + return parameterDisplayName; } /** - * Gets the description. + * Gets the parameterType. * - * The propery description. + * The parameter type. * - * @return the description + * @return the parameterType */ - public String description() { - return description; + public String parameterType() { + return parameterType; } /** - * Gets the type. + * Gets the parameterValue. * - * The property type. + * The value can be of any type. * - * @return the type + * @return the parameterValue */ - public String type() { - return type; + public Object parameterValue() { + return parameterValue; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PostTestEventOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PostTestEventOptions.java index 5fce1973..94c9d97f 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PostTestEventOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PostTestEventOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,15 +20,13 @@ */ public class PostTestEventOptions extends GenericModel { - protected String xCorrelationId; - protected String xRequestId; + protected String instanceId; /** * Builder. */ public static class Builder { - private String xCorrelationId; - private String xRequestId; + private String instanceId; /** * Instantiates a new Builder from an existing PostTestEventOptions instance. @@ -35,8 +34,7 @@ public static class Builder { * @param postTestEventOptions the instance to initialize the Builder with */ private Builder(PostTestEventOptions postTestEventOptions) { - this.xCorrelationId = postTestEventOptions.xCorrelationId; - this.xRequestId = postTestEventOptions.xRequestId; + this.instanceId = postTestEventOptions.instanceId; } /** @@ -46,33 +44,31 @@ public Builder() { } /** - * Builds a PostTestEventOptions. + * Instantiates a new builder with required properties. * - * @return the new PostTestEventOptions instance + * @param instanceId the instanceId */ - public PostTestEventOptions build() { - return new PostTestEventOptions(this); + public Builder(String instanceId) { + this.instanceId = instanceId; } /** - * Set the xCorrelationId. + * Builds a PostTestEventOptions. * - * @param xCorrelationId the xCorrelationId - * @return the PostTestEventOptions builder + * @return the new PostTestEventOptions instance */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; + public PostTestEventOptions build() { + return new PostTestEventOptions(this); } /** - * Set the xRequestId. + * Set the instanceId. * - * @param xRequestId the xRequestId + * @param instanceId the instanceId * @return the PostTestEventOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } } @@ -80,8 +76,9 @@ public Builder xRequestId(String xRequestId) { protected PostTestEventOptions() { } protected PostTestEventOptions(Builder builder) { - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; } /** @@ -94,29 +91,14 @@ public Builder newBuilder() { } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request, and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the instanceId. * - * The supplied or generated value of this header is logged for a request, and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The ID of the Security and Compliance Center instance. * - * @return the xRequestId + * @return the instanceId */ - public String xRequestId() { - return xRequestId; + public String instanceId() { + return instanceId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Profile.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Profile.java index bd334ac9..90a84493 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Profile.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Profile.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,8 +10,10 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; import java.util.List; @@ -19,23 +21,27 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The response body of the profile. + * A group of controls that are related to a compliance objective. */ public class Profile extends GenericModel { /** - * The profile type, such as custom or predefined. + * The type of profile, either predefined or custom. */ public interface ProfileType { - /** predefined. */ - String PREDEFINED = "predefined"; /** custom. */ String CUSTOM = "custom"; + /** predefined. */ + String PREDEFINED = "predefined"; } protected String id; @SerializedName("profile_name") protected String profileName; + @SerializedName("instance_id") + protected String instanceId; + @SerializedName("hierarchy_enabled") + protected Boolean hierarchyEnabled; @SerializedName("profile_description") protected String profileDescription; @SerializedName("profile_type") @@ -44,11 +50,7 @@ public interface ProfileType { protected String profileVersion; @SerializedName("version_group_label") protected String versionGroupLabel; - @SerializedName("instance_id") - protected String instanceId; protected Boolean latest; - @SerializedName("hierarchy_enabled") - protected Boolean hierarchyEnabled; @SerializedName("created_by") protected String createdBy; @SerializedName("created_on") @@ -59,200 +61,519 @@ public interface ProfileType { protected Date updatedOn; @SerializedName("controls_count") protected Long controlsCount; - @SerializedName("control_parents_count") - protected Long controlParentsCount; @SerializedName("attachments_count") protected Long attachmentsCount; protected List controls; @SerializedName("default_parameters") - protected List defaultParameters; + protected List defaultParameters; + + /** + * Builder. + */ + public static class Builder { + private String id; + private String profileName; + private String instanceId; + private Boolean hierarchyEnabled; + private String profileDescription; + private String profileType; + private String profileVersion; + private String versionGroupLabel; + private Boolean latest; + private String createdBy; + private Date createdOn; + private String updatedBy; + private Date updatedOn; + private Long controlsCount; + private Long attachmentsCount; + private List controls; + private List defaultParameters; + + /** + * Instantiates a new Builder from an existing Profile instance. + * + * @param profile the instance to initialize the Builder with + */ + private Builder(Profile profile) { + this.id = profile.id; + this.profileName = profile.profileName; + this.instanceId = profile.instanceId; + this.hierarchyEnabled = profile.hierarchyEnabled; + this.profileDescription = profile.profileDescription; + this.profileType = profile.profileType; + this.profileVersion = profile.profileVersion; + this.versionGroupLabel = profile.versionGroupLabel; + this.latest = profile.latest; + this.createdBy = profile.createdBy; + this.createdOn = profile.createdOn; + this.updatedBy = profile.updatedBy; + this.updatedOn = profile.updatedOn; + this.controlsCount = profile.controlsCount; + this.attachmentsCount = profile.attachmentsCount; + this.controls = profile.controls; + this.defaultParameters = profile.defaultParameters; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param profileType the profileType + * @param controls the controls + * @param defaultParameters the defaultParameters + */ + public Builder(String profileType, List controls, List defaultParameters) { + this.profileType = profileType; + this.controls = controls; + this.defaultParameters = defaultParameters; + } + + /** + * Builds a Profile. + * + * @return the new Profile instance + */ + public Profile build() { + return new Profile(this); + } + + /** + * Adds a new element to controls. + * + * @param controls the new element to be added + * @return the Profile builder + */ + public Builder addControls(ProfileControls controls) { + com.ibm.cloud.sdk.core.util.Validator.notNull(controls, + "controls cannot be null"); + if (this.controls == null) { + this.controls = new ArrayList(); + } + this.controls.add(controls); + return this; + } + + /** + * Adds a new element to defaultParameters. + * + * @param defaultParameters the new element to be added + * @return the Profile builder + */ + public Builder addDefaultParameters(DefaultParameters defaultParameters) { + com.ibm.cloud.sdk.core.util.Validator.notNull(defaultParameters, + "defaultParameters cannot be null"); + if (this.defaultParameters == null) { + this.defaultParameters = new ArrayList(); + } + this.defaultParameters.add(defaultParameters); + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the Profile builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the profileName. + * + * @param profileName the profileName + * @return the Profile builder + */ + public Builder profileName(String profileName) { + this.profileName = profileName; + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the Profile builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the hierarchyEnabled. + * + * @param hierarchyEnabled the hierarchyEnabled + * @return the Profile builder + */ + public Builder hierarchyEnabled(Boolean hierarchyEnabled) { + this.hierarchyEnabled = hierarchyEnabled; + return this; + } + + /** + * Set the profileDescription. + * + * @param profileDescription the profileDescription + * @return the Profile builder + */ + public Builder profileDescription(String profileDescription) { + this.profileDescription = profileDescription; + return this; + } + + /** + * Set the profileType. + * + * @param profileType the profileType + * @return the Profile builder + */ + public Builder profileType(String profileType) { + this.profileType = profileType; + return this; + } + + /** + * Set the profileVersion. + * + * @param profileVersion the profileVersion + * @return the Profile builder + */ + public Builder profileVersion(String profileVersion) { + this.profileVersion = profileVersion; + return this; + } + + /** + * Set the versionGroupLabel. + * + * @param versionGroupLabel the versionGroupLabel + * @return the Profile builder + */ + public Builder versionGroupLabel(String versionGroupLabel) { + this.versionGroupLabel = versionGroupLabel; + return this; + } + + /** + * Set the latest. + * + * @param latest the latest + * @return the Profile builder + */ + public Builder latest(Boolean latest) { + this.latest = latest; + return this; + } + + /** + * Set the createdBy. + * + * @param createdBy the createdBy + * @return the Profile builder + */ + public Builder createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * Set the createdOn. + * + * @param createdOn the createdOn + * @return the Profile builder + */ + public Builder createdOn(Date createdOn) { + this.createdOn = createdOn; + return this; + } + + /** + * Set the updatedBy. + * + * @param updatedBy the updatedBy + * @return the Profile builder + */ + public Builder updatedBy(String updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * Set the updatedOn. + * + * @param updatedOn the updatedOn + * @return the Profile builder + */ + public Builder updatedOn(Date updatedOn) { + this.updatedOn = updatedOn; + return this; + } + + /** + * Set the controlsCount. + * + * @param controlsCount the controlsCount + * @return the Profile builder + */ + public Builder controlsCount(long controlsCount) { + this.controlsCount = controlsCount; + return this; + } + + /** + * Set the attachmentsCount. + * + * @param attachmentsCount the attachmentsCount + * @return the Profile builder + */ + public Builder attachmentsCount(long attachmentsCount) { + this.attachmentsCount = attachmentsCount; + return this; + } + + /** + * Set the controls. + * Existing controls will be replaced. + * + * @param controls the controls + * @return the Profile builder + */ + public Builder controls(List controls) { + this.controls = controls; + return this; + } + + /** + * Set the defaultParameters. + * Existing defaultParameters will be replaced. + * + * @param defaultParameters the defaultParameters + * @return the Profile builder + */ + public Builder defaultParameters(List defaultParameters) { + this.defaultParameters = defaultParameters; + return this; + } + } protected Profile() { } + protected Profile(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.profileType, + "profileType cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controls, + "controls cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.defaultParameters, + "defaultParameters cannot be null"); + id = builder.id; + profileName = builder.profileName; + instanceId = builder.instanceId; + hierarchyEnabled = builder.hierarchyEnabled; + profileDescription = builder.profileDescription; + profileType = builder.profileType; + profileVersion = builder.profileVersion; + versionGroupLabel = builder.versionGroupLabel; + latest = builder.latest; + createdBy = builder.createdBy; + createdOn = builder.createdOn; + updatedBy = builder.updatedBy; + updatedOn = builder.updatedOn; + controlsCount = builder.controlsCount; + attachmentsCount = builder.attachmentsCount; + controls = builder.controls; + defaultParameters = builder.defaultParameters; + } + + /** + * New builder. + * + * @return a Profile builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the id. * - * The unique ID of the profile. + * The ID of the profile. * * @return the id */ - public String getId() { + public String id() { return id; } /** * Gets the profileName. * - * The profile name. + * The name of the profile. * * @return the profileName */ - public String getProfileName() { + public String profileName() { return profileName; } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance who owns the profile. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the hierarchyEnabled. + * + * Determines if the profile can be set to a hierarchy. + * + * @return the hierarchyEnabled + */ + public Boolean hierarchyEnabled() { + return hierarchyEnabled; + } + /** * Gets the profileDescription. * - * The profile description. + * A description of what the profile should represent. * * @return the profileDescription */ - public String getProfileDescription() { + public String profileDescription() { return profileDescription; } /** * Gets the profileType. * - * The profile type, such as custom or predefined. + * The type of profile, either predefined or custom. * * @return the profileType */ - public String getProfileType() { + public String profileType() { return profileType; } /** * Gets the profileVersion. * - * The version status of the profile. + * The version of the profile. * * @return the profileVersion */ - public String getProfileVersion() { + public String profileVersion() { return profileVersion; } /** * Gets the versionGroupLabel. * - * The version group label of the profile. + * The unique identifier of the revision. * * @return the versionGroupLabel */ - public String getVersionGroupLabel() { + public String versionGroupLabel() { return versionGroupLabel; } - /** - * Gets the instanceId. - * - * The instance ID. - * - * @return the instanceId - */ - public String getInstanceId() { - return instanceId; - } - /** * Gets the latest. * - * The latest version of the profile. + * Determines if the profile is up to date with the latest revisions. * * @return the latest */ - public Boolean isLatest() { + public Boolean latest() { return latest; } - /** - * Gets the hierarchyEnabled. - * - * The indication of whether hierarchy is enabled for the profile. - * - * @return the hierarchyEnabled - */ - public Boolean isHierarchyEnabled() { - return hierarchyEnabled; - } - /** * Gets the createdBy. * - * The user who created the profile. + * User who created the profile. * * @return the createdBy */ - public String getCreatedBy() { + public String createdBy() { return createdBy; } /** * Gets the createdOn. * - * The date when the profile was created. + * The date when the profile was created, in date-time format. * * @return the createdOn */ - public Date getCreatedOn() { + public Date createdOn() { return createdOn; } /** * Gets the updatedBy. * - * The user who updated the profile. + * User who made the latest changes to the profile. * * @return the updatedBy */ - public String getUpdatedBy() { + public String updatedBy() { return updatedBy; } /** * Gets the updatedOn. * - * The date when the profile was updated. + * The date when the profile was last updated, in date-time format. * * @return the updatedOn */ - public Date getUpdatedOn() { + public Date updatedOn() { return updatedOn; } /** * Gets the controlsCount. * - * The number of controls for the profile. + * The number of controls contained in the profile. * * @return the controlsCount */ - public Long getControlsCount() { + public Long controlsCount() { return controlsCount; } - /** - * Gets the controlParentsCount. - * - * The number of parent controls for the profile. - * - * @return the controlParentsCount - */ - public Long getControlParentsCount() { - return controlParentsCount; - } - /** * Gets the attachmentsCount. * - * The number of attachments related to this profile. + * The number of attachments associated with the profile. * * @return the attachmentsCount */ - public Long getAttachmentsCount() { + public Long attachmentsCount() { return attachmentsCount; } /** * Gets the controls. * - * The array of controls that are used to create the profile. + * The list of controls. * * @return the controls */ - public List getControls() { + public List controls() { return controls; } @@ -263,7 +584,7 @@ public List getControls() { * * @return the defaultParameters */ - public List getDefaultParameters() { + public List defaultParameters() { return defaultParameters; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachment.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachment.java new file mode 100644 index 00000000..b8bb20c2 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachment.java @@ -0,0 +1,279 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The configuration set when starting a scan against a profile. + */ +public class ProfileAttachment extends GenericModel { + + /** + * Details how often a scan from a profile attachment is ran. + */ + public interface Schedule { + /** daily. */ + String DAILY = "daily"; + /** every_7_days. */ + String EVERY_7_DAYS = "every_7_days"; + /** every_30_days. */ + String EVERY_30_DAYS = "every_30_days"; + } + + /** + * Details the state of a profile attachment. + */ + public interface Status { + /** enabled. */ + String ENABLED = "enabled"; + /** disabled. */ + String DISABLED = "disabled"; + } + + @SerializedName("attachment_parameters") + protected List attachmentParameters; + protected String description; + protected String name; + protected AttachmentNotifications notifications; + protected String schedule; + protected List scope; + protected String status; + @SerializedName("data_selection_range") + protected DateRange dataSelectionRange; + @SerializedName("account_id") + protected String accountId; + @SerializedName("created_by") + protected String createdBy; + @SerializedName("created_on") + protected Date createdOn; + protected String id; + @SerializedName("instance_id") + protected String instanceId; + @SerializedName("last_scan") + protected LastScan lastScan; + @SerializedName("next_scan_time") + protected Date nextScanTime; + @SerializedName("profile_id") + protected String profileId; + @SerializedName("updated_by") + protected String updatedBy; + @SerializedName("updated_on") + protected Date updatedOn; + + protected ProfileAttachment() { } + + /** + * Gets the attachmentParameters. + * + * The parameters associated with the profile attachment. + * + * @return the attachmentParameters + */ + public List getAttachmentParameters() { + return attachmentParameters; + } + + /** + * Gets the description. + * + * The details to describe the profile attachment. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the name. + * + * The name of the Profile Attachment. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the notifications. + * + * The notification configuration of the attachment. + * + * @return the notifications + */ + public AttachmentNotifications getNotifications() { + return notifications; + } + + /** + * Gets the schedule. + * + * Details how often a scan from a profile attachment is ran. + * + * @return the schedule + */ + public String getSchedule() { + return schedule; + } + + /** + * Gets the scope. + * + * A list of scopes associated with a profile attachment. + * + * @return the scope + */ + public List getScope() { + return scope; + } + + /** + * Gets the status. + * + * Details the state of a profile attachment. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the dataSelectionRange. + * + * Date range. + * + * @return the dataSelectionRange + */ + public DateRange getDataSelectionRange() { + return dataSelectionRange; + } + + /** + * Gets the accountId. + * + * The ID of the account. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the createdBy. + * + * User who created the profile attachment. + * + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * Gets the createdOn. + * + * The date-time that the profile attachment was created. + * + * @return the createdOn + */ + public Date getCreatedOn() { + return createdOn; + } + + /** + * Gets the id. + * + * The ID of the profile attachment. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the instanceId. + * + * The ID of the associated Security and Compliance Center instance. + * + * @return the instanceId + */ + public String getInstanceId() { + return instanceId; + } + + /** + * Gets the lastScan. + * + * The last scan performed on a profile attachment. + * + * @return the lastScan + */ + public LastScan getLastScan() { + return lastScan; + } + + /** + * Gets the nextScanTime. + * + * The date-time for next scan. + * + * @return the nextScanTime + */ + public Date getNextScanTime() { + return nextScanTime; + } + + /** + * Gets the profileId. + * + * The ID of the profile. + * + * @return the profileId + */ + public String getProfileId() { + return profileId; + } + + /** + * Gets the updatedBy. + * + * User who made the latest changes to the profile attachment. + * + * @return the updatedBy + */ + public String getUpdatedBy() { + return updatedBy; + } + + /** + * Gets the updatedOn. + * + * The date when the profile was last updated, in date-time format. + * + * @return the updatedOn + */ + public Date getUpdatedOn() { + return updatedOn; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentBase.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentBase.java new file mode 100644 index 00000000..c3401031 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentBase.java @@ -0,0 +1,372 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 prototype for creating a Profile attachment. + */ +public class ProfileAttachmentBase extends GenericModel { + + /** + * Details how often a scan from a profile attachment is ran. + */ + public interface Schedule { + /** daily. */ + String DAILY = "daily"; + /** every_7_days. */ + String EVERY_7_DAYS = "every_7_days"; + /** every_30_days. */ + String EVERY_30_DAYS = "every_30_days"; + } + + /** + * Details the state of a profile attachment. + */ + public interface Status { + /** enabled. */ + String ENABLED = "enabled"; + /** disabled. */ + String DISABLED = "disabled"; + } + + @SerializedName("attachment_parameters") + protected List attachmentParameters; + protected String description; + protected String name; + protected AttachmentNotifications notifications; + protected String schedule; + protected List scope; + protected String status; + @SerializedName("data_selection_range") + protected DateRange dataSelectionRange; + + /** + * Builder. + */ + public static class Builder { + private List attachmentParameters; + private String description; + private String name; + private AttachmentNotifications notifications; + private String schedule; + private List scope; + private String status; + private DateRange dataSelectionRange; + + /** + * Instantiates a new Builder from an existing ProfileAttachmentBase instance. + * + * @param profileAttachmentBase the instance to initialize the Builder with + */ + private Builder(ProfileAttachmentBase profileAttachmentBase) { + this.attachmentParameters = profileAttachmentBase.attachmentParameters; + this.description = profileAttachmentBase.description; + this.name = profileAttachmentBase.name; + this.notifications = profileAttachmentBase.notifications; + this.schedule = profileAttachmentBase.schedule; + this.scope = profileAttachmentBase.scope; + this.status = profileAttachmentBase.status; + this.dataSelectionRange = profileAttachmentBase.dataSelectionRange; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param attachmentParameters the attachmentParameters + * @param description the description + * @param name the name + * @param notifications the notifications + * @param schedule the schedule + * @param scope the scope + * @param status the status + */ + public Builder(List attachmentParameters, String description, String name, AttachmentNotifications notifications, String schedule, List scope, String status) { + this.attachmentParameters = attachmentParameters; + this.description = description; + this.name = name; + this.notifications = notifications; + this.schedule = schedule; + this.scope = scope; + this.status = status; + } + + /** + * Builds a ProfileAttachmentBase. + * + * @return the new ProfileAttachmentBase instance + */ + public ProfileAttachmentBase build() { + return new ProfileAttachmentBase(this); + } + + /** + * Adds a new element to attachmentParameters. + * + * @param attachmentParameters the new element to be added + * @return the ProfileAttachmentBase builder + */ + public Builder addAttachmentParameters(Parameter attachmentParameters) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attachmentParameters, + "attachmentParameters cannot be null"); + if (this.attachmentParameters == null) { + this.attachmentParameters = new ArrayList(); + } + this.attachmentParameters.add(attachmentParameters); + return this; + } + + /** + * Adds a new element to scope. + * + * @param scope the new element to be added + * @return the ProfileAttachmentBase builder + */ + public Builder addScope(MultiCloudScopePayload scope) { + com.ibm.cloud.sdk.core.util.Validator.notNull(scope, + "scope cannot be null"); + if (this.scope == null) { + this.scope = new ArrayList(); + } + this.scope.add(scope); + return this; + } + + /** + * Set the attachmentParameters. + * Existing attachmentParameters will be replaced. + * + * @param attachmentParameters the attachmentParameters + * @return the ProfileAttachmentBase builder + */ + public Builder attachmentParameters(List attachmentParameters) { + this.attachmentParameters = attachmentParameters; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ProfileAttachmentBase builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ProfileAttachmentBase builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the notifications. + * + * @param notifications the notifications + * @return the ProfileAttachmentBase builder + */ + public Builder notifications(AttachmentNotifications notifications) { + this.notifications = notifications; + return this; + } + + /** + * Set the schedule. + * + * @param schedule the schedule + * @return the ProfileAttachmentBase builder + */ + public Builder schedule(String schedule) { + this.schedule = schedule; + return this; + } + + /** + * Set the scope. + * Existing scope will be replaced. + * + * @param scope the scope + * @return the ProfileAttachmentBase builder + */ + public Builder scope(List scope) { + this.scope = scope; + return this; + } + + /** + * Set the status. + * + * @param status the status + * @return the ProfileAttachmentBase builder + */ + public Builder status(String status) { + this.status = status; + return this; + } + + /** + * Set the dataSelectionRange. + * + * @param dataSelectionRange the dataSelectionRange + * @return the ProfileAttachmentBase builder + */ + public Builder dataSelectionRange(DateRange dataSelectionRange) { + this.dataSelectionRange = dataSelectionRange; + return this; + } + } + + protected ProfileAttachmentBase() { } + + protected ProfileAttachmentBase(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attachmentParameters, + "attachmentParameters cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.description, + "description cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.notifications, + "notifications cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.schedule, + "schedule cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.scope, + "scope cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.status, + "status cannot be null"); + attachmentParameters = builder.attachmentParameters; + description = builder.description; + name = builder.name; + notifications = builder.notifications; + schedule = builder.schedule; + scope = builder.scope; + status = builder.status; + dataSelectionRange = builder.dataSelectionRange; + } + + /** + * New builder. + * + * @return a ProfileAttachmentBase builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the attachmentParameters. + * + * The parameters associated with the profile attachment. + * + * @return the attachmentParameters + */ + public List attachmentParameters() { + return attachmentParameters; + } + + /** + * Gets the description. + * + * The details to describe the profile attachment. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the name. + * + * The name of the Profile Attachment. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the notifications. + * + * The notification configuration of the attachment. + * + * @return the notifications + */ + public AttachmentNotifications notifications() { + return notifications; + } + + /** + * Gets the schedule. + * + * Details how often a scan from a profile attachment is ran. + * + * @return the schedule + */ + public String schedule() { + return schedule; + } + + /** + * Gets the scope. + * + * A list of scopes associated with a profile attachment. + * + * @return the scope + */ + public List scope() { + return scope; + } + + /** + * Gets the status. + * + * Details the state of a profile attachment. + * + * @return the status + */ + public String status() { + return status; + } + + /** + * Gets the dataSelectionRange. + * + * Date range. + * + * @return the dataSelectionRange + */ + public DateRange dataSelectionRange() { + return dataSelectionRange; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentCollection.java new file mode 100644 index 00000000..19dfa420 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentCollection.java @@ -0,0 +1,90 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A list of ProfileAttachment tied to a profile or instance. + */ +public class ProfileAttachmentCollection extends GenericModel { + + protected Long limit; + @SerializedName("total_count") + protected Long totalCount; + protected PageHRefFirst first; + protected PageHRefNext next; + protected List attachments; + + protected ProfileAttachmentCollection() { } + + /** + * Gets the limit. + * + * The requested page limit. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the totalCount. + * + * The total number of resources that are in the collection. + * + * @return the totalCount + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Gets the first. + * + * A page reference. + * + * @return the first + */ + public PageHRefFirst getFirst() { + return first; + } + + /** + * Gets the next. + * + * A page reference. + * + * @return the next + */ + public PageHRefNext getNext() { + return next; + } + + /** + * Gets the attachments. + * + * List of attachments. + * + * @return the attachments + */ + public List getAttachments() { + return attachments; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentResponse.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentResponse.java new file mode 100644 index 00000000..d5e2131c --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentResponse.java @@ -0,0 +1,54 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * ProfileAttachmentResponse. + */ +public class ProfileAttachmentResponse extends GenericModel { + + @SerializedName("profile_id") + protected String profileId; + protected List attachments; + + protected ProfileAttachmentResponse() { } + + /** + * Gets the profileId. + * + * The ID of the profile. + * + * @return the profileId + */ + public String getProfileId() { + return profileId; + } + + /** + * Gets the attachments. + * + * List of profile attachments associated with profile. + * + * @return the attachments + */ + public List getAttachments() { + return attachments; + } +} + 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 60203c0b..f4ffe89d 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -18,71 +19,71 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The response body to list all profiles that are linked to your account. + * A list of Profiles. */ public class ProfileCollection extends GenericModel { + protected Long limit; @SerializedName("total_count") protected Long totalCount; - protected Long limit; - protected PaginatedCollectionFirst first; - protected PaginatedCollectionNext next; - protected List profiles; + protected PageHRefFirst first; + protected PageHRefNext next; + protected List profiles; protected ProfileCollection() { } /** - * Gets the totalCount. + * Gets the limit. * - * The number of profiles. + * The requested page limit. * - * @return the totalCount + * @return the limit */ - public Long getTotalCount() { - return totalCount; + public Long getLimit() { + return limit; } /** - * Gets the limit. + * Gets the totalCount. * - * The limit of profiles that can be created. + * The total number of resources that are in the collection. * - * @return the limit + * @return the totalCount */ - public Long getLimit() { - return limit; + public Long getTotalCount() { + return totalCount; } /** * Gets the first. * - * The reference to the first page of entries. + * A page reference. * * @return the first */ - public PaginatedCollectionFirst getFirst() { + public PageHRefFirst getFirst() { return first; } /** * Gets the next. * - * The reference URL for the next few entries. + * A page reference. * * @return the next */ - public PaginatedCollectionNext getNext() { + public PageHRefNext getNext() { return next; } /** * Gets the profiles. * - * The profiles. + * A list of profiles associated with the scope. * * @return the profiles */ - public List getProfiles() { + public List getProfiles() { return profiles; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControls.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControls.java index 85bce82d..99365df1 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControls.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControls.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,18 +10,22 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 control details for the profile. + * The control details for a profile. */ public class ProfileControls extends GenericModel { + @SerializedName("control_requirement") + protected Boolean controlRequirement; @SerializedName("control_library_id") protected String controlLibraryId; @SerializedName("control_id") @@ -32,51 +36,283 @@ public class ProfileControls extends GenericModel { protected String controlName; @SerializedName("control_description") protected String controlDescription; + @SerializedName("control_severity") + protected String controlSeverity; @SerializedName("control_category") protected String controlCategory; @SerializedName("control_parent") protected String controlParent; - @SerializedName("control_requirement") - protected Boolean controlRequirement; @SerializedName("control_docs") - protected ControlDocs controlDocs; - @SerializedName("control_specifications_count") - protected Long controlSpecificationsCount; + protected ControlDoc controlDocs; @SerializedName("control_specifications") - protected List controlSpecifications; + protected List controlSpecifications; + + /** + * Builder. + */ + public static class Builder { + private Boolean controlRequirement; + private String controlLibraryId; + private String controlId; + private String controlLibraryVersion; + private String controlName; + private String controlDescription; + private String controlSeverity; + private String controlCategory; + private String controlParent; + private ControlDoc controlDocs; + private List controlSpecifications; + + /** + * Instantiates a new Builder from an existing ProfileControls instance. + * + * @param profileControls the instance to initialize the Builder with + */ + private Builder(ProfileControls profileControls) { + this.controlRequirement = profileControls.controlRequirement; + this.controlLibraryId = profileControls.controlLibraryId; + this.controlId = profileControls.controlId; + this.controlLibraryVersion = profileControls.controlLibraryVersion; + this.controlName = profileControls.controlName; + this.controlDescription = profileControls.controlDescription; + this.controlSeverity = profileControls.controlSeverity; + this.controlCategory = profileControls.controlCategory; + this.controlParent = profileControls.controlParent; + this.controlDocs = profileControls.controlDocs; + this.controlSpecifications = profileControls.controlSpecifications; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param controlSpecifications the controlSpecifications + */ + public Builder(List controlSpecifications) { + this.controlSpecifications = controlSpecifications; + } + + /** + * Builds a ProfileControls. + * + * @return the new ProfileControls instance + */ + public ProfileControls build() { + return new ProfileControls(this); + } + + /** + * Adds a new element to controlSpecifications. + * + * @param controlSpecifications the new element to be added + * @return the ProfileControls builder + */ + public Builder addControlSpecifications(ControlSpecification controlSpecifications) { + com.ibm.cloud.sdk.core.util.Validator.notNull(controlSpecifications, + "controlSpecifications cannot be null"); + if (this.controlSpecifications == null) { + this.controlSpecifications = new ArrayList(); + } + this.controlSpecifications.add(controlSpecifications); + return this; + } + + /** + * Set the controlRequirement. + * + * @param controlRequirement the controlRequirement + * @return the ProfileControls builder + */ + public Builder controlRequirement(Boolean controlRequirement) { + this.controlRequirement = controlRequirement; + return this; + } + + /** + * Set the controlLibraryId. + * + * @param controlLibraryId the controlLibraryId + * @return the ProfileControls builder + */ + public Builder controlLibraryId(String controlLibraryId) { + this.controlLibraryId = controlLibraryId; + return this; + } + + /** + * Set the controlId. + * + * @param controlId the controlId + * @return the ProfileControls builder + */ + public Builder controlId(String controlId) { + this.controlId = controlId; + return this; + } + + /** + * Set the controlLibraryVersion. + * + * @param controlLibraryVersion the controlLibraryVersion + * @return the ProfileControls builder + */ + public Builder controlLibraryVersion(String controlLibraryVersion) { + this.controlLibraryVersion = controlLibraryVersion; + return this; + } + + /** + * Set the controlName. + * + * @param controlName the controlName + * @return the ProfileControls builder + */ + public Builder controlName(String controlName) { + this.controlName = controlName; + return this; + } + + /** + * Set the controlDescription. + * + * @param controlDescription the controlDescription + * @return the ProfileControls builder + */ + public Builder controlDescription(String controlDescription) { + this.controlDescription = controlDescription; + return this; + } + + /** + * Set the controlSeverity. + * + * @param controlSeverity the controlSeverity + * @return the ProfileControls builder + */ + public Builder controlSeverity(String controlSeverity) { + this.controlSeverity = controlSeverity; + return this; + } + + /** + * Set the controlCategory. + * + * @param controlCategory the controlCategory + * @return the ProfileControls builder + */ + public Builder controlCategory(String controlCategory) { + this.controlCategory = controlCategory; + return this; + } + + /** + * Set the controlParent. + * + * @param controlParent the controlParent + * @return the ProfileControls builder + */ + public Builder controlParent(String controlParent) { + this.controlParent = controlParent; + return this; + } + + /** + * Set the controlDocs. + * + * @param controlDocs the controlDocs + * @return the ProfileControls builder + */ + public Builder controlDocs(ControlDoc controlDocs) { + this.controlDocs = controlDocs; + return this; + } + + /** + * Set the controlSpecifications. + * Existing controlSpecifications will be replaced. + * + * @param controlSpecifications the controlSpecifications + * @return the ProfileControls builder + */ + public Builder controlSpecifications(List controlSpecifications) { + this.controlSpecifications = controlSpecifications; + return this; + } + } protected ProfileControls() { } + protected ProfileControls(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlSpecifications, + "controlSpecifications cannot be null"); + controlRequirement = builder.controlRequirement; + controlLibraryId = builder.controlLibraryId; + controlId = builder.controlId; + controlLibraryVersion = builder.controlLibraryVersion; + controlName = builder.controlName; + controlDescription = builder.controlDescription; + controlSeverity = builder.controlSeverity; + controlCategory = builder.controlCategory; + controlParent = builder.controlParent; + controlDocs = builder.controlDocs; + controlSpecifications = builder.controlSpecifications; + } + + /** + * New builder. + * + * @return a ProfileControls builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the controlRequirement. + * + * Determines if the control needs to pass during evaluation. + * + * @return the controlRequirement + */ + public Boolean controlRequirement() { + return controlRequirement; + } + /** * Gets the controlLibraryId. * - * The ID of the control library that contains the profile. + * The ID of the control library that contains a profile. * * @return the controlLibraryId */ - public String getControlLibraryId() { + public String controlLibraryId() { return controlLibraryId; } /** * Gets the controlId. * - * The unique ID of the control library that contains the profile. + * The control ID. * * @return the controlId */ - public String getControlId() { + public String controlId() { return controlId; } /** * Gets the controlLibraryVersion. * - * The most recent version of the control library. + * The control library version. * * @return the controlLibraryVersion */ - public String getControlLibraryVersion() { + public String controlLibraryVersion() { return controlLibraryVersion; } @@ -87,7 +323,7 @@ public String getControlLibraryVersion() { * * @return the controlName */ - public String getControlName() { + public String controlName() { return controlName; } @@ -98,10 +334,21 @@ public String getControlName() { * * @return the controlDescription */ - public String getControlDescription() { + public String controlDescription() { return controlDescription; } + /** + * Gets the controlSeverity. + * + * The control severity. + * + * @return the controlSeverity + */ + public String controlSeverity() { + return controlSeverity; + } + /** * Gets the controlCategory. * @@ -109,62 +356,40 @@ public String getControlDescription() { * * @return the controlCategory */ - public String getControlCategory() { + public String controlCategory() { return controlCategory; } /** * Gets the controlParent. * - * The parent control. + * The control parent. * * @return the controlParent */ - public String getControlParent() { + public String controlParent() { return controlParent; } - /** - * Gets the controlRequirement. - * - * Is this a control that can be automated or manually evaluated. - * - * @return the controlRequirement - */ - public Boolean isControlRequirement() { - return controlRequirement; - } - /** * Gets the controlDocs. * - * The control documentation. + * References to a control documentation. * * @return the controlDocs */ - public ControlDocs getControlDocs() { + public ControlDoc controlDocs() { return controlDocs; } - /** - * Gets the controlSpecificationsCount. - * - * The number of control specifications. - * - * @return the controlSpecificationsCount - */ - public Long getControlSpecificationsCount() { - return controlSpecificationsCount; - } - /** * Gets the controlSpecifications. * - * The control specifications. + * List of control specifications in a profile. * * @return the controlSpecifications */ - public List getControlSpecifications() { + public List controlSpecifications() { return controlSpecifications; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsPrototype.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsPrototype.java index 45fe8360..eaef9721 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsPrototype.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsPrototype.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileDefaultParametersResponse.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileDefaultParametersResponse.java new file mode 100644 index 00000000..3109d0a8 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileDefaultParametersResponse.java @@ -0,0 +1,152 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 default parameters of a profile. + */ +public class ProfileDefaultParametersResponse extends GenericModel { + + protected String id; + @SerializedName("default_parameters") + protected List defaultParameters; + + /** + * Builder. + */ + public static class Builder { + private String id; + private List defaultParameters; + + /** + * Instantiates a new Builder from an existing ProfileDefaultParametersResponse instance. + * + * @param profileDefaultParametersResponse the instance to initialize the Builder with + */ + private Builder(ProfileDefaultParametersResponse profileDefaultParametersResponse) { + this.id = profileDefaultParametersResponse.id; + this.defaultParameters = profileDefaultParametersResponse.defaultParameters; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param defaultParameters the defaultParameters + */ + public Builder(List defaultParameters) { + this.defaultParameters = defaultParameters; + } + + /** + * Builds a ProfileDefaultParametersResponse. + * + * @return the new ProfileDefaultParametersResponse instance + */ + public ProfileDefaultParametersResponse build() { + return new ProfileDefaultParametersResponse(this); + } + + /** + * Adds a new element to defaultParameters. + * + * @param defaultParameters the new element to be added + * @return the ProfileDefaultParametersResponse builder + */ + public Builder addDefaultParameters(DefaultParameters defaultParameters) { + com.ibm.cloud.sdk.core.util.Validator.notNull(defaultParameters, + "defaultParameters cannot be null"); + if (this.defaultParameters == null) { + this.defaultParameters = new ArrayList(); + } + this.defaultParameters.add(defaultParameters); + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the ProfileDefaultParametersResponse builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the defaultParameters. + * Existing defaultParameters will be replaced. + * + * @param defaultParameters the defaultParameters + * @return the ProfileDefaultParametersResponse builder + */ + public Builder defaultParameters(List defaultParameters) { + this.defaultParameters = defaultParameters; + return this; + } + } + + protected ProfileDefaultParametersResponse() { } + + protected ProfileDefaultParametersResponse(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.defaultParameters, + "defaultParameters cannot be null"); + id = builder.id; + defaultParameters = builder.defaultParameters; + } + + /** + * New builder. + * + * @return a ProfileDefaultParametersResponse builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the id. + * + * The ID of the Profile. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the defaultParameters. + * + * list of parameters given by default. + * + * @return the defaultParameters + */ + public List defaultParameters() { + return defaultParameters; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileInfo.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileInfo.java index cb348fe8..189a1b80 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileInfo.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileInfo.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfilesPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfilesPager.java index e8764d61..7f9f10a0 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfilesPager.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfilesPager.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; @@ -65,9 +66,9 @@ public boolean hasNext() { /** * Returns the next page of results. - * @return a List<ProfileItem> that contains the next page of results + * @return a List<Profile> that contains the next page of results */ - public List getNext() { + public List getNext() { if (!hasNext()) { throw new NoSuchElementException("No more results available"); } @@ -94,12 +95,12 @@ public List getNext() { /** * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<ProfileItem> containing all results returned by the "listProfiles" method + * @return a List<Profile> containing all results returned by the "listProfiles" method */ - public List getAll() { - List results = new ArrayList<>(); + public List getAll() { + List results = new ArrayList<>(); while (hasNext()) { - List nextPage = getNext(); + List nextPage = getNext(); results.addAll(nextPage); } return results; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderType.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderType.java new file mode 100644 index 00000000..a1172434 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderType.java @@ -0,0 +1,195 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The provider type item. + */ +public class ProviderType extends GenericModel { + + protected String id; + protected String type; + protected String name; + protected String description; + @SerializedName("s2s_enabled") + protected Boolean s2sEnabled; + @SerializedName("instance_limit") + protected Long instanceLimit; + protected String mode; + @SerializedName("data_type") + protected String dataType; + protected String icon; + protected LabelType label; + protected Map attributes; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("updated_at") + protected Date updatedAt; + + protected ProviderType() { } + + /** + * Gets the id. + * + * The unique identifier of the provider type. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The type of the provider type. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the name. + * + * The name of the provider type. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * The provider type description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the s2sEnabled. + * + * A boolean that indicates whether the provider type is s2s-enabled. + * + * @return the s2sEnabled + */ + public Boolean isS2sEnabled() { + return s2sEnabled; + } + + /** + * Gets the instanceLimit. + * + * The maximum number of instances that can be created for the provider type. + * + * @return the instanceLimit + */ + public Long getInstanceLimit() { + return instanceLimit; + } + + /** + * Gets the mode. + * + * The mode that is used to get results from provider (`PUSH` or `PULL`). + * + * @return the mode + */ + public String getMode() { + return mode; + } + + /** + * Gets the dataType. + * + * The format of the results that a provider supports. + * + * @return the dataType + */ + public String getDataType() { + return dataType; + } + + /** + * Gets the icon. + * + * The icon of a provider in .svg format that is encoded as a base64 string. + * + * @return the icon + */ + public String getIcon() { + return icon; + } + + /** + * Gets the label. + * + * The label that is associated with the provider type. + * + * @return the label + */ + public LabelType getLabel() { + return label; + } + + /** + * Gets the attributes. + * + * The attributes that are required when you're creating an instance of a provider type. The attributes field can have + * multiple keys in its value. Each of those keys has a value object that includes the type, and display name as + * keys. For example, `{type:"", display_name:""}`. + * **NOTE;** If the provider type is s2s-enabled, which means that if the `s2s_enabled` field is set to `true`, then a + * CRN field of type text is required in the attributes value object. + * + * @return the attributes + */ + public Map getAttributes() { + return attributes; + } + + /** + * Gets the createdAt. + * + * Time at which resource was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the updatedAt. + * + * Time at which resource was updated. + * + * @return the updatedAt + */ + public Date getUpdatedAt() { + return updatedAt; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeCollection.java new file mode 100644 index 00000000..c479fe09 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeCollection.java @@ -0,0 +1,42 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The provider types collection. + */ +public class ProviderTypeCollection extends GenericModel { + + @SerializedName("provider_types") + protected List providerTypes; + + protected ProviderTypeCollection() { } + + /** + * Gets the providerTypes. + * + * The array of provder type. + * + * @return the providerTypes + */ + public List getProviderTypes() { + return providerTypes; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstance.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstance.java new file mode 100644 index 00000000..a626568f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstance.java @@ -0,0 +1,104 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; +import java.util.Map; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A provider type instance. + */ +public class ProviderTypeInstance extends GenericModel { + + protected String id; + protected String type; + protected String name; + protected Map attributes; + @SerializedName("created_at") + protected Date createdAt; + @SerializedName("updated_at") + protected Date updatedAt; + + protected ProviderTypeInstance() { } + + /** + * Gets the id. + * + * The unique identifier of the provider type instance. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The type of the provider type. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the name. + * + * The name of the provider type instance. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the attributes. + * + * The attributes for connecting to the provider type instance. + * + * @return the attributes + */ + public Map getAttributes() { + return attributes; + } + + /** + * Gets the createdAt. + * + * Time at which resource was created. + * + * @return the createdAt + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * Gets the updatedAt. + * + * Time at which resource was updated. + * + * @return the updatedAt + */ + public Date getUpdatedAt() { + return updatedAt; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceCollection.java new file mode 100644 index 00000000..5732f8be --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceCollection.java @@ -0,0 +1,42 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Provider types instances response. + */ +public class ProviderTypeInstanceCollection extends GenericModel { + + @SerializedName("provider_type_instances") + protected List providerTypeInstances; + + protected ProviderTypeInstanceCollection() { } + + /** + * Gets the providerTypeInstances. + * + * The array of instances for all provider types. + * + * @return the providerTypeInstances + */ + public List getProviderTypeInstances() { + return providerTypeInstances; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceCustomControlLibraryOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceCustomControlLibraryOptions.java index 961ae59a..422d0e62 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceCustomControlLibraryOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceCustomControlLibraryOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,10 +10,10 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,58 +24,34 @@ public class ReplaceCustomControlLibraryOptions extends GenericModel { /** - * The control library type. + * Details that the control library is a user made(custom) or Security Compliance Center(predefined). */ public interface ControlLibraryType { - /** predefined. */ - String PREDEFINED = "predefined"; /** custom. */ String CUSTOM = "custom"; } - protected String controlLibrariesId; - protected String id; - protected String accountId; + protected String instanceId; + protected String controlLibraryId; protected String controlLibraryName; protected String controlLibraryDescription; protected String controlLibraryType; - protected String versionGroupLabel; protected String controlLibraryVersion; - protected Date createdOn; - protected String createdBy; - protected Date updatedOn; - protected String updatedBy; - protected Boolean latest; - protected Boolean hierarchyEnabled; - protected Long controlsCount; - protected Long controlParentsCount; - protected List controls; - protected String xCorrelationId; - protected String xRequestId; + protected List controls; + protected String bssAccount; /** * Builder. */ public static class Builder { - private String controlLibrariesId; - private String id; - private String accountId; + private String instanceId; + private String controlLibraryId; private String controlLibraryName; private String controlLibraryDescription; private String controlLibraryType; - private String versionGroupLabel; private String controlLibraryVersion; - private Date createdOn; - private String createdBy; - private Date updatedOn; - private String updatedBy; - private Boolean latest; - private Boolean hierarchyEnabled; - private Long controlsCount; - private Long controlParentsCount; - private List controls; - private String xCorrelationId; - private String xRequestId; + private List controls; + private String bssAccount; /** * Instantiates a new Builder from an existing ReplaceCustomControlLibraryOptions instance. @@ -83,25 +59,14 @@ public static class Builder { * @param replaceCustomControlLibraryOptions the instance to initialize the Builder with */ private Builder(ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptions) { - this.controlLibrariesId = replaceCustomControlLibraryOptions.controlLibrariesId; - this.id = replaceCustomControlLibraryOptions.id; - this.accountId = replaceCustomControlLibraryOptions.accountId; + this.instanceId = replaceCustomControlLibraryOptions.instanceId; + this.controlLibraryId = replaceCustomControlLibraryOptions.controlLibraryId; this.controlLibraryName = replaceCustomControlLibraryOptions.controlLibraryName; this.controlLibraryDescription = replaceCustomControlLibraryOptions.controlLibraryDescription; this.controlLibraryType = replaceCustomControlLibraryOptions.controlLibraryType; - this.versionGroupLabel = replaceCustomControlLibraryOptions.versionGroupLabel; this.controlLibraryVersion = replaceCustomControlLibraryOptions.controlLibraryVersion; - this.createdOn = replaceCustomControlLibraryOptions.createdOn; - this.createdBy = replaceCustomControlLibraryOptions.createdBy; - this.updatedOn = replaceCustomControlLibraryOptions.updatedOn; - this.updatedBy = replaceCustomControlLibraryOptions.updatedBy; - this.latest = replaceCustomControlLibraryOptions.latest; - this.hierarchyEnabled = replaceCustomControlLibraryOptions.hierarchyEnabled; - this.controlsCount = replaceCustomControlLibraryOptions.controlsCount; - this.controlParentsCount = replaceCustomControlLibraryOptions.controlParentsCount; this.controls = replaceCustomControlLibraryOptions.controls; - this.xCorrelationId = replaceCustomControlLibraryOptions.xCorrelationId; - this.xRequestId = replaceCustomControlLibraryOptions.xRequestId; + this.bssAccount = replaceCustomControlLibraryOptions.bssAccount; } /** @@ -113,10 +78,22 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param controlLibrariesId the controlLibrariesId + * @param instanceId the instanceId + * @param controlLibraryId the controlLibraryId + * @param controlLibraryName the controlLibraryName + * @param controlLibraryDescription the controlLibraryDescription + * @param controlLibraryType the controlLibraryType + * @param controlLibraryVersion the controlLibraryVersion + * @param controls the controls */ - public Builder(String controlLibrariesId) { - this.controlLibrariesId = controlLibrariesId; + public Builder(String instanceId, String controlLibraryId, String controlLibraryName, String controlLibraryDescription, String controlLibraryType, String controlLibraryVersion, List controls) { + this.instanceId = instanceId; + this.controlLibraryId = controlLibraryId; + this.controlLibraryName = controlLibraryName; + this.controlLibraryDescription = controlLibraryDescription; + this.controlLibraryType = controlLibraryType; + this.controlLibraryVersion = controlLibraryVersion; + this.controls = controls; } /** @@ -129,51 +106,40 @@ public ReplaceCustomControlLibraryOptions build() { } /** - * Adds an controls to controls. + * Adds a new element to controls. * - * @param controls the new controls + * @param controls the new element to be added * @return the ReplaceCustomControlLibraryOptions builder */ - public Builder addControls(ControlsInControlLib controls) { + public Builder addControls(ControlPrototype controls) { com.ibm.cloud.sdk.core.util.Validator.notNull(controls, "controls cannot be null"); if (this.controls == null) { - this.controls = new ArrayList(); + this.controls = new ArrayList(); } this.controls.add(controls); return this; } /** - * Set the controlLibrariesId. + * Set the instanceId. * - * @param controlLibrariesId the controlLibrariesId + * @param instanceId the instanceId * @return the ReplaceCustomControlLibraryOptions builder */ - public Builder controlLibrariesId(String controlLibrariesId) { - this.controlLibrariesId = controlLibrariesId; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } /** - * Set the id. + * Set the controlLibraryId. * - * @param id the id + * @param controlLibraryId the controlLibraryId * @return the ReplaceCustomControlLibraryOptions builder */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; + public Builder controlLibraryId(String controlLibraryId) { + this.controlLibraryId = controlLibraryId; return this; } @@ -210,17 +176,6 @@ public Builder controlLibraryType(String controlLibraryType) { return this; } - /** - * Set the versionGroupLabel. - * - * @param versionGroupLabel the versionGroupLabel - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder versionGroupLabel(String versionGroupLabel) { - this.versionGroupLabel = versionGroupLabel; - return this; - } - /** * Set the controlLibraryVersion. * @@ -232,94 +187,6 @@ public Builder controlLibraryVersion(String controlLibraryVersion) { return this; } - /** - * Set the createdOn. - * - * @param createdOn the createdOn - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder createdOn(Date createdOn) { - this.createdOn = createdOn; - return this; - } - - /** - * Set the createdBy. - * - * @param createdBy the createdBy - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - * Set the updatedOn. - * - * @param updatedOn the updatedOn - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder updatedOn(Date updatedOn) { - this.updatedOn = updatedOn; - return this; - } - - /** - * Set the updatedBy. - * - * @param updatedBy the updatedBy - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder updatedBy(String updatedBy) { - this.updatedBy = updatedBy; - return this; - } - - /** - * Set the latest. - * - * @param latest the latest - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder latest(Boolean latest) { - this.latest = latest; - return this; - } - - /** - * Set the hierarchyEnabled. - * - * @param hierarchyEnabled the hierarchyEnabled - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder hierarchyEnabled(Boolean hierarchyEnabled) { - this.hierarchyEnabled = hierarchyEnabled; - return this; - } - - /** - * Set the controlsCount. - * - * @param controlsCount the controlsCount - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder controlsCount(long controlsCount) { - this.controlsCount = controlsCount; - return this; - } - - /** - * Set the controlParentsCount. - * - * @param controlParentsCount the controlParentsCount - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder controlParentsCount(long controlParentsCount) { - this.controlParentsCount = controlParentsCount; - return this; - } - /** * Set the controls. * Existing controls will be replaced. @@ -327,56 +194,19 @@ public Builder controlParentsCount(long controlParentsCount) { * @param controls the controls * @return the ReplaceCustomControlLibraryOptions builder */ - public Builder controls(List controls) { + public Builder controls(List controls) { this.controls = controls; return this; } /** - * Set the xCorrelationId. + * Set the bssAccount. * - * @param xCorrelationId the xCorrelationId + * @param bssAccount the bssAccount * @return the ReplaceCustomControlLibraryOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. - * - * @param xRequestId the xRequestId - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; - return this; - } - - /** - * Set the controlLibrary. - * - * @param controlLibrary the controlLibrary - * @return the ReplaceCustomControlLibraryOptions builder - */ - public Builder controlLibrary(ControlLibrary controlLibrary) { - this.id = controlLibrary.id(); - this.accountId = controlLibrary.accountId(); - this.controlLibraryName = controlLibrary.controlLibraryName(); - this.controlLibraryDescription = controlLibrary.controlLibraryDescription(); - this.controlLibraryType = controlLibrary.controlLibraryType(); - this.versionGroupLabel = controlLibrary.versionGroupLabel(); - this.controlLibraryVersion = controlLibrary.controlLibraryVersion(); - this.createdOn = controlLibrary.createdOn(); - this.createdBy = controlLibrary.createdBy(); - this.updatedOn = controlLibrary.updatedOn(); - this.updatedBy = controlLibrary.updatedBy(); - this.latest = controlLibrary.latest(); - this.hierarchyEnabled = controlLibrary.hierarchyEnabled(); - this.controlsCount = controlLibrary.controlsCount(); - this.controlParentsCount = controlLibrary.controlParentsCount(); - this.controls = controlLibrary.controls(); + public Builder bssAccount(String bssAccount) { + this.bssAccount = bssAccount; return this; } } @@ -384,27 +214,28 @@ public Builder controlLibrary(ControlLibrary controlLibrary) { protected ReplaceCustomControlLibraryOptions() { } protected ReplaceCustomControlLibraryOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.controlLibrariesId, - "controlLibrariesId cannot be empty"); - controlLibrariesId = builder.controlLibrariesId; - id = builder.id; - accountId = builder.accountId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.controlLibraryId, + "controlLibraryId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlLibraryName, + "controlLibraryName cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlLibraryDescription, + "controlLibraryDescription cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlLibraryType, + "controlLibraryType cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controlLibraryVersion, + "controlLibraryVersion cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controls, + "controls cannot be null"); + instanceId = builder.instanceId; + controlLibraryId = builder.controlLibraryId; controlLibraryName = builder.controlLibraryName; controlLibraryDescription = builder.controlLibraryDescription; controlLibraryType = builder.controlLibraryType; - versionGroupLabel = builder.versionGroupLabel; controlLibraryVersion = builder.controlLibraryVersion; - createdOn = builder.createdOn; - createdBy = builder.createdBy; - updatedOn = builder.updatedOn; - updatedBy = builder.updatedBy; - latest = builder.latest; - hierarchyEnabled = builder.hierarchyEnabled; - controlsCount = builder.controlsCount; - controlParentsCount = builder.controlParentsCount; controls = builder.controls; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + bssAccount = builder.bssAccount; } /** @@ -417,42 +248,31 @@ public Builder newBuilder() { } /** - * Gets the controlLibrariesId. + * Gets the instanceId. * - * The control library ID. + * The ID of the Security and Compliance Center instance. * - * @return the controlLibrariesId + * @return the instanceId */ - public String controlLibrariesId() { - return controlLibrariesId; + public String instanceId() { + return instanceId; } /** - * Gets the id. + * Gets the controlLibraryId. * * The control library ID. * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the accountId. - * - * The account ID. - * - * @return the accountId + * @return the controlLibraryId */ - public String accountId() { - return accountId; + public String controlLibraryId() { + return controlLibraryId; } /** * Gets the controlLibraryName. * - * The control library name. + * The name of the control library. * * @return the controlLibraryName */ @@ -463,7 +283,7 @@ public String controlLibraryName() { /** * Gets the controlLibraryDescription. * - * The control library description. + * Details of the control library. * * @return the controlLibraryDescription */ @@ -474,7 +294,7 @@ public String controlLibraryDescription() { /** * Gets the controlLibraryType. * - * The control library type. + * Details that the control library is a user made(custom) or Security Compliance Center(predefined). * * @return the controlLibraryType */ @@ -482,21 +302,10 @@ public String controlLibraryType() { return controlLibraryType; } - /** - * Gets the versionGroupLabel. - * - * The version group label. - * - * @return the versionGroupLabel - */ - public String versionGroupLabel() { - return versionGroupLabel; - } - /** * Gets the controlLibraryVersion. * - * The control library version. + * The revision number of the control library. * * @return the controlLibraryVersion */ @@ -504,129 +313,26 @@ public String controlLibraryVersion() { return controlLibraryVersion; } - /** - * Gets the createdOn. - * - * The date when the control library was created. - * - * @return the createdOn - */ - public Date createdOn() { - return createdOn; - } - - /** - * Gets the createdBy. - * - * The user who created the control library. - * - * @return the createdBy - */ - public String createdBy() { - return createdBy; - } - - /** - * Gets the updatedOn. - * - * The date when the control library was updated. - * - * @return the updatedOn - */ - public Date updatedOn() { - return updatedOn; - } - - /** - * Gets the updatedBy. - * - * The user who updated the control library. - * - * @return the updatedBy - */ - public String updatedBy() { - return updatedBy; - } - - /** - * Gets the latest. - * - * The latest version of the control library. - * - * @return the latest - */ - public Boolean latest() { - return latest; - } - - /** - * Gets the hierarchyEnabled. - * - * The indication of whether hierarchy is enabled for the control library. - * - * @return the hierarchyEnabled - */ - public Boolean hierarchyEnabled() { - return hierarchyEnabled; - } - - /** - * Gets the controlsCount. - * - * The number of controls. - * - * @return the controlsCount - */ - public Long controlsCount() { - return controlsCount; - } - - /** - * Gets the controlParentsCount. - * - * The number of parent controls in the control library. - * - * @return the controlParentsCount - */ - public Long controlParentsCount() { - return controlParentsCount; - } - /** * Gets the controls. * - * The list of controls in a control library. + * The list of rules that the control library attempts to adhere to. * * @return the controls */ - public List controls() { + public List controls() { return controls; } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the bssAccount. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The account id tied to billing. * - * @return the xRequestId + * @return the bssAccount */ - public String xRequestId() { - return xRequestId; + public String bssAccount() { + return bssAccount; } } 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 651a91ce..8f5610a2 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,10 +10,10 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -24,17 +24,7 @@ public class ReplaceProfileAttachmentOptions extends GenericModel { /** - * The status of an attachment evaluation. - */ - public interface Status { - /** enabled. */ - String ENABLED = "enabled"; - /** disabled. */ - String DISABLED = "disabled"; - } - - /** - * The schedule of an attachment evaluation. + * Details how often a scan from a profile attachment is ran. */ public interface Schedule { /** daily. */ @@ -45,51 +35,45 @@ public interface Schedule { String EVERY_30_DAYS = "every_30_days"; } - protected String attachmentId; - protected String profileId; - protected String id; - protected String accountId; + /** + * Details the state of a profile attachment. + */ + public interface Status { + /** enabled. */ + String ENABLED = "enabled"; + /** disabled. */ + String DISABLED = "disabled"; + } + protected String instanceId; - protected List scope; - protected Date createdOn; - protected String createdBy; - protected Date updatedOn; - protected String updatedBy; - protected String status; - protected String schedule; - protected AttachmentsNotificationsPrototype notifications; - protected List attachmentParameters; - protected LastScan lastScan; - protected Date nextScanTime; - protected String name; + protected String profileId; + protected String attachmentId; + protected List attachmentParameters; protected String description; - protected String xCorrelationId; - protected String xRequestId; + protected String name; + protected AttachmentNotifications notifications; + protected String schedule; + protected List scope; + protected String status; + protected DateRange dataSelectionRange; + protected String accountId; /** * Builder. */ public static class Builder { - private String attachmentId; - private String profileId; - private String id; - private String accountId; private String instanceId; - private List scope; - private Date createdOn; - private String createdBy; - private Date updatedOn; - private String updatedBy; - private String status; - private String schedule; - private AttachmentsNotificationsPrototype notifications; - private List attachmentParameters; - private LastScan lastScan; - private Date nextScanTime; - private String name; + private String profileId; + private String attachmentId; + private List attachmentParameters; private String description; - private String xCorrelationId; - private String xRequestId; + private String name; + private AttachmentNotifications notifications; + private String schedule; + private List scope; + private String status; + private DateRange dataSelectionRange; + private String accountId; /** * Instantiates a new Builder from an existing ReplaceProfileAttachmentOptions instance. @@ -97,26 +81,18 @@ public static class Builder { * @param replaceProfileAttachmentOptions the instance to initialize the Builder with */ private Builder(ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions) { - this.attachmentId = replaceProfileAttachmentOptions.attachmentId; - this.profileId = replaceProfileAttachmentOptions.profileId; - this.id = replaceProfileAttachmentOptions.id; - this.accountId = replaceProfileAttachmentOptions.accountId; this.instanceId = replaceProfileAttachmentOptions.instanceId; - this.scope = replaceProfileAttachmentOptions.scope; - this.createdOn = replaceProfileAttachmentOptions.createdOn; - this.createdBy = replaceProfileAttachmentOptions.createdBy; - this.updatedOn = replaceProfileAttachmentOptions.updatedOn; - this.updatedBy = replaceProfileAttachmentOptions.updatedBy; - this.status = replaceProfileAttachmentOptions.status; - this.schedule = replaceProfileAttachmentOptions.schedule; - this.notifications = replaceProfileAttachmentOptions.notifications; + this.profileId = replaceProfileAttachmentOptions.profileId; + this.attachmentId = replaceProfileAttachmentOptions.attachmentId; this.attachmentParameters = replaceProfileAttachmentOptions.attachmentParameters; - this.lastScan = replaceProfileAttachmentOptions.lastScan; - this.nextScanTime = replaceProfileAttachmentOptions.nextScanTime; - this.name = replaceProfileAttachmentOptions.name; this.description = replaceProfileAttachmentOptions.description; - this.xCorrelationId = replaceProfileAttachmentOptions.xCorrelationId; - this.xRequestId = replaceProfileAttachmentOptions.xRequestId; + this.name = replaceProfileAttachmentOptions.name; + this.notifications = replaceProfileAttachmentOptions.notifications; + this.schedule = replaceProfileAttachmentOptions.schedule; + this.scope = replaceProfileAttachmentOptions.scope; + this.status = replaceProfileAttachmentOptions.status; + this.dataSelectionRange = replaceProfileAttachmentOptions.dataSelectionRange; + this.accountId = replaceProfileAttachmentOptions.accountId; } /** @@ -128,12 +104,28 @@ public Builder() { /** * Instantiates a new builder with required properties. * - * @param attachmentId the attachmentId + * @param instanceId the instanceId * @param profileId the profileId + * @param attachmentId the attachmentId + * @param attachmentParameters the attachmentParameters + * @param description the description + * @param name the name + * @param notifications the notifications + * @param schedule the schedule + * @param scope the scope + * @param status the status */ - public Builder(String attachmentId, String profileId) { - this.attachmentId = attachmentId; + public Builder(String instanceId, String profileId, String attachmentId, List attachmentParameters, String description, String name, AttachmentNotifications notifications, String schedule, List scope, String status) { + this.instanceId = instanceId; this.profileId = profileId; + this.attachmentId = attachmentId; + this.attachmentParameters = attachmentParameters; + this.description = description; + this.name = name; + this.notifications = notifications; + this.schedule = schedule; + this.scope = scope; + this.status = status; } /** @@ -146,78 +138,34 @@ public ReplaceProfileAttachmentOptions build() { } /** - * Adds an scope to scope. + * Adds a new element to attachmentParameters. * - * @param scope the new scope + * @param attachmentParameters the new element to be added * @return the ReplaceProfileAttachmentOptions builder */ - public Builder addScope(MultiCloudScope scope) { - com.ibm.cloud.sdk.core.util.Validator.notNull(scope, - "scope cannot be null"); - if (this.scope == null) { - this.scope = new ArrayList(); - } - this.scope.add(scope); - return this; - } - - /** - * Adds an attachmentParameters to attachmentParameters. - * - * @param attachmentParameters the new attachmentParameters - * @return the ReplaceProfileAttachmentOptions builder - */ - public Builder addAttachmentParameters(AttachmentParameterPrototype attachmentParameters) { + public Builder addAttachmentParameters(Parameter attachmentParameters) { com.ibm.cloud.sdk.core.util.Validator.notNull(attachmentParameters, "attachmentParameters cannot be null"); if (this.attachmentParameters == null) { - this.attachmentParameters = new ArrayList(); + this.attachmentParameters = new ArrayList(); } this.attachmentParameters.add(attachmentParameters); return this; } /** - * Set the attachmentId. - * - * @param attachmentId the attachmentId - * @return the ReplaceProfileAttachmentOptions builder - */ - public Builder attachmentId(String attachmentId) { - this.attachmentId = attachmentId; - 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 id. + * Adds a new element to scope. * - * @param id the id + * @param scope the new element to be added * @return the ReplaceProfileAttachmentOptions builder */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Set the accountId. - * - * @param accountId the accountId - * @return the ReplaceProfileAttachmentOptions builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; + public Builder addScope(MultiCloudScopePayload scope) { + com.ibm.cloud.sdk.core.util.Validator.notNull(scope, + "scope cannot be null"); + if (this.scope == null) { + this.scope = new ArrayList(); + } + this.scope.add(scope); return this; } @@ -233,69 +181,69 @@ public Builder instanceId(String instanceId) { } /** - * Set the scope. - * Existing scope will be replaced. + * Set the profileId. * - * @param scope the scope + * @param profileId the profileId * @return the ReplaceProfileAttachmentOptions builder */ - public Builder scope(List scope) { - this.scope = scope; + public Builder profileId(String profileId) { + this.profileId = profileId; return this; } /** - * Set the createdOn. + * Set the attachmentId. * - * @param createdOn the createdOn + * @param attachmentId the attachmentId * @return the ReplaceProfileAttachmentOptions builder */ - public Builder createdOn(Date createdOn) { - this.createdOn = createdOn; + public Builder attachmentId(String attachmentId) { + this.attachmentId = attachmentId; return this; } /** - * Set the createdBy. + * Set the attachmentParameters. + * Existing attachmentParameters will be replaced. * - * @param createdBy the createdBy + * @param attachmentParameters the attachmentParameters * @return the ReplaceProfileAttachmentOptions builder */ - public Builder createdBy(String createdBy) { - this.createdBy = createdBy; + public Builder attachmentParameters(List attachmentParameters) { + this.attachmentParameters = attachmentParameters; return this; } /** - * Set the updatedOn. + * Set the description. * - * @param updatedOn the updatedOn + * @param description the description * @return the ReplaceProfileAttachmentOptions builder */ - public Builder updatedOn(Date updatedOn) { - this.updatedOn = updatedOn; + public Builder description(String description) { + this.description = description; return this; } /** - * Set the updatedBy. + * Set the name. * - * @param updatedBy the updatedBy + * @param name the name * @return the ReplaceProfileAttachmentOptions builder */ - public Builder updatedBy(String updatedBy) { - this.updatedBy = updatedBy; + public Builder name(String name) { + this.name = name; return this; } /** - * Set the status. + * Set the notifications. * - * @param status the status + * @param notifications the notifications * @return the ReplaceProfileAttachmentOptions builder */ - public Builder status(String status) { - this.status = status; + public Builder notifications(AttachmentNotifications notifications) { + this.notifications = notifications; return this; } @@ -311,118 +259,47 @@ public Builder schedule(String schedule) { } /** - * Set the notifications. - * - * @param notifications the notifications - * @return the ReplaceProfileAttachmentOptions builder - */ - public Builder notifications(AttachmentsNotificationsPrototype notifications) { - this.notifications = notifications; - return this; - } - - /** - * Set the attachmentParameters. - * Existing attachmentParameters will be replaced. - * - * @param attachmentParameters the attachmentParameters - * @return the ReplaceProfileAttachmentOptions builder - */ - public Builder attachmentParameters(List attachmentParameters) { - this.attachmentParameters = attachmentParameters; - return this; - } - - /** - * Set the lastScan. - * - * @param lastScan the lastScan - * @return the ReplaceProfileAttachmentOptions builder - */ - public Builder lastScan(LastScan lastScan) { - this.lastScan = lastScan; - return this; - } - - /** - * Set the nextScanTime. - * - * @param nextScanTime the nextScanTime - * @return the ReplaceProfileAttachmentOptions builder - */ - public Builder nextScanTime(Date nextScanTime) { - this.nextScanTime = nextScanTime; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ReplaceProfileAttachmentOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. + * Set the scope. + * Existing scope will be replaced. * - * @param description the description + * @param scope the scope * @return the ReplaceProfileAttachmentOptions builder */ - public Builder description(String description) { - this.description = description; + public Builder scope(List scope) { + this.scope = scope; return this; } /** - * Set the xCorrelationId. + * Set the status. * - * @param xCorrelationId the xCorrelationId + * @param status the status * @return the ReplaceProfileAttachmentOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder status(String status) { + this.status = status; return this; } /** - * Set the xRequestId. + * Set the dataSelectionRange. * - * @param xRequestId the xRequestId + * @param dataSelectionRange the dataSelectionRange * @return the ReplaceProfileAttachmentOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder dataSelectionRange(DateRange dataSelectionRange) { + this.dataSelectionRange = dataSelectionRange; return this; } /** - * Set the attachmentItem. + * Set the accountId. * - * @param attachmentItem the attachmentItem + * @param accountId the accountId * @return the ReplaceProfileAttachmentOptions builder */ - public Builder attachmentItem(AttachmentItem attachmentItem) { - this.id = attachmentItem.id(); - this.profileId = attachmentItem.profileId(); - this.accountId = attachmentItem.accountId(); - this.instanceId = attachmentItem.instanceId(); - this.scope = attachmentItem.scope(); - this.createdOn = attachmentItem.createdOn(); - this.createdBy = attachmentItem.createdBy(); - this.updatedOn = attachmentItem.updatedOn(); - this.updatedBy = attachmentItem.updatedBy(); - this.status = attachmentItem.status(); - this.schedule = attachmentItem.schedule(); - this.notifications = attachmentItem.notifications(); - this.attachmentParameters = attachmentItem.attachmentParameters(); - this.lastScan = attachmentItem.lastScan(); - this.nextScanTime = attachmentItem.nextScanTime(); - this.name = attachmentItem.name(); - this.description = attachmentItem.description(); + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } } @@ -430,30 +307,38 @@ public Builder attachmentItem(AttachmentItem attachmentItem) { 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.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, "profileId cannot be empty"); - attachmentId = builder.attachmentId; - id = builder.id; - profileId = builder.profileId; - accountId = builder.accountId; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.attachmentId, + "attachmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attachmentParameters, + "attachmentParameters cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.description, + "description cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.notifications, + "notifications cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.schedule, + "schedule cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.scope, + "scope cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.status, + "status cannot be null"); instanceId = builder.instanceId; - scope = builder.scope; - createdOn = builder.createdOn; - createdBy = builder.createdBy; - updatedOn = builder.updatedOn; - updatedBy = builder.updatedBy; - status = builder.status; - schedule = builder.schedule; - notifications = builder.notifications; + profileId = builder.profileId; + attachmentId = builder.attachmentId; attachmentParameters = builder.attachmentParameters; - lastScan = builder.lastScan; - nextScanTime = builder.nextScanTime; - name = builder.name; description = builder.description; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + name = builder.name; + notifications = builder.notifications; + schedule = builder.schedule; + scope = builder.scope; + status = builder.status; + dataSelectionRange = builder.dataSelectionRange; + accountId = builder.accountId; } /** @@ -466,14 +351,14 @@ public Builder newBuilder() { } /** - * Gets the attachmentId. + * Gets the instanceId. * - * The attachment ID. + * The ID of the Security and Compliance Center instance. * - * @return the attachmentId + * @return the instanceId */ - public String attachmentId() { - return attachmentId; + public String instanceId() { + return instanceId; } /** @@ -488,108 +373,64 @@ public String profileId() { } /** - * Gets the id. - * - * The ID of the attachment. - * - * @return the id - */ - public String id() { - return id; - } - - /** - * Gets the accountId. - * - * The account ID that is associated to the attachment. - * - * @return the accountId - */ - public String accountId() { - return accountId; - } - - /** - * Gets the instanceId. - * - * The instance ID of the account that is associated to the attachment. - * - * @return the instanceId - */ - public String instanceId() { - return instanceId; - } - - /** - * Gets the scope. - * - * The scope payload for the multi cloud feature. - * - * @return the scope - */ - public List scope() { - return scope; - } - - /** - * Gets the createdOn. + * Gets the attachmentId. * - * The date when the attachment was created. + * The attachment ID. * - * @return the createdOn + * @return the attachmentId */ - public Date createdOn() { - return createdOn; + public String attachmentId() { + return attachmentId; } /** - * Gets the createdBy. + * Gets the attachmentParameters. * - * The user who created the attachment. + * The parameters associated with the profile attachment. * - * @return the createdBy + * @return the attachmentParameters */ - public String createdBy() { - return createdBy; + public List attachmentParameters() { + return attachmentParameters; } /** - * Gets the updatedOn. + * Gets the description. * - * The date when the attachment was updated. + * The details to describe the profile attachment. * - * @return the updatedOn + * @return the description */ - public Date updatedOn() { - return updatedOn; + public String description() { + return description; } /** - * Gets the updatedBy. + * Gets the name. * - * The user who updated the attachment. + * The name of the Profile Attachment. * - * @return the updatedBy + * @return the name */ - public String updatedBy() { - return updatedBy; + public String name() { + return name; } /** - * Gets the status. + * Gets the notifications. * - * The status of an attachment evaluation. + * The notification configuration of the attachment. * - * @return the status + * @return the notifications */ - public String status() { - return status; + public AttachmentNotifications notifications() { + return notifications; } /** * Gets the schedule. * - * The schedule of an attachment evaluation. + * Details how often a scan from a profile attachment is ran. * * @return the schedule */ @@ -598,95 +439,47 @@ public String schedule() { } /** - * Gets the notifications. - * - * The request payload of the attachment notifications. - * - * @return the notifications - */ - public AttachmentsNotificationsPrototype notifications() { - return notifications; - } - - /** - * Gets the attachmentParameters. - * - * The profile parameters for the attachment. - * - * @return the attachmentParameters - */ - public List attachmentParameters() { - return attachmentParameters; - } - - /** - * Gets the lastScan. - * - * The details of the last scan of an attachment. - * - * @return the lastScan - */ - public LastScan lastScan() { - return lastScan; - } - - /** - * Gets the nextScanTime. - * - * The start time of the next scan. - * - * @return the nextScanTime - */ - public Date nextScanTime() { - return nextScanTime; - } - - /** - * Gets the name. + * Gets the scope. * - * The name of the attachment. + * A list of scopes associated with a profile attachment. * - * @return the name + * @return the scope */ - public String name() { - return name; + public List scope() { + return scope; } /** - * Gets the description. + * Gets the status. * - * The description for the attachment. + * Details the state of a profile attachment. * - * @return the description + * @return the status */ - public String description() { - return description; + public String status() { + return status; } /** - * Gets the xCorrelationId. + * Gets the dataSelectionRange. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * Date range. * - * @return the xCorrelationId + * @return the dataSelectionRange */ - public String xCorrelationId() { - return xCorrelationId; + public DateRange dataSelectionRange() { + return dataSelectionRange; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return 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 e17b22ee..d50dd1a2 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,9 +10,11 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; import java.util.List; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -23,36 +25,60 @@ public class ReplaceProfileOptions extends GenericModel { /** - * The profile type. + * The type of profile, either predefined or custom. */ - public interface ProfileType { - /** predefined. */ - String PREDEFINED = "predefined"; + public interface NewProfileType { /** custom. */ String CUSTOM = "custom"; + /** predefined. */ + String PREDEFINED = "predefined"; } + protected String instanceId; protected String profileId; - protected String profileName; - protected String profileDescription; - protected String profileType; - protected List controls; - protected List defaultParameters; - protected String xCorrelationId; - protected String xRequestId; + protected String newProfileType; + protected List newControls; + protected List newDefaultParameters; + protected String newId; + protected String newProfileName; + protected String newInstanceId; + protected Boolean newHierarchyEnabled; + protected String newProfileDescription; + protected String newProfileVersion; + protected String newVersionGroupLabel; + protected Boolean newLatest; + protected String newCreatedBy; + protected Date newCreatedOn; + protected String newUpdatedBy; + protected Date newUpdatedOn; + protected Long newControlsCount; + protected Long newAttachmentsCount; + protected String accountId; /** * Builder. */ public static class Builder { + private String instanceId; private String profileId; - private String profileName; - private String profileDescription; - private String profileType; - private List controls; - private List defaultParameters; - private String xCorrelationId; - private String xRequestId; + private String newProfileType; + private List newControls; + private List newDefaultParameters; + private String newId; + private String newProfileName; + private String newInstanceId; + private Boolean newHierarchyEnabled; + private String newProfileDescription; + private String newProfileVersion; + private String newVersionGroupLabel; + private Boolean newLatest; + private String newCreatedBy; + private Date newCreatedOn; + private String newUpdatedBy; + private Date newUpdatedOn; + private Long newControlsCount; + private Long newAttachmentsCount; + private String accountId; /** * Instantiates a new Builder from an existing ReplaceProfileOptions instance. @@ -60,14 +86,26 @@ public static class Builder { * @param replaceProfileOptions the instance to initialize the Builder with */ private Builder(ReplaceProfileOptions replaceProfileOptions) { + this.instanceId = replaceProfileOptions.instanceId; this.profileId = replaceProfileOptions.profileId; - this.profileName = replaceProfileOptions.profileName; - this.profileDescription = replaceProfileOptions.profileDescription; - this.profileType = replaceProfileOptions.profileType; - this.controls = replaceProfileOptions.controls; - this.defaultParameters = replaceProfileOptions.defaultParameters; - this.xCorrelationId = replaceProfileOptions.xCorrelationId; - this.xRequestId = replaceProfileOptions.xRequestId; + this.newProfileType = replaceProfileOptions.newProfileType; + this.newControls = replaceProfileOptions.newControls; + this.newDefaultParameters = replaceProfileOptions.newDefaultParameters; + this.newId = replaceProfileOptions.newId; + this.newProfileName = replaceProfileOptions.newProfileName; + this.newInstanceId = replaceProfileOptions.newInstanceId; + this.newHierarchyEnabled = replaceProfileOptions.newHierarchyEnabled; + this.newProfileDescription = replaceProfileOptions.newProfileDescription; + this.newProfileVersion = replaceProfileOptions.newProfileVersion; + this.newVersionGroupLabel = replaceProfileOptions.newVersionGroupLabel; + this.newLatest = replaceProfileOptions.newLatest; + this.newCreatedBy = replaceProfileOptions.newCreatedBy; + this.newCreatedOn = replaceProfileOptions.newCreatedOn; + this.newUpdatedBy = replaceProfileOptions.newUpdatedBy; + this.newUpdatedOn = replaceProfileOptions.newUpdatedOn; + this.newControlsCount = replaceProfileOptions.newControlsCount; + this.newAttachmentsCount = replaceProfileOptions.newAttachmentsCount; + this.accountId = replaceProfileOptions.accountId; } /** @@ -79,20 +117,18 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param profileId the profileId - * @param profileName the profileName - * @param profileDescription the profileDescription - * @param profileType the profileType - * @param controls the controls - * @param defaultParameters the defaultParameters + * @param newProfileType the newProfileType + * @param newControls the newControls + * @param newDefaultParameters the newDefaultParameters */ - public Builder(String profileId, String profileName, String profileDescription, String profileType, List controls, List defaultParameters) { + public Builder(String instanceId, String profileId, String newProfileType, List newControls, List newDefaultParameters) { + this.instanceId = instanceId; this.profileId = profileId; - this.profileName = profileName; - this.profileDescription = profileDescription; - this.profileType = profileType; - this.controls = controls; - this.defaultParameters = defaultParameters; + this.newProfileType = newProfileType; + this.newControls = newControls; + this.newDefaultParameters = newDefaultParameters; } /** @@ -105,34 +141,45 @@ public ReplaceProfileOptions build() { } /** - * Adds an controls to controls. + * Adds a new element to newControls. * - * @param controls the new controls + * @param newControls the new element to be added * @return the ReplaceProfileOptions builder */ - public Builder addControls(ProfileControlsPrototype controls) { - com.ibm.cloud.sdk.core.util.Validator.notNull(controls, - "controls cannot be null"); - if (this.controls == null) { - this.controls = new ArrayList(); + public Builder addNewControls(ProfileControls newControls) { + com.ibm.cloud.sdk.core.util.Validator.notNull(newControls, + "newControls cannot be null"); + if (this.newControls == null) { + this.newControls = new ArrayList(); } - this.controls.add(controls); + this.newControls.add(newControls); return this; } /** - * Adds an defaultParameters to defaultParameters. + * Adds a new element to newDefaultParameters. * - * @param defaultParameters the new defaultParameters + * @param newDefaultParameters the new element to be added * @return the ReplaceProfileOptions builder */ - public Builder addDefaultParameters(DefaultParametersPrototype defaultParameters) { - com.ibm.cloud.sdk.core.util.Validator.notNull(defaultParameters, - "defaultParameters cannot be null"); - if (this.defaultParameters == null) { - this.defaultParameters = new ArrayList(); + public Builder addNewDefaultParameters(DefaultParameters newDefaultParameters) { + com.ibm.cloud.sdk.core.util.Validator.notNull(newDefaultParameters, + "newDefaultParameters cannot be null"); + if (this.newDefaultParameters == null) { + this.newDefaultParameters = new ArrayList(); } - this.defaultParameters.add(defaultParameters); + this.newDefaultParameters.add(newDefaultParameters); + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ReplaceProfileOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } @@ -148,81 +195,229 @@ public Builder profileId(String profileId) { } /** - * Set the profileName. + * Set the newProfileType. + * + * @param newProfileType the newProfileType + * @return the ReplaceProfileOptions builder + */ + public Builder newProfileType(String newProfileType) { + this.newProfileType = newProfileType; + return this; + } + + /** + * Set the newControls. + * Existing newControls will be replaced. + * + * @param newControls the newControls + * @return the ReplaceProfileOptions builder + */ + public Builder newControls(List newControls) { + this.newControls = newControls; + return this; + } + + /** + * Set the newDefaultParameters. + * Existing newDefaultParameters will be replaced. + * + * @param newDefaultParameters the newDefaultParameters + * @return the ReplaceProfileOptions builder + */ + public Builder newDefaultParameters(List newDefaultParameters) { + this.newDefaultParameters = newDefaultParameters; + return this; + } + + /** + * Set the newId. + * + * @param newId the newId + * @return the ReplaceProfileOptions builder + */ + public Builder newId(String newId) { + this.newId = newId; + return this; + } + + /** + * Set the newProfileName. + * + * @param newProfileName the newProfileName + * @return the ReplaceProfileOptions builder + */ + public Builder newProfileName(String newProfileName) { + this.newProfileName = newProfileName; + return this; + } + + /** + * Set the newInstanceId. + * + * @param newInstanceId the newInstanceId + * @return the ReplaceProfileOptions builder + */ + public Builder newInstanceId(String newInstanceId) { + this.newInstanceId = newInstanceId; + return this; + } + + /** + * Set the newHierarchyEnabled. + * + * @param newHierarchyEnabled the newHierarchyEnabled + * @return the ReplaceProfileOptions builder + */ + public Builder newHierarchyEnabled(Boolean newHierarchyEnabled) { + this.newHierarchyEnabled = newHierarchyEnabled; + return this; + } + + /** + * Set the newProfileDescription. + * + * @param newProfileDescription the newProfileDescription + * @return the ReplaceProfileOptions builder + */ + public Builder newProfileDescription(String newProfileDescription) { + this.newProfileDescription = newProfileDescription; + return this; + } + + /** + * Set the newProfileVersion. + * + * @param newProfileVersion the newProfileVersion + * @return the ReplaceProfileOptions builder + */ + public Builder newProfileVersion(String newProfileVersion) { + this.newProfileVersion = newProfileVersion; + return this; + } + + /** + * Set the newVersionGroupLabel. + * + * @param newVersionGroupLabel the newVersionGroupLabel + * @return the ReplaceProfileOptions builder + */ + public Builder newVersionGroupLabel(String newVersionGroupLabel) { + this.newVersionGroupLabel = newVersionGroupLabel; + return this; + } + + /** + * Set the newLatest. + * + * @param newLatest the newLatest + * @return the ReplaceProfileOptions builder + */ + public Builder newLatest(Boolean newLatest) { + this.newLatest = newLatest; + return this; + } + + /** + * Set the newCreatedBy. + * + * @param newCreatedBy the newCreatedBy + * @return the ReplaceProfileOptions builder + */ + public Builder newCreatedBy(String newCreatedBy) { + this.newCreatedBy = newCreatedBy; + return this; + } + + /** + * Set the newCreatedOn. * - * @param profileName the profileName + * @param newCreatedOn the newCreatedOn * @return the ReplaceProfileOptions builder */ - public Builder profileName(String profileName) { - this.profileName = profileName; + public Builder newCreatedOn(Date newCreatedOn) { + this.newCreatedOn = newCreatedOn; return this; } /** - * Set the profileDescription. + * Set the newUpdatedBy. * - * @param profileDescription the profileDescription + * @param newUpdatedBy the newUpdatedBy * @return the ReplaceProfileOptions builder */ - public Builder profileDescription(String profileDescription) { - this.profileDescription = profileDescription; + public Builder newUpdatedBy(String newUpdatedBy) { + this.newUpdatedBy = newUpdatedBy; return this; } /** - * Set the profileType. + * Set the newUpdatedOn. * - * @param profileType the profileType + * @param newUpdatedOn the newUpdatedOn * @return the ReplaceProfileOptions builder */ - public Builder profileType(String profileType) { - this.profileType = profileType; + public Builder newUpdatedOn(Date newUpdatedOn) { + this.newUpdatedOn = newUpdatedOn; return this; } /** - * Set the controls. - * Existing controls will be replaced. + * Set the newControlsCount. * - * @param controls the controls + * @param newControlsCount the newControlsCount * @return the ReplaceProfileOptions builder */ - public Builder controls(List controls) { - this.controls = controls; + public Builder newControlsCount(long newControlsCount) { + this.newControlsCount = newControlsCount; return this; } /** - * Set the defaultParameters. - * Existing defaultParameters will be replaced. + * Set the newAttachmentsCount. * - * @param defaultParameters the defaultParameters + * @param newAttachmentsCount the newAttachmentsCount * @return the ReplaceProfileOptions builder */ - public Builder defaultParameters(List defaultParameters) { - this.defaultParameters = defaultParameters; + public Builder newAttachmentsCount(long newAttachmentsCount) { + this.newAttachmentsCount = newAttachmentsCount; return this; } /** - * Set the xCorrelationId. + * Set the accountId. * - * @param xCorrelationId the xCorrelationId + * @param accountId the accountId * @return the ReplaceProfileOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder accountId(String accountId) { + this.accountId = accountId; return this; } /** - * Set the xRequestId. + * Set the profile. * - * @param xRequestId the xRequestId + * @param profile the profile * @return the ReplaceProfileOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder profile(Profile profile) { + this.newProfileType = profile.profileType(); + this.newControls = profile.controls(); + this.newDefaultParameters = profile.defaultParameters(); + this.newId = profile.id(); + this.newProfileName = profile.profileName(); + this.newInstanceId = profile.instanceId(); + this.newHierarchyEnabled = profile.hierarchyEnabled(); + this.newProfileDescription = profile.profileDescription(); + this.newProfileVersion = profile.profileVersion(); + this.newVersionGroupLabel = profile.versionGroupLabel(); + this.newLatest = profile.latest(); + this.newCreatedBy = profile.createdBy(); + this.newCreatedOn = profile.createdOn(); + this.newUpdatedBy = profile.updatedBy(); + this.newUpdatedOn = profile.updatedOn(); + this.newControlsCount = profile.controlsCount(); + this.newAttachmentsCount = profile.attachmentsCount(); return this; } } @@ -230,26 +425,36 @@ public Builder xRequestId(String xRequestId) { protected ReplaceProfileOptions() { } protected ReplaceProfileOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId 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, - "profileDescription cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.profileType, - "profileType cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.controls, - "controls cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.defaultParameters, - "defaultParameters cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.newProfileType, + "newProfileType cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.newControls, + "newControls cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.newDefaultParameters, + "newDefaultParameters cannot be null"); + instanceId = builder.instanceId; profileId = builder.profileId; - profileName = builder.profileName; - profileDescription = builder.profileDescription; - profileType = builder.profileType; - controls = builder.controls; - defaultParameters = builder.defaultParameters; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + newProfileType = builder.newProfileType; + newControls = builder.newControls; + newDefaultParameters = builder.newDefaultParameters; + newId = builder.newId; + newProfileName = builder.newProfileName; + newInstanceId = builder.newInstanceId; + newHierarchyEnabled = builder.newHierarchyEnabled; + newProfileDescription = builder.newProfileDescription; + newProfileVersion = builder.newProfileVersion; + newVersionGroupLabel = builder.newVersionGroupLabel; + newLatest = builder.newLatest; + newCreatedBy = builder.newCreatedBy; + newCreatedOn = builder.newCreatedOn; + newUpdatedBy = builder.newUpdatedBy; + newUpdatedOn = builder.newUpdatedOn; + newControlsCount = builder.newControlsCount; + newAttachmentsCount = builder.newAttachmentsCount; + accountId = builder.accountId; } /** @@ -261,6 +466,17 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + /** * Gets the profileId. * @@ -273,84 +489,201 @@ public String profileId() { } /** - * Gets the profileName. + * Gets the newProfileType. + * + * The type of profile, either predefined or custom. + * + * @return the newProfileType + */ + public String newProfileType() { + return newProfileType; + } + + /** + * Gets the newControls. + * + * The list of controls. + * + * @return the newControls + */ + public List newControls() { + return newControls; + } + + /** + * Gets the newDefaultParameters. + * + * The default parameters of the profile. + * + * @return the newDefaultParameters + */ + public List newDefaultParameters() { + return newDefaultParameters; + } + + /** + * Gets the newId. + * + * The ID of the profile. + * + * @return the newId + */ + public String newId() { + return newId; + } + + /** + * Gets the newProfileName. * * The name of the profile. * - * @return the profileName + * @return the newProfileName */ - public String profileName() { - return profileName; + public String newProfileName() { + return newProfileName; } /** - * Gets the profileDescription. + * Gets the newInstanceId. * - * The description of the profile. + * The ID of the Security and Compliance Center instance who owns the profile. * - * @return the profileDescription + * @return the newInstanceId */ - public String profileDescription() { - return profileDescription; + public String newInstanceId() { + return newInstanceId; } /** - * Gets the profileType. + * Gets the newHierarchyEnabled. * - * The profile type. + * Determines if the profile can be set to a hierarchy. * - * @return the profileType + * @return the newHierarchyEnabled */ - public String profileType() { - return profileType; + public Boolean newHierarchyEnabled() { + return newHierarchyEnabled; } /** - * Gets the controls. + * Gets the newProfileDescription. * - * The controls that are in the profile. + * A description of what the profile should represent. * - * @return the controls + * @return the newProfileDescription */ - public List controls() { - return controls; + public String newProfileDescription() { + return newProfileDescription; } /** - * Gets the defaultParameters. + * Gets the newProfileVersion. * - * The default parameters of the profile. + * The version of the profile. + * + * @return the newProfileVersion + */ + public String newProfileVersion() { + return newProfileVersion; + } + + /** + * Gets the newVersionGroupLabel. + * + * The unique identifier of the revision. + * + * @return the newVersionGroupLabel + */ + public String newVersionGroupLabel() { + return newVersionGroupLabel; + } + + /** + * Gets the newLatest. + * + * Determines if the profile is up to date with the latest revisions. + * + * @return the newLatest + */ + public Boolean newLatest() { + return newLatest; + } + + /** + * Gets the newCreatedBy. + * + * User who created the profile. + * + * @return the newCreatedBy + */ + public String newCreatedBy() { + return newCreatedBy; + } + + /** + * Gets the newCreatedOn. + * + * The date when the profile was created, in date-time format. + * + * @return the newCreatedOn + */ + public Date newCreatedOn() { + return newCreatedOn; + } + + /** + * Gets the newUpdatedBy. + * + * User who made the latest changes to the profile. + * + * @return the newUpdatedBy + */ + public String newUpdatedBy() { + return newUpdatedBy; + } + + /** + * Gets the newUpdatedOn. + * + * The date when the profile was last updated, in date-time format. + * + * @return the newUpdatedOn + */ + public Date newUpdatedOn() { + return newUpdatedOn; + } + + /** + * Gets the newControlsCount. + * + * The number of controls contained in the profile. * - * @return the defaultParameters + * @return the newControlsCount */ - public List defaultParameters() { - return defaultParameters; + public Long newControlsCount() { + return newControlsCount; } /** - * Gets the xCorrelationId. + * Gets the newAttachmentsCount. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. + * The number of attachments associated with the profile. * - * @return the xCorrelationId + * @return the newAttachmentsCount */ - public String xCorrelationId() { - return xCorrelationId; + public Long newAttachmentsCount() { + return newAttachmentsCount; } /** - * Gets the xRequestId. + * Gets the accountId. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The user account ID. * - * @return the xRequestId + * @return the accountId */ - public String xRequestId() { - return xRequestId; + public String accountId() { + return accountId; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileParametersOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileParametersOptions.java new file mode 100644 index 00000000..0d383248 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileParametersOptions.java @@ -0,0 +1,248 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceProfileParameters options. + */ +public class ReplaceProfileParametersOptions extends GenericModel { + + protected String instanceId; + protected String profileId; + protected List defaultParameters; + protected String id; + protected String accountId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String profileId; + private List defaultParameters; + private String id; + private String accountId; + + /** + * Instantiates a new Builder from an existing ReplaceProfileParametersOptions instance. + * + * @param replaceProfileParametersOptions the instance to initialize the Builder with + */ + private Builder(ReplaceProfileParametersOptions replaceProfileParametersOptions) { + this.instanceId = replaceProfileParametersOptions.instanceId; + this.profileId = replaceProfileParametersOptions.profileId; + this.defaultParameters = replaceProfileParametersOptions.defaultParameters; + this.id = replaceProfileParametersOptions.id; + this.accountId = replaceProfileParametersOptions.accountId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param profileId the profileId + * @param defaultParameters the defaultParameters + */ + public Builder(String instanceId, String profileId, List defaultParameters) { + this.instanceId = instanceId; + this.profileId = profileId; + this.defaultParameters = defaultParameters; + } + + /** + * Builds a ReplaceProfileParametersOptions. + * + * @return the new ReplaceProfileParametersOptions instance + */ + public ReplaceProfileParametersOptions build() { + return new ReplaceProfileParametersOptions(this); + } + + /** + * Adds a new element to defaultParameters. + * + * @param defaultParameters the new element to be added + * @return the ReplaceProfileParametersOptions builder + */ + public Builder addDefaultParameters(DefaultParameters defaultParameters) { + com.ibm.cloud.sdk.core.util.Validator.notNull(defaultParameters, + "defaultParameters cannot be null"); + if (this.defaultParameters == null) { + this.defaultParameters = new ArrayList(); + } + this.defaultParameters.add(defaultParameters); + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ReplaceProfileParametersOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the profileId. + * + * @param profileId the profileId + * @return the ReplaceProfileParametersOptions builder + */ + public Builder profileId(String profileId) { + this.profileId = profileId; + return this; + } + + /** + * Set the defaultParameters. + * Existing defaultParameters will be replaced. + * + * @param defaultParameters the defaultParameters + * @return the ReplaceProfileParametersOptions builder + */ + public Builder defaultParameters(List defaultParameters) { + this.defaultParameters = defaultParameters; + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the ReplaceProfileParametersOptions builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ReplaceProfileParametersOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the profileDefaultParametersResponse. + * + * @param profileDefaultParametersResponse the profileDefaultParametersResponse + * @return the ReplaceProfileParametersOptions builder + */ + public Builder profileDefaultParametersResponse(ProfileDefaultParametersResponse profileDefaultParametersResponse) { + this.defaultParameters = profileDefaultParametersResponse.defaultParameters(); + this.id = profileDefaultParametersResponse.id(); + return this; + } + } + + protected ReplaceProfileParametersOptions() { } + + protected ReplaceProfileParametersOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId 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.defaultParameters, + "defaultParameters cannot be null"); + instanceId = builder.instanceId; + profileId = builder.profileId; + defaultParameters = builder.defaultParameters; + id = builder.id; + accountId = builder.accountId; + } + + /** + * New builder. + * + * @return a ReplaceProfileParametersOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the profileId. + * + * The profile ID. + * + * @return the profileId + */ + public String profileId() { + return profileId; + } + + /** + * Gets the defaultParameters. + * + * list of parameters given by default. + * + * @return the defaultParameters + */ + public List defaultParameters() { + return defaultParameters; + } + + /** + * Gets the id. + * + * The ID of the Profile. + * + * @return the id + */ + public String id() { + return id; + } + + /** + * Gets the accountId. + * + * The user account ID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } +} + 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 d5355387..9d037d21 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -22,31 +23,29 @@ */ public class ReplaceRuleOptions extends GenericModel { + protected String instanceId; protected String ruleId; protected String ifMatch; protected String description; - protected TargetPrototype target; + protected RuleTargetPrototype target; protected RequiredConfig requiredConfig; protected String version; protected Import xImport; protected List labels; - protected String xCorrelationId; - protected String xRequestId; /** * Builder. */ public static class Builder { + private String instanceId; private String ruleId; private String ifMatch; private String description; - private TargetPrototype target; + private RuleTargetPrototype target; private RequiredConfig requiredConfig; private String version; private Import xImport; private List labels; - private String xCorrelationId; - private String xRequestId; /** * Instantiates a new Builder from an existing ReplaceRuleOptions instance. @@ -54,6 +53,7 @@ public static class Builder { * @param replaceRuleOptions the instance to initialize the Builder with */ private Builder(ReplaceRuleOptions replaceRuleOptions) { + this.instanceId = replaceRuleOptions.instanceId; this.ruleId = replaceRuleOptions.ruleId; this.ifMatch = replaceRuleOptions.ifMatch; this.description = replaceRuleOptions.description; @@ -62,8 +62,6 @@ private Builder(ReplaceRuleOptions replaceRuleOptions) { this.version = replaceRuleOptions.version; this.xImport = replaceRuleOptions.xImport; this.labels = replaceRuleOptions.labels; - this.xCorrelationId = replaceRuleOptions.xCorrelationId; - this.xRequestId = replaceRuleOptions.xRequestId; } /** @@ -75,13 +73,15 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param ruleId the ruleId * @param ifMatch the ifMatch * @param description the description * @param target the target * @param requiredConfig the requiredConfig */ - public Builder(String ruleId, String ifMatch, String description, TargetPrototype target, RequiredConfig requiredConfig) { + public Builder(String instanceId, String ruleId, String ifMatch, String description, RuleTargetPrototype target, RequiredConfig requiredConfig) { + this.instanceId = instanceId; this.ruleId = ruleId; this.ifMatch = ifMatch; this.description = description; @@ -99,9 +99,9 @@ public ReplaceRuleOptions build() { } /** - * Adds an labels to labels. + * Adds a new element to labels. * - * @param labels the new labels + * @param labels the new element to be added * @return the ReplaceRuleOptions builder */ public Builder addLabels(String labels) { @@ -114,6 +114,17 @@ public Builder addLabels(String labels) { return this; } + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ReplaceRuleOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + /** * Set the ruleId. * @@ -153,7 +164,7 @@ public Builder description(String description) { * @param target the target * @return the ReplaceRuleOptions builder */ - public Builder target(TargetPrototype target) { + public Builder target(RuleTargetPrototype target) { this.target = target; return this; } @@ -202,33 +213,13 @@ public Builder labels(List labels) { this.labels = labels; return this; } - - /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the ReplaceRuleOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. - * - * @param xRequestId the xRequestId - * @return the ReplaceRuleOptions builder - */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; - return this; - } } protected ReplaceRuleOptions() { } protected ReplaceRuleOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.ruleId, "ruleId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.ifMatch, @@ -239,6 +230,7 @@ protected ReplaceRuleOptions(Builder builder) { "target cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.requiredConfig, "requiredConfig cannot be null"); + instanceId = builder.instanceId; ruleId = builder.ruleId; ifMatch = builder.ifMatch; description = builder.description; @@ -247,8 +239,6 @@ protected ReplaceRuleOptions(Builder builder) { version = builder.version; xImport = builder.xImport; labels = builder.labels; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; } /** @@ -260,10 +250,21 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + /** * Gets the ruleId. * - * The ID of the corresponding rule. + * The ID of a rule/assessment. * * @return the ruleId */ @@ -304,14 +305,14 @@ public String description() { * * @return the target */ - public TargetPrototype target() { + public RuleTargetPrototype target() { return target; } /** * Gets the requiredConfig. * - * The required configurations. + * The required configurations for a Rule. * * @return the requiredConfig */ @@ -351,31 +352,5 @@ public Import xImport() { public List labels() { return labels; } - - /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. - * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xRequestId - */ - public String xRequestId() { - return xRequestId; - } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceTargetOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceTargetOptions.java new file mode 100644 index 00000000..132bc425 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceTargetOptions.java @@ -0,0 +1,270 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The replaceTarget options. + */ +public class ReplaceTargetOptions extends GenericModel { + + protected String instanceId; + protected String targetId; + protected String accountId; + protected String trustedProfileId; + protected String name; + protected List credentials; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String targetId; + private String accountId; + private String trustedProfileId; + private String name; + private List credentials; + + /** + * Instantiates a new Builder from an existing ReplaceTargetOptions instance. + * + * @param replaceTargetOptions the instance to initialize the Builder with + */ + private Builder(ReplaceTargetOptions replaceTargetOptions) { + this.instanceId = replaceTargetOptions.instanceId; + this.targetId = replaceTargetOptions.targetId; + this.accountId = replaceTargetOptions.accountId; + this.trustedProfileId = replaceTargetOptions.trustedProfileId; + this.name = replaceTargetOptions.name; + this.credentials = replaceTargetOptions.credentials; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param targetId the targetId + * @param accountId the accountId + * @param trustedProfileId the trustedProfileId + * @param name the name + */ + public Builder(String instanceId, String targetId, String accountId, String trustedProfileId, String name) { + this.instanceId = instanceId; + this.targetId = targetId; + this.accountId = accountId; + this.trustedProfileId = trustedProfileId; + this.name = name; + } + + /** + * Builds a ReplaceTargetOptions. + * + * @return the new ReplaceTargetOptions instance + */ + public ReplaceTargetOptions build() { + return new ReplaceTargetOptions(this); + } + + /** + * Adds a new element to credentials. + * + * @param credentials the new element to be added + * @return the ReplaceTargetOptions builder + */ + public Builder addCredentials(Credential credentials) { + com.ibm.cloud.sdk.core.util.Validator.notNull(credentials, + "credentials cannot be null"); + if (this.credentials == null) { + this.credentials = new ArrayList(); + } + this.credentials.add(credentials); + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the ReplaceTargetOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the targetId. + * + * @param targetId the targetId + * @return the ReplaceTargetOptions builder + */ + public Builder targetId(String targetId) { + this.targetId = targetId; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the ReplaceTargetOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Set the trustedProfileId. + * + * @param trustedProfileId the trustedProfileId + * @return the ReplaceTargetOptions builder + */ + public Builder trustedProfileId(String trustedProfileId) { + this.trustedProfileId = trustedProfileId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ReplaceTargetOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the credentials. + * Existing credentials will be replaced. + * + * @param credentials the credentials + * @return the ReplaceTargetOptions builder + */ + public Builder credentials(List credentials) { + this.credentials = credentials; + return this; + } + } + + protected ReplaceTargetOptions() { } + + protected ReplaceTargetOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.targetId, + "targetId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.accountId, + "accountId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.trustedProfileId, + "trustedProfileId cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + instanceId = builder.instanceId; + targetId = builder.targetId; + accountId = builder.accountId; + trustedProfileId = builder.trustedProfileId; + name = builder.name; + credentials = builder.credentials; + } + + /** + * New builder. + * + * @return a ReplaceTargetOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the targetId. + * + * The target ID. + * + * @return the targetId + */ + public String targetId() { + return targetId; + } + + /** + * Gets the accountId. + * + * The target account ID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } + + /** + * Gets the trustedProfileId. + * + * The trusted profile ID. + * + * @return the trustedProfileId + */ + public String trustedProfileId() { + return trustedProfileId; + } + + /** + * Gets the name. + * + * The target name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the credentials. + * + * Customer credential to access for a specific service to scan. + * + * @return the credentials + */ + public List credentials() { + return credentials; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Report.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Report.java index b9615fd6..eaf93499 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Report.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Report.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,8 +10,11 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; @@ -21,20 +24,29 @@ public class Report extends GenericModel { protected String id; + protected String type; @SerializedName("group_id") protected String groupId; @SerializedName("created_on") protected String createdOn; @SerializedName("scan_time") protected String scanTime; - protected String type; @SerializedName("cos_object") protected String cosObject; @SerializedName("instance_id") protected String instanceId; protected Account account; protected ProfileInfo profile; + protected ScopeID scope; protected Attachment attachment; + @SerializedName("controls_summary") + protected ComplianceStatsWithNonCompliant controlsSummary; + @SerializedName("evaluations_summary") + protected EvalStats evaluationsSummary; + protected Tags tags; + protected List scopes; + @SerializedName("additional_details") + protected AdditionalDetails additionalDetails; protected Report() { } @@ -49,6 +61,17 @@ public String getId() { return id; } + /** + * Gets the type. + * + * The type of the scan. + * + * @return the type + */ + public String getType() { + return type; + } + /** * Gets the groupId. * @@ -82,17 +105,6 @@ public String getScanTime() { return scanTime; } - /** - * Gets the type. - * - * The type of the scan. - * - * @return the type - */ - public String getType() { - return type; - } - /** * Gets the cosObject. * @@ -107,7 +119,7 @@ public String getCosObject() { /** * Gets the instanceId. * - * Instance ID. + * The ID of the Security and Compliance Center instance. * * @return the instanceId */ @@ -137,6 +149,18 @@ public ProfileInfo getProfile() { return profile; } + /** + * Gets the scope. + * + * The scope ID that is associated with a report. Attributes for this object will be blank if the report has multiple + * scopes tied to the report. + * + * @return the scope + */ + public ScopeID getScope() { + return scope; + } + /** * Gets the attachment. * @@ -147,5 +171,60 @@ public ProfileInfo getProfile() { public Attachment getAttachment() { return attachment; } + + /** + * Gets the controlsSummary. + * + * The compliance stats. + * + * @return the controlsSummary + */ + public ComplianceStatsWithNonCompliant getControlsSummary() { + return controlsSummary; + } + + /** + * Gets the evaluationsSummary. + * + * The evaluation stats. + * + * @return the evaluationsSummary + */ + public EvalStats getEvaluationsSummary() { + return evaluationsSummary; + } + + /** + * Gets the tags. + * + * The collection of different types of tags. + * + * @return the tags + */ + public Tags getTags() { + return tags; + } + + /** + * Gets the scopes. + * + * The scopes used in the report. + * + * @return the scopes + */ + public List getScopes() { + return scopes; + } + + /** + * Gets the additionalDetails. + * + * Extended information for a report. + * + * @return the additionalDetails + */ + public AdditionalDetails getAdditionalDetails() { + return additionalDetails; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportCollection.java new file mode 100644 index 00000000..557a8d60 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportCollection.java @@ -0,0 +1,103 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The page of reports. + */ +public class ReportCollection extends GenericModel { + + protected Long limit; + @SerializedName("total_count") + protected Long totalCount; + protected PageHRefFirst first; + protected PageHRefNext next; + @SerializedName("home_account_id") + protected String homeAccountId; + protected List reports; + + protected ReportCollection() { } + + /** + * Gets the limit. + * + * The requested page limit. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the totalCount. + * + * The total number of resources that are in the collection. + * + * @return the totalCount + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Gets the first. + * + * A page reference. + * + * @return the first + */ + public PageHRefFirst getFirst() { + return first; + } + + /** + * Gets the next. + * + * A page reference. + * + * @return the next + */ + public PageHRefNext getNext() { + return next; + } + + /** + * Gets the homeAccountId. + * + * The ID of the home account. + * + * @return the homeAccountId + */ + public String getHomeAccountId() { + return homeAccountId; + } + + /** + * Gets the reports. + * + * The list of reports that are on the page. + * + * @return the reports + */ + public List getReports() { + return reports; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportControls.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportControls.java index c30e286b..9ee261a5 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportControls.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportControls.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -22,103 +23,23 @@ */ public class ReportControls extends GenericModel { - /** - * The allowed values of an aggregated status for controls, specifications, assessments, and resources. - */ - public interface Status { - /** compliant. */ - String COMPLIANT = "compliant"; - /** not_compliant. */ - String NOT_COMPLIANT = "not_compliant"; - /** unable_to_perform. */ - String UNABLE_TO_PERFORM = "unable_to_perform"; - /** user_evaluation_required. */ - String USER_EVALUATION_REQUIRED = "user_evaluation_required"; - } - - protected String status; - @SerializedName("total_count") - protected Long totalCount; - @SerializedName("compliant_count") - protected Long compliantCount; - @SerializedName("not_compliant_count") - protected Long notCompliantCount; - @SerializedName("unable_to_perform_count") - protected Long unableToPerformCount; - @SerializedName("user_evaluation_required_count") - protected Long userEvaluationRequiredCount; - @SerializedName("home_account_id") - protected String homeAccountId; @SerializedName("report_id") protected String reportId; + @SerializedName("home_account_id") + protected String homeAccountId; protected List controls; protected ReportControls() { } /** - * Gets the status. - * - * The allowed values of an aggregated status for controls, specifications, assessments, and resources. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the totalCount. - * - * The total number of checks. - * - * @return the totalCount - */ - public Long getTotalCount() { - return totalCount; - } - - /** - * Gets the compliantCount. - * - * The number of compliant checks. - * - * @return the compliantCount - */ - public Long getCompliantCount() { - return compliantCount; - } - - /** - * Gets the notCompliantCount. - * - * The number of checks that are not compliant. - * - * @return the notCompliantCount - */ - public Long getNotCompliantCount() { - return notCompliantCount; - } - - /** - * Gets the unableToPerformCount. - * - * The number of checks that are unable to perform. - * - * @return the unableToPerformCount - */ - public Long getUnableToPerformCount() { - return unableToPerformCount; - } - - /** - * Gets the userEvaluationRequiredCount. + * Gets the reportId. * - * The number of checks that require a user evaluation. + * The ID of the report. * - * @return the userEvaluationRequiredCount + * @return the reportId */ - public Long getUserEvaluationRequiredCount() { - return userEvaluationRequiredCount; + public String getReportId() { + return reportId; } /** @@ -132,17 +53,6 @@ public String getHomeAccountId() { return homeAccountId; } - /** - * Gets the reportId. - * - * The ID of the report. - * - * @return the reportId - */ - public String getReportId() { - return reportId; - } - /** * Gets the controls. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportEvaluationsPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportEvaluationsPager.java index 50ddfa44..ba69c57d 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportEvaluationsPager.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportEvaluationsPager.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,9 +10,9 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.util.UrlHelper; import com.ibm.cloud.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; import java.util.ArrayList; import java.util.List; @@ -83,10 +83,7 @@ public List getNext() { String next = null; if (result.getNext() != null) { - String queryParam = UrlHelper.getQueryParam(result.getNext().getHref(), "start"); - if (queryParam != null) { - next = queryParam; - } + next = result.getNext().getStart(); } this.pageContext.setNext(next); if (next == null) { diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportLatest.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportLatest.java index f7a07500..afed6df0 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportLatest.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportLatest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportResourcesPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportResourcesPager.java index a9a95128..72f25307 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportResourcesPager.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportResourcesPager.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,9 +10,9 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.util.UrlHelper; import com.ibm.cloud.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; import java.util.ArrayList; import java.util.List; @@ -83,10 +83,7 @@ public List getNext() { String next = null; if (result.getNext() != null) { - String queryParam = UrlHelper.getQueryParam(result.getNext().getHref(), "start"); - if (queryParam != null) { - next = queryParam; - } + next = result.getNext().getStart(); } this.pageContext.setNext(next); if (next == null) { diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportScope.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportScope.java new file mode 100644 index 00000000..ebe4bf86 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportScope.java @@ -0,0 +1,74 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 scopes used in the report. + */ +public class ReportScope extends GenericModel { + + protected String id; + protected String name; + protected String href; + protected String environment; + + protected ReportScope() { } + + /** + * Gets the id. + * + * The ID of the scope used. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the name. + * + * The name of the scope used. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the href. + * + * The url to a report concerning the specified scope. + * + * @return the href + */ + public String getHref() { + return href; + } + + /** + * Gets the environment. + * + * The cloud provider that the scope is targeting. + * + * @return the environment + */ + public String getEnvironment() { + return environment; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportSummary.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportSummary.java index 75aa8af3..344be5d2 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportSummary.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportSummary.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; @@ -22,12 +23,12 @@ public class ReportSummary extends GenericModel { @SerializedName("report_id") protected String reportId; - @SerializedName("isntance_id") - protected String isntanceId; + @SerializedName("instance_id") + protected String instanceId; protected Account account; protected ComplianceScore score; - protected ComplianceStats controls; protected EvalStats evaluations; + protected ComplianceStats controls; protected ResourceSummary resources; protected ReportSummary() { } @@ -44,14 +45,14 @@ public String getReportId() { } /** - * Gets the isntanceId. + * Gets the instanceId. * * Instance ID. * - * @return the isntanceId + * @return the instanceId */ - public String getIsntanceId() { - return isntanceId; + public String getInstanceId() { + return instanceId; } /** @@ -77,25 +78,25 @@ public ComplianceScore getScore() { } /** - * Gets the controls. + * Gets the evaluations. * - * The compliance stats. + * The evaluation stats. * - * @return the controls + * @return the evaluations */ - public ComplianceStats getControls() { - return controls; + public EvalStats getEvaluations() { + return evaluations; } /** - * Gets the evaluations. + * Gets the controls. * - * The evaluation stats. + * The compliance stats. * - * @return the evaluations + * @return the controls */ - public EvalStats getEvaluations() { - return evaluations; + public ComplianceStats getControls() { + return controls; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTags.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTags.java index 780a6c39..f0b51b4f 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTags.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTags.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationDataPoint.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationDataPoint.java index ca86db49..4fcbdff3 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationDataPoint.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationDataPoint.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; @@ -26,7 +27,8 @@ public class ReportViolationDataPoint extends GenericModel { protected String reportGroupId; @SerializedName("scan_time") protected String scanTime; - protected ComplianceStats controls; + @SerializedName("controls_summary") + protected ComplianceStats controlsSummary; protected ReportViolationDataPoint() { } @@ -64,14 +66,14 @@ public String getScanTime() { } /** - * Gets the controls. + * Gets the controlsSummary. * * The compliance stats. * - * @return the controls + * @return the controlsSummary */ - public ComplianceStats getControls() { - return controls; + public ComplianceStats getControlsSummary() { + return controlsSummary; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationsDrift.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationsDrift.java index 821d1556..718f4a60 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationsDrift.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationsDrift.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -24,8 +25,8 @@ public class ReportViolationsDrift extends GenericModel { @SerializedName("home_account_id") protected String homeAccountId; - @SerializedName("report_id") - protected String reportId; + @SerializedName("report_group_id") + protected String reportGroupId; @SerializedName("data_points") protected List dataPoints; @@ -43,14 +44,14 @@ public String getHomeAccountId() { } /** - * Gets the reportId. + * Gets the reportGroupId. * - * The ID of the report. + * The ID of the report group. * - * @return the reportId + * @return the reportGroupId */ - public String getReportId() { - return reportId; + public String getReportGroupId() { + return reportGroupId; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportsPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportsPager.java index bfa73575..74ed6409 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportsPager.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportsPager.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,9 +10,9 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.util.UrlHelper; import com.ibm.cloud.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; import java.util.ArrayList; import java.util.List; @@ -79,14 +79,11 @@ public List getNext() { } this.options = builder.build(); - ReportPage result = client.listReports(options).execute().getResult(); + ReportCollection result = client.listReports(options).execute().getResult(); String next = null; if (result.getNext() != null) { - String queryParam = UrlHelper.getQueryParam(result.getNext().getHref(), "start"); - if (queryParam != null) { - next = queryParam; - } + next = result.getNext().getStart(); } this.pageContext.setNext(next); if (next == null) { 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 fd4440a6..c79ff81b 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,19 +10,21 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; +import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The required configurations. + * The required configurations for a Rule. * * Classes which extend this class: - * - RequiredConfigAnd - * - RequiredConfigOr - * - RequiredConfigRequiredConfigBase + * - RequiredConfigConditionBase + * - RequiredConfigConditionList + * - RequiredConfigConditionSubRule */ public class RequiredConfig extends GenericModel { @@ -79,11 +81,17 @@ public interface Operator { } protected String description; - protected List and; - protected List or; protected String property; protected String operator; protected Object value; + protected List or; + protected List and; + protected SubRule any; + @SerializedName("any_ifexists") + protected SubRule anyIfexists; + protected SubRule all; + @SerializedName("all_ifexists") + protected SubRule allIfexists; protected RequiredConfig() { } @@ -99,58 +107,102 @@ public String description() { } /** - * Gets the and. + * Gets the property. * - * The `AND` required configurations. + * The property. * - * @return the and + * @return the property */ - public List and() { - return and; + public String property() { + return property; + } + + /** + * Gets the operator. + * + * The operator. + * + * @return the operator + */ + public String operator() { + return operator; + } + + /** + * Gets the value. + * + * The value can be of any type. + * + * @return the value + */ + public Object value() { + return value; } /** * Gets the or. * - * The `OR` required configurations. + * A list of required configurations where one item should evaluate to true. * * @return the or */ - public List or() { + public List or() { return or; } /** - * Gets the property. + * Gets the and. * - * The property. + * A list of required configurations where all items should evaluate to true. * - * @return the property + * @return the and */ - public String property() { - return property; + public List and() { + return and; } /** - * Gets the operator. + * Gets the any. * - * The operator. + * A rule within a rule used in the requiredConfig. * - * @return the operator + * @return the any */ - public String operator() { - return operator; + public SubRule any() { + return any; } /** - * Gets the value. + * Gets the anyIfexists. * - * Schema for any JSON type. + * A rule within a rule used in the requiredConfig. * - * @return the value + * @return the anyIfexists */ - public Object value() { - return value; + public SubRule anyIfexists() { + return anyIfexists; + } + + /** + * Gets the all. + * + * A rule within a rule used in the requiredConfig. + * + * @return the all + */ + public SubRule all() { + return all; + } + + /** + * Gets the allIfexists. + * + * A rule within a rule used in the requiredConfig. + * + * @return the allIfexists + */ + public SubRule allIfexists() { + return allIfexists; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionBase.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionBase.java new file mode 100644 index 00000000..cc023f5a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionBase.java @@ -0,0 +1,188 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 required configuration base object. + */ +public class RequiredConfigConditionBase extends RequiredConfig { + + /** + * 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"; + } + + + /** + * Builder. + */ + public static class Builder { + private String description; + private String property; + private String operator; + private Object value; + + /** + * Instantiates a new Builder from an existing RequiredConfigConditionBase instance. + * + * @param requiredConfigConditionBase the instance to initialize the Builder with + */ + public Builder(RequiredConfig requiredConfigConditionBase) { + this.description = requiredConfigConditionBase.description; + this.property = requiredConfigConditionBase.property; + this.operator = requiredConfigConditionBase.operator; + this.value = requiredConfigConditionBase.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 RequiredConfigConditionBase. + * + * @return the new RequiredConfigConditionBase instance + */ + public RequiredConfigConditionBase build() { + return new RequiredConfigConditionBase(this); + } + + /** + * Set the description. + * + * @param description the description + * @return the RequiredConfigConditionBase builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the property. + * + * @param property the property + * @return the RequiredConfigConditionBase builder + */ + public Builder property(String property) { + this.property = property; + return this; + } + + /** + * Set the operator. + * + * @param operator the operator + * @return the RequiredConfigConditionBase builder + */ + public Builder operator(String operator) { + this.operator = operator; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the RequiredConfigConditionBase builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected RequiredConfigConditionBase() { } + + protected RequiredConfigConditionBase(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 RequiredConfigConditionBase 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/RequiredConfigConditionList.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionList.java new file mode 100644 index 00000000..6d22de18 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionList.java @@ -0,0 +1,28 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A list of required configurations. + * + * Classes which extend this class: + * - RequiredConfigConditionListConditionListConditionOr + * - RequiredConfigConditionListConditionListConditionAnd + */ +public class RequiredConfigConditionList extends RequiredConfig { + + + protected RequiredConfigConditionList() { } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionAnd.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionAnd.java new file mode 100644 index 00000000..e314090a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionAnd.java @@ -0,0 +1,113 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * RequiredConfigConditionListConditionListConditionAnd. + */ +public class RequiredConfigConditionListConditionListConditionAnd extends RequiredConfigConditionList { + + + /** + * Builder. + */ + public static class Builder { + private String description; + private List and; + + /** + * Instantiates a new Builder from an existing RequiredConfigConditionListConditionListConditionAnd instance. + * + * @param requiredConfigConditionListConditionListConditionAnd the instance to initialize the Builder with + */ + public Builder(RequiredConfigConditionList requiredConfigConditionListConditionListConditionAnd) { + this.description = requiredConfigConditionListConditionListConditionAnd.description; + this.and = requiredConfigConditionListConditionListConditionAnd.and; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a RequiredConfigConditionListConditionListConditionAnd. + * + * @return the new RequiredConfigConditionListConditionListConditionAnd instance + */ + public RequiredConfigConditionListConditionListConditionAnd build() { + return new RequiredConfigConditionListConditionListConditionAnd(this); + } + + /** + * Adds a new element to and. + * + * @param and the new element to be added + * @return the RequiredConfigConditionListConditionListConditionAnd builder + */ + public Builder addAnd(ConditionItem and) { + com.ibm.cloud.sdk.core.util.Validator.notNull(and, + "and cannot be null"); + if (this.and == null) { + this.and = new ArrayList(); + } + this.and.add(and); + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RequiredConfigConditionListConditionListConditionAnd builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the and. + * Existing and will be replaced. + * + * @param and the and + * @return the RequiredConfigConditionListConditionListConditionAnd builder + */ + public Builder and(List and) { + this.and = and; + return this; + } + } + + protected RequiredConfigConditionListConditionListConditionAnd() { } + + protected RequiredConfigConditionListConditionListConditionAnd(Builder builder) { + description = builder.description; + and = builder.and; + } + + /** + * New builder. + * + * @return a RequiredConfigConditionListConditionListConditionAnd 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/RequiredConfigConditionListConditionListConditionOr.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionOr.java new file mode 100644 index 00000000..640b3fff --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionOr.java @@ -0,0 +1,113 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * The `OR` required configurations. + */ +public class RequiredConfigConditionListConditionListConditionOr extends RequiredConfigConditionList { + + + /** + * Builder. + */ + public static class Builder { + private String description; + private List or; + + /** + * Instantiates a new Builder from an existing RequiredConfigConditionListConditionListConditionOr instance. + * + * @param requiredConfigConditionListConditionListConditionOr the instance to initialize the Builder with + */ + public Builder(RequiredConfigConditionList requiredConfigConditionListConditionListConditionOr) { + this.description = requiredConfigConditionListConditionListConditionOr.description; + this.or = requiredConfigConditionListConditionListConditionOr.or; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a RequiredConfigConditionListConditionListConditionOr. + * + * @return the new RequiredConfigConditionListConditionListConditionOr instance + */ + public RequiredConfigConditionListConditionListConditionOr build() { + return new RequiredConfigConditionListConditionListConditionOr(this); + } + + /** + * Adds a new element to or. + * + * @param or the new element to be added + * @return the RequiredConfigConditionListConditionListConditionOr builder + */ + public Builder addOr(ConditionItem or) { + com.ibm.cloud.sdk.core.util.Validator.notNull(or, + "or cannot be null"); + if (this.or == null) { + this.or = new ArrayList(); + } + this.or.add(or); + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RequiredConfigConditionListConditionListConditionOr builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the or. + * Existing or will be replaced. + * + * @param or the or + * @return the RequiredConfigConditionListConditionListConditionOr builder + */ + public Builder or(List or) { + this.or = or; + return this; + } + } + + protected RequiredConfigConditionListConditionListConditionOr() { } + + protected RequiredConfigConditionListConditionListConditionOr(Builder builder) { + description = builder.description; + or = builder.or; + } + + /** + * New builder. + * + * @return a RequiredConfigConditionListConditionListConditionOr 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/RequiredConfigConditionSubRule.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRule.java new file mode 100644 index 00000000..e1d61bf9 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRule.java @@ -0,0 +1,30 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * RequiredConfigConditionSubRule. + * + * Classes which extend this class: + * - RequiredConfigConditionSubRuleConditionSubRuleConditionAny + * - RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf + * - RequiredConfigConditionSubRuleConditionSubRuleConditionAll + * - RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf + */ +public class RequiredConfigConditionSubRule extends RequiredConfig { + + + protected RequiredConfigConditionSubRule() { } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAll.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAll.java new file mode 100644 index 00000000..26b3f9dd --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAll.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A subrule using the 'all' operator. + */ +public class RequiredConfigConditionSubRuleConditionSubRuleConditionAll extends RequiredConfigConditionSubRule { + + + /** + * Builder. + */ + public static class Builder { + private SubRule all; + + /** + * Instantiates a new Builder from an existing RequiredConfigConditionSubRuleConditionSubRuleConditionAll instance. + * + * @param requiredConfigConditionSubRuleConditionSubRuleConditionAll the instance to initialize the Builder with + */ + public Builder(RequiredConfigConditionSubRule requiredConfigConditionSubRuleConditionSubRuleConditionAll) { + this.all = requiredConfigConditionSubRuleConditionSubRuleConditionAll.all; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a RequiredConfigConditionSubRuleConditionSubRuleConditionAll. + * + * @return the new RequiredConfigConditionSubRuleConditionSubRuleConditionAll instance + */ + public RequiredConfigConditionSubRuleConditionSubRuleConditionAll build() { + return new RequiredConfigConditionSubRuleConditionSubRuleConditionAll(this); + } + + /** + * Set the all. + * + * @param all the all + * @return the RequiredConfigConditionSubRuleConditionSubRuleConditionAll builder + */ + public Builder all(SubRule all) { + this.all = all; + return this; + } + } + + protected RequiredConfigConditionSubRuleConditionSubRuleConditionAll() { } + + protected RequiredConfigConditionSubRuleConditionSubRuleConditionAll(Builder builder) { + all = builder.all; + } + + /** + * New builder. + * + * @return a RequiredConfigConditionSubRuleConditionSubRuleConditionAll 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/RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf.java new file mode 100644 index 00000000..02ed81a0 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A subrule using the 'all_ifexists' operator. + */ +public class RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf extends RequiredConfigConditionSubRule { + + + /** + * Builder. + */ + public static class Builder { + private SubRule allIfexists; + + /** + * Instantiates a new Builder from an existing RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf instance. + * + * @param requiredConfigConditionSubRuleConditionSubRuleConditionAllIf the instance to initialize the Builder with + */ + public Builder(RequiredConfigConditionSubRule requiredConfigConditionSubRuleConditionSubRuleConditionAllIf) { + this.allIfexists = requiredConfigConditionSubRuleConditionSubRuleConditionAllIf.allIfexists; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf. + * + * @return the new RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf instance + */ + public RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf build() { + return new RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf(this); + } + + /** + * Set the allIfexists. + * + * @param allIfexists the allIfexists + * @return the RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf builder + */ + public Builder allIfexists(SubRule allIfexists) { + this.allIfexists = allIfexists; + return this; + } + } + + protected RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf() { } + + protected RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf(Builder builder) { + allIfexists = builder.allIfexists; + } + + /** + * New builder. + * + * @return a RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf 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/RequiredConfigConditionSubRuleConditionSubRuleConditionAny.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAny.java new file mode 100644 index 00000000..621ccd95 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAny.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A subrule using the 'any' operator. + */ +public class RequiredConfigConditionSubRuleConditionSubRuleConditionAny extends RequiredConfigConditionSubRule { + + + /** + * Builder. + */ + public static class Builder { + private SubRule any; + + /** + * Instantiates a new Builder from an existing RequiredConfigConditionSubRuleConditionSubRuleConditionAny instance. + * + * @param requiredConfigConditionSubRuleConditionSubRuleConditionAny the instance to initialize the Builder with + */ + public Builder(RequiredConfigConditionSubRule requiredConfigConditionSubRuleConditionSubRuleConditionAny) { + this.any = requiredConfigConditionSubRuleConditionSubRuleConditionAny.any; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a RequiredConfigConditionSubRuleConditionSubRuleConditionAny. + * + * @return the new RequiredConfigConditionSubRuleConditionSubRuleConditionAny instance + */ + public RequiredConfigConditionSubRuleConditionSubRuleConditionAny build() { + return new RequiredConfigConditionSubRuleConditionSubRuleConditionAny(this); + } + + /** + * Set the any. + * + * @param any the any + * @return the RequiredConfigConditionSubRuleConditionSubRuleConditionAny builder + */ + public Builder any(SubRule any) { + this.any = any; + return this; + } + } + + protected RequiredConfigConditionSubRuleConditionSubRuleConditionAny() { } + + protected RequiredConfigConditionSubRuleConditionSubRuleConditionAny(Builder builder) { + any = builder.any; + } + + /** + * New builder. + * + * @return a RequiredConfigConditionSubRuleConditionSubRuleConditionAny 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/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf.java new file mode 100644 index 00000000..7f8eb68b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf.java @@ -0,0 +1,79 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * A subrule using the 'any_ifexists' operator. + */ +public class RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf extends RequiredConfigConditionSubRule { + + + /** + * Builder. + */ + public static class Builder { + private SubRule anyIfexists; + + /** + * Instantiates a new Builder from an existing RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf instance. + * + * @param requiredConfigConditionSubRuleConditionSubRuleConditionAnyIf the instance to initialize the Builder with + */ + public Builder(RequiredConfigConditionSubRule requiredConfigConditionSubRuleConditionSubRuleConditionAnyIf) { + this.anyIfexists = requiredConfigConditionSubRuleConditionSubRuleConditionAnyIf.anyIfexists; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf. + * + * @return the new RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf instance + */ + public RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf build() { + return new RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf(this); + } + + /** + * Set the anyIfexists. + * + * @param anyIfexists the anyIfexists + * @return the RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf builder + */ + public Builder anyIfexists(SubRule anyIfexists) { + this.anyIfexists = anyIfexists; + return this; + } + } + + protected RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf() { } + + protected RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf(Builder builder) { + anyIfexists = builder.anyIfexists; + } + + /** + * New builder. + * + * @return a RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf 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/Resource.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Resource.java index f17751a2..3c6dca15 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Resource.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Resource.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; @@ -32,17 +33,24 @@ public interface Status { String UNABLE_TO_PERFORM = "unable_to_perform"; /** user_evaluation_required. */ String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; } @SerializedName("report_id") protected String reportId; + @SerializedName("home_account_id") + protected String homeAccountId; protected String id; @SerializedName("resource_name") protected String resourceName; + protected Account account; @SerializedName("component_id") protected String componentId; + @SerializedName("component_name") + protected String componentName; protected String environment; - protected Account account; + protected Tags tags; protected String status; @SerializedName("total_count") protected Long totalCount; @@ -52,11 +60,321 @@ public interface Status { protected Long failureCount; @SerializedName("error_count") protected Long errorCount; + @SerializedName("skipped_count") + protected Long skippedCount; @SerializedName("completed_count") protected Long completedCount; + @SerializedName("service_name") + protected String serviceName; + @SerializedName("instance_crn") + protected String instanceCrn; + + /** + * Builder. + */ + public static class Builder { + private String reportId; + private String homeAccountId; + private String id; + private String resourceName; + private Account account; + private String componentId; + private String componentName; + private String environment; + private Tags tags; + private String status; + private Long totalCount; + private Long passCount; + private Long failureCount; + private Long errorCount; + private Long skippedCount; + private Long completedCount; + private String serviceName; + private String instanceCrn; + + /** + * Instantiates a new Builder from an existing Resource instance. + * + * @param resource the instance to initialize the Builder with + */ + private Builder(Resource resource) { + this.reportId = resource.reportId; + this.homeAccountId = resource.homeAccountId; + this.id = resource.id; + this.resourceName = resource.resourceName; + this.account = resource.account; + this.componentId = resource.componentId; + this.componentName = resource.componentName; + this.environment = resource.environment; + this.tags = resource.tags; + this.status = resource.status; + this.totalCount = resource.totalCount; + this.passCount = resource.passCount; + this.failureCount = resource.failureCount; + this.errorCount = resource.errorCount; + this.skippedCount = resource.skippedCount; + this.completedCount = resource.completedCount; + this.serviceName = resource.serviceName; + this.instanceCrn = resource.instanceCrn; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param status the status + */ + public Builder(String status) { + this.status = status; + } + + /** + * Builds a Resource. + * + * @return the new Resource instance + */ + public Resource build() { + return new Resource(this); + } + + /** + * Set the reportId. + * + * @param reportId the reportId + * @return the Resource builder + */ + public Builder reportId(String reportId) { + this.reportId = reportId; + return this; + } + + /** + * Set the homeAccountId. + * + * @param homeAccountId the homeAccountId + * @return the Resource builder + */ + public Builder homeAccountId(String homeAccountId) { + this.homeAccountId = homeAccountId; + return this; + } + + /** + * Set the id. + * + * @param id the id + * @return the Resource builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the resourceName. + * + * @param resourceName the resourceName + * @return the Resource builder + */ + public Builder resourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Set the account. + * + * @param account the account + * @return the Resource builder + */ + public Builder account(Account account) { + this.account = account; + return this; + } + + /** + * Set the componentId. + * + * @param componentId the componentId + * @return the Resource builder + */ + public Builder componentId(String componentId) { + this.componentId = componentId; + return this; + } + + /** + * Set the componentName. + * + * @param componentName the componentName + * @return the Resource builder + */ + public Builder componentName(String componentName) { + this.componentName = componentName; + return this; + } + + /** + * Set the environment. + * + * @param environment the environment + * @return the Resource builder + */ + public Builder environment(String environment) { + this.environment = environment; + return this; + } + + /** + * Set the tags. + * + * @param tags the tags + * @return the Resource builder + */ + public Builder tags(Tags tags) { + this.tags = tags; + return this; + } + + /** + * Set the status. + * + * @param status the status + * @return the Resource builder + */ + public Builder status(String status) { + this.status = status; + return this; + } + + /** + * Set the totalCount. + * + * @param totalCount the totalCount + * @return the Resource builder + */ + public Builder totalCount(long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * Set the passCount. + * + * @param passCount the passCount + * @return the Resource builder + */ + public Builder passCount(long passCount) { + this.passCount = passCount; + return this; + } + + /** + * Set the failureCount. + * + * @param failureCount the failureCount + * @return the Resource builder + */ + public Builder failureCount(long failureCount) { + this.failureCount = failureCount; + return this; + } + + /** + * Set the errorCount. + * + * @param errorCount the errorCount + * @return the Resource builder + */ + public Builder errorCount(long errorCount) { + this.errorCount = errorCount; + return this; + } + + /** + * Set the skippedCount. + * + * @param skippedCount the skippedCount + * @return the Resource builder + */ + public Builder skippedCount(long skippedCount) { + this.skippedCount = skippedCount; + return this; + } + + /** + * Set the completedCount. + * + * @param completedCount the completedCount + * @return the Resource builder + */ + public Builder completedCount(long completedCount) { + this.completedCount = completedCount; + return this; + } + + /** + * Set the serviceName. + * + * @param serviceName the serviceName + * @return the Resource builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the instanceCrn. + * + * @param instanceCrn the instanceCrn + * @return the Resource builder + */ + public Builder instanceCrn(String instanceCrn) { + this.instanceCrn = instanceCrn; + return this; + } + } protected Resource() { } + protected Resource(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.status, + "status cannot be null"); + reportId = builder.reportId; + homeAccountId = builder.homeAccountId; + id = builder.id; + resourceName = builder.resourceName; + account = builder.account; + componentId = builder.componentId; + componentName = builder.componentName; + environment = builder.environment; + tags = builder.tags; + status = builder.status; + totalCount = builder.totalCount; + passCount = builder.passCount; + failureCount = builder.failureCount; + errorCount = builder.errorCount; + skippedCount = builder.skippedCount; + completedCount = builder.completedCount; + serviceName = builder.serviceName; + instanceCrn = builder.instanceCrn; + } + + /** + * New builder. + * + * @return a Resource builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the reportId. * @@ -64,10 +382,21 @@ protected Resource() { } * * @return the reportId */ - public String getReportId() { + public String reportId() { return reportId; } + /** + * Gets the homeAccountId. + * + * The ID of the home account. + * + * @return the homeAccountId + */ + public String homeAccountId() { + return homeAccountId; + } + /** * Gets the id. * @@ -75,7 +404,7 @@ public String getReportId() { * * @return the id */ - public String getId() { + public String id() { return id; } @@ -86,10 +415,21 @@ public String getId() { * * @return the resourceName */ - public String getResourceName() { + public String resourceName() { return resourceName; } + /** + * Gets the account. + * + * The account that is associated with a report. + * + * @return the account + */ + public Account account() { + return account; + } + /** * Gets the componentId. * @@ -97,10 +437,21 @@ public String getResourceName() { * * @return the componentId */ - public String getComponentId() { + public String componentId() { return componentId; } + /** + * Gets the componentName. + * + * The name of the component. + * + * @return the componentName + */ + public String componentName() { + return componentName; + } + /** * Gets the environment. * @@ -108,19 +459,19 @@ public String getComponentId() { * * @return the environment */ - public String getEnvironment() { + public String environment() { return environment; } /** - * Gets the account. + * Gets the tags. * - * The account that is associated with a report. + * The collection of different types of tags. * - * @return the account + * @return the tags */ - public Account getAccount() { - return account; + public Tags tags() { + return tags; } /** @@ -130,7 +481,7 @@ public Account getAccount() { * * @return the status */ - public String getStatus() { + public String status() { return status; } @@ -141,7 +492,7 @@ public String getStatus() { * * @return the totalCount */ - public Long getTotalCount() { + public Long totalCount() { return totalCount; } @@ -152,7 +503,7 @@ public Long getTotalCount() { * * @return the passCount */ - public Long getPassCount() { + public Long passCount() { return passCount; } @@ -163,7 +514,7 @@ public Long getPassCount() { * * @return the failureCount */ - public Long getFailureCount() { + public Long failureCount() { return failureCount; } @@ -174,10 +525,21 @@ public Long getFailureCount() { * * @return the errorCount */ - public Long getErrorCount() { + public Long errorCount() { return errorCount; } + /** + * Gets the skippedCount. + * + * The number of assessments with no corresponding evaluations. + * + * @return the skippedCount + */ + public Long skippedCount() { + return skippedCount; + } + /** * Gets the completedCount. * @@ -185,8 +547,30 @@ public Long getErrorCount() { * * @return the completedCount */ - public Long getCompletedCount() { + public Long completedCount() { return completedCount; } + + /** + * Gets the serviceName. + * + * The name of the service. + * + * @return the serviceName + */ + public String serviceName() { + return serviceName; + } + + /** + * Gets the instanceCrn. + * + * The instance CRN. + * + * @return the instanceCrn + */ + public String instanceCrn() { + return instanceCrn; + } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourcePage.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourcePage.java index c5a90175..a1cd4441 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourcePage.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourcePage.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -22,35 +23,23 @@ */ public class ResourcePage extends GenericModel { + protected Long limit; @SerializedName("total_count") protected Long totalCount; - protected Long limit; - protected String start; - protected PageHRef first; - protected PageHRef next; - @SerializedName("home_account_id") - protected String homeAccountId; + protected PageHRefFirst first; + protected PageHRefNext next; @SerializedName("report_id") protected String reportId; + @SerializedName("home_account_id") + protected String homeAccountId; protected List resources; protected ResourcePage() { } - /** - * Gets the totalCount. - * - * The total number of resources that are in the collection. - * - * @return the totalCount - */ - public Long getTotalCount() { - return totalCount; - } - /** * Gets the limit. * - * The requested page limi.t. + * The requested page limit. * * @return the limit */ @@ -59,58 +48,58 @@ public Long getLimit() { } /** - * Gets the start. + * Gets the totalCount. * - * The token of the next page, when it's present. + * The total number of resources that are in the collection. * - * @return the start + * @return the totalCount */ - public String getStart() { - return start; + public Long getTotalCount() { + return totalCount; } /** * Gets the first. * - * The page reference. + * A page reference. * * @return the first */ - public PageHRef getFirst() { + public PageHRefFirst getFirst() { return first; } /** * Gets the next. * - * The page reference. + * A page reference. * * @return the next */ - public PageHRef getNext() { + public PageHRefNext getNext() { return next; } /** - * Gets the homeAccountId. + * Gets the reportId. * - * The ID of the home account. + * The ID of the report. * - * @return the homeAccountId + * @return the reportId */ - public String getHomeAccountId() { - return homeAccountId; + public String getReportId() { + return reportId; } /** - * Gets the reportId. + * Gets the homeAccountId. * - * The ID of the report. + * The ID of the home account. * - * @return the reportId + * @return the homeAccountId */ - public String getReportId() { - return reportId; + public String getHomeAccountId() { + return homeAccountId; } /** diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummary.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummary.java index 9778dd23..1edb3907 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummary.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummary.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; @@ -34,6 +35,8 @@ public interface Status { String UNABLE_TO_PERFORM = "unable_to_perform"; /** user_evaluation_required. */ String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; } protected String status; @@ -47,6 +50,8 @@ public interface Status { protected Long unableToPerformCount; @SerializedName("user_evaluation_required_count") protected Long userEvaluationRequiredCount; + @SerializedName("not_applicable_count") + protected Long notApplicableCount; @SerializedName("top_failed") protected List topFailed; @@ -118,6 +123,17 @@ public Long getUserEvaluationRequiredCount() { return userEvaluationRequiredCount; } + /** + * Gets the notApplicableCount. + * + * The number of not applicable (with no evaluations) checks. + * + * @return the notApplicableCount + */ + public Long getNotApplicableCount() { + return notApplicableCount; + } + /** * Gets the topFailed. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryItem.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryItem.java index ea26550b..ad3d2699 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryItem.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryItem.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; @@ -32,13 +33,17 @@ public interface Status { String UNABLE_TO_PERFORM = "unable_to_perform"; /** user_evaluation_required. */ String USER_EVALUATION_REQUIRED = "user_evaluation_required"; + /** not_applicable. */ + String NOT_APPLICABLE = "not_applicable"; } - protected String name; protected String id; + protected String name; + protected String account; protected String service; + @SerializedName("service_display_name") + protected String serviceDisplayName; protected Tags tags; - protected String account; protected String status; @SerializedName("total_count") protected Long totalCount; @@ -48,11 +53,24 @@ public interface Status { protected Long failureCount; @SerializedName("error_count") protected Long errorCount; + @SerializedName("skipped_count") + protected Long skippedCount; @SerializedName("completed_count") protected Long completedCount; protected ResourceSummaryItem() { } + /** + * Gets the id. + * + * The resource ID. + * + * @return the id + */ + public String getId() { + return id; + } + /** * Gets the name. * @@ -65,14 +83,14 @@ public String getName() { } /** - * Gets the id. + * Gets the account. * - * The resource ID. + * The account that owns the resource. * - * @return the id + * @return the account */ - public String getId() { - return id; + public String getAccount() { + return account; } /** @@ -87,25 +105,25 @@ public String getService() { } /** - * Gets the tags. + * Gets the serviceDisplayName. * - * The collection of different types of tags. + * The services display name that is managing the resource. * - * @return the tags + * @return the serviceDisplayName */ - public Tags getTags() { - return tags; + public String getServiceDisplayName() { + return serviceDisplayName; } /** - * Gets the account. + * Gets the tags. * - * The account that owns the resource. + * The collection of different types of tags. * - * @return the account + * @return the tags */ - public String getAccount() { - return account; + public Tags getTags() { + return tags; } /** @@ -163,6 +181,17 @@ public Long getErrorCount() { return errorCount; } + /** + * Gets the skippedCount. + * + * The number of assessments with no corresponding evaluations. + * + * @return the skippedCount + */ + public Long getSkippedCount() { + return skippedCount; + } + /** * Gets the completedCount. * diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Rule.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Rule.java index 7e6f852c..dea0925b 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Rule.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Rule.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; @@ -49,7 +50,7 @@ public interface Type { protected String version; @SerializedName("import") protected Import xImport; - protected Target target; + protected RuleTarget target; @SerializedName("required_config") protected RequiredConfig requiredConfig; protected List labels; @@ -173,14 +174,14 @@ public Import getXImport() { * * @return the target */ - public Target getTarget() { + public RuleTarget getTarget() { return target; } /** * Gets the requiredConfig. * - * The required configurations. + * The required configurations for a Rule. * * @return the requiredConfig */ diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleCollection.java new file mode 100644 index 00000000..1f8d7372 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleCollection.java @@ -0,0 +1,91 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The page of rules. + */ +public class RuleCollection extends GenericModel { + + protected Long limit; + @SerializedName("total_count") + protected Long totalCount; + protected PageHRefFirst first; + protected PageHRefNext next; + protected List rules; + + protected RuleCollection() { } + + /** + * Gets the limit. + * + * The requested page limit. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the totalCount. + * + * The total number of resources that are in the collection. + * + * @return the totalCount + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Gets the first. + * + * A page reference. + * + * @return the first + */ + public PageHRefFirst getFirst() { + return first; + } + + /** + * Gets the next. + * + * A page reference. + * + * @return the next + */ + public PageHRefNext getNext() { + return next; + } + + /** + * Gets the rules. + * + * The collection of rules that correspond to an account instance. Maximum of 100/500 custom rules per + * stand-alone/enterprise account. + * + * @return the rules + */ + public List getRules() { + return rules; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleInfo.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleInfo.java index 88324a3b..88eaa1f2 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleInfo.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleInfo.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,8 +10,10 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; import java.util.List; import com.google.gson.annotations.SerializedName; @@ -29,11 +31,11 @@ public class RuleInfo extends GenericModel { @SerializedName("account_id") protected String accountId; @SerializedName("created_on") - protected String createdOn; + protected Date createdOn; @SerializedName("created_by") protected String createdBy; @SerializedName("updated_on") - protected String updatedOn; + protected Date updatedOn; @SerializedName("updated_by") protected String updatedBy; protected List labels; @@ -102,7 +104,7 @@ public String getAccountId() { * * @return the createdOn */ - public String getCreatedOn() { + public Date getCreatedOn() { return createdOn; } @@ -124,7 +126,7 @@ public String getCreatedBy() { * * @return the updatedOn */ - public String getUpdatedOn() { + public Date getUpdatedOn() { return updatedOn; } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleParameter.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleParameter.java new file mode 100644 index 00000000..d3169a84 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleParameter.java @@ -0,0 +1,204 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The rule import parameter. + */ +public class RuleParameter extends GenericModel { + + /** + * The property type. + */ + public interface Type { + /** string. */ + String STRING = "string"; + /** numeric. */ + String NUMERIC = "numeric"; + /** general. */ + String GENERAL = "general"; + /** boolean. */ + String X_BOOLEAN = "boolean"; + /** string_list. */ + String STRING_LIST = "string_list"; + /** ip_list. */ + String IP_LIST = "ip_list"; + /** timestamp. */ + String TIMESTAMP = "timestamp"; + } + + protected String name; + @SerializedName("display_name") + protected String displayName; + protected String description; + protected String type; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String displayName; + private String description; + private String type; + + /** + * Instantiates a new Builder from an existing RuleParameter instance. + * + * @param ruleParameter the instance to initialize the Builder with + */ + private Builder(RuleParameter ruleParameter) { + this.name = ruleParameter.name; + this.displayName = ruleParameter.displayName; + this.description = ruleParameter.description; + this.type = ruleParameter.type; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param type the type + */ + public Builder(String type) { + this.type = type; + } + + /** + * Builds a RuleParameter. + * + * @return the new RuleParameter instance + */ + public RuleParameter build() { + return new RuleParameter(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the RuleParameter builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the displayName. + * + * @param displayName the displayName + * @return the RuleParameter builder + */ + public Builder displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the RuleParameter builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the RuleParameter builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + } + + protected RuleParameter() { } + + protected RuleParameter(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, + "type cannot be null"); + name = builder.name; + displayName = builder.displayName; + description = builder.description; + type = builder.type; + } + + /** + * New builder. + * + * @return a RuleParameter builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The import parameter name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the displayName. + * + * The display name of the property. + * + * @return the displayName + */ + public String displayName() { + return displayName; + } + + /** + * Gets the description. + * + * The propery description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the type. + * + * The property type. + * + * @return the type + */ + public String type() { + return type; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleProperty.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleProperty.java new file mode 100644 index 00000000..f4f8c2ba --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleProperty.java @@ -0,0 +1,82 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 supported config property. + */ +public class RuleProperty extends GenericModel { + + /** + * The operator kind used when evaluating a property. + */ + public interface Type { + /** string. */ + String STRING = "string"; + /** numeric. */ + String NUMERIC = "numeric"; + /** general. */ + String GENERAL = "general"; + /** boolean. */ + String X_BOOLEAN = "boolean"; + /** string_list. */ + String STRING_LIST = "string_list"; + /** ip_list. */ + String IP_LIST = "ip_list"; + /** timestamp. */ + String TIMESTAMP = "timestamp"; + } + + protected String name; + protected String description; + protected String type; + + protected RuleProperty() { } + + /** + * Gets the name. + * + * The property name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * The property description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the type. + * + * The operator kind used when evaluating a property. + * + * @return the type + */ + public String getType() { + return type; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTarget.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTarget.java new file mode 100644 index 00000000..84d6bade --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTarget.java @@ -0,0 +1,237 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 RuleTarget extends GenericModel { + + @SerializedName("service_name") + protected String serviceName; + @SerializedName("service_display_name") + protected String serviceDisplayName; + @SerializedName("resource_kind") + protected String resourceKind; + @SerializedName("additional_target_attributes") + protected List additionalTargetAttributes; + protected String ref; + + /** + * Builder. + */ + public static class Builder { + private String serviceName; + private String serviceDisplayName; + private String resourceKind; + private List additionalTargetAttributes; + private String ref; + + /** + * Instantiates a new Builder from an existing RuleTarget instance. + * + * @param ruleTarget the instance to initialize the Builder with + */ + private Builder(RuleTarget ruleTarget) { + this.serviceName = ruleTarget.serviceName; + this.serviceDisplayName = ruleTarget.serviceDisplayName; + this.resourceKind = ruleTarget.resourceKind; + this.additionalTargetAttributes = ruleTarget.additionalTargetAttributes; + this.ref = ruleTarget.ref; + } + + /** + * 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 RuleTarget. + * + * @return the new RuleTarget instance + */ + public RuleTarget build() { + return new RuleTarget(this); + } + + /** + * Adds a new element to additionalTargetAttributes. + * + * @param additionalTargetAttributes the new element to be added + * @return the RuleTarget 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 RuleTarget builder + */ + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + /** + * Set the serviceDisplayName. + * + * @param serviceDisplayName the serviceDisplayName + * @return the RuleTarget builder + */ + public Builder serviceDisplayName(String serviceDisplayName) { + this.serviceDisplayName = serviceDisplayName; + return this; + } + + /** + * Set the resourceKind. + * + * @param resourceKind the resourceKind + * @return the RuleTarget 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 RuleTarget builder + */ + public Builder additionalTargetAttributes(List additionalTargetAttributes) { + this.additionalTargetAttributes = additionalTargetAttributes; + return this; + } + + /** + * Set the ref. + * + * @param ref the ref + * @return the RuleTarget builder + */ + public Builder ref(String ref) { + this.ref = ref; + return this; + } + } + + protected RuleTarget() { } + + protected RuleTarget(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; + ref = builder.ref; + } + + /** + * New builder. + * + * @return a RuleTarget 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 serviceDisplayName. + * + * The display name of the target service. + * + * @return the serviceDisplayName + */ + public String serviceDisplayName() { + return serviceDisplayName; + } + + /** + * 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; + } + + /** + * Gets the ref. + * + * The name of target when used in a rule. + * + * @return the ref + */ + public String ref() { + return ref; + } +} + 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/RuleTargetPrototype.java similarity index 78% rename from modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototype.java rename to modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTargetPrototype.java index 03d4400f..58cfde77 100644 --- 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/RuleTargetPrototype.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -21,7 +22,7 @@ /** * The rule target. */ -public class TargetPrototype extends GenericModel { +public class RuleTargetPrototype extends GenericModel { @SerializedName("service_name") protected String serviceName; @@ -39,14 +40,14 @@ public static class Builder { private List additionalTargetAttributes; /** - * Instantiates a new Builder from an existing TargetPrototype instance. + * Instantiates a new Builder from an existing RuleTargetPrototype instance. * - * @param targetPrototype the instance to initialize the Builder with + * @param ruleTargetPrototype the instance to initialize the Builder with */ - private Builder(TargetPrototype targetPrototype) { - this.serviceName = targetPrototype.serviceName; - this.resourceKind = targetPrototype.resourceKind; - this.additionalTargetAttributes = targetPrototype.additionalTargetAttributes; + private Builder(RuleTargetPrototype ruleTargetPrototype) { + this.serviceName = ruleTargetPrototype.serviceName; + this.resourceKind = ruleTargetPrototype.resourceKind; + this.additionalTargetAttributes = ruleTargetPrototype.additionalTargetAttributes; } /** @@ -67,19 +68,19 @@ public Builder(String serviceName, String resourceKind) { } /** - * Builds a TargetPrototype. + * Builds a RuleTargetPrototype. * - * @return the new TargetPrototype instance + * @return the new RuleTargetPrototype instance */ - public TargetPrototype build() { - return new TargetPrototype(this); + public RuleTargetPrototype build() { + return new RuleTargetPrototype(this); } /** - * Adds an additionalTargetAttributes to additionalTargetAttributes. + * Adds a new element to additionalTargetAttributes. * - * @param additionalTargetAttributes the new additionalTargetAttributes - * @return the TargetPrototype builder + * @param additionalTargetAttributes the new element to be added + * @return the RuleTargetPrototype builder */ public Builder addAdditionalTargetAttributes(AdditionalTargetAttribute additionalTargetAttributes) { com.ibm.cloud.sdk.core.util.Validator.notNull(additionalTargetAttributes, @@ -95,7 +96,7 @@ public Builder addAdditionalTargetAttributes(AdditionalTargetAttribute additiona * Set the serviceName. * * @param serviceName the serviceName - * @return the TargetPrototype builder + * @return the RuleTargetPrototype builder */ public Builder serviceName(String serviceName) { this.serviceName = serviceName; @@ -106,7 +107,7 @@ public Builder serviceName(String serviceName) { * Set the resourceKind. * * @param resourceKind the resourceKind - * @return the TargetPrototype builder + * @return the RuleTargetPrototype builder */ public Builder resourceKind(String resourceKind) { this.resourceKind = resourceKind; @@ -118,7 +119,7 @@ public Builder resourceKind(String resourceKind) { * Existing additionalTargetAttributes will be replaced. * * @param additionalTargetAttributes the additionalTargetAttributes - * @return the TargetPrototype builder + * @return the RuleTargetPrototype builder */ public Builder additionalTargetAttributes(List additionalTargetAttributes) { this.additionalTargetAttributes = additionalTargetAttributes; @@ -126,9 +127,9 @@ public Builder additionalTargetAttributes(List additi } } - protected TargetPrototype() { } + protected RuleTargetPrototype() { } - protected TargetPrototype(Builder builder) { + protected RuleTargetPrototype(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, @@ -141,7 +142,7 @@ protected TargetPrototype(Builder builder) { /** * New builder. * - * @return a TargetPrototype builder + * @return a RuleTargetPrototype 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/RulesPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulesPager.java new file mode 100644 index 00000000..edcd2b88 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulesPager.java @@ -0,0 +1,108 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * RulesPager can be used to simplify the use of the "listRules" method. + */ +public class RulesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListRulesOptions options; + protected SecurityAndComplianceCenterApi client; + protected PageContext pageContext; + + // Hide the default ctor. + protected RulesPager() { } + + /** + * Constructs a new RulesPager instance with the specified client and options model instance. + * @param client the SecurityAndComplianceCenterApi instance to be used to invoke the "listRules" method + * @param options the ListRulesOptions instance to be used to invoke the "listRules" method + */ + public RulesPager(SecurityAndComplianceCenterApi client, ListRulesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<Rule> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListRulesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + RuleCollection result = client.listRules(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getRules(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<Rule> containing all results returned by the "listRules" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReport.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReport.java new file mode 100644 index 00000000..edbd973d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReport.java @@ -0,0 +1,168 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A report detailing the evaluations related to a specific control. + */ +public class ScanReport extends GenericModel { + + /** + * The enum of different scan report status. + */ + public interface Status { + /** pending. */ + String PENDING = "pending"; + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** error. */ + String ERROR = "error"; + /** completed. */ + String COMPLETED = "completed"; + /** deleted. */ + String DELETED = "deleted"; + } + + /** + * The file type of the report. + */ + public interface Format { + /** csv. */ + String CSV = "csv"; + /** pdf. */ + String PDF = "pdf"; + } + + protected String id; + @SerializedName("scan_id") + protected String scanId; + @SerializedName("instance_id") + protected String instanceId; + @SerializedName("scope_id") + protected String scopeId; + @SerializedName("subscope_id") + protected String subscopeId; + protected String status; + @SerializedName("created_on") + protected Date createdOn; + protected String format; + protected String href; + + protected ScanReport() { } + + /** + * Gets the id. + * + * The ID of the scan report. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the scanId. + * + * The ID of the scan. + * + * @return the scanId + */ + public String getScanId() { + return scanId; + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String getInstanceId() { + return instanceId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope. + * + * @return the scopeId + */ + public String getScopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The ID of the sub-scope. + * + * @return the subscopeId + */ + public String getSubscopeId() { + return subscopeId; + } + + /** + * Gets the status. + * + * The enum of different scan report status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Gets the createdOn. + * + * The date when the report was created. + * + * @return the createdOn + */ + public Date getCreatedOn() { + return createdOn; + } + + /** + * Gets the format. + * + * The file type of the report. + * + * @return the format + */ + public String getFormat() { + return format; + } + + /** + * Gets the href. + * + * The URL of the scan report. + * + * @return the href + */ + public String getHref() { + return href; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportCollection.java new file mode 100644 index 00000000..5b66a73e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportCollection.java @@ -0,0 +1,117 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The page of scan reports. + */ +public class ScanReportCollection extends GenericModel { + + protected Long limit; + @SerializedName("total_count") + protected Long totalCount; + protected PageHRefFirst first; + protected PageHRefNext next; + @SerializedName("scope_id") + protected String scopeId; + @SerializedName("subscope_id") + protected String subscopeId; + @SerializedName("scan_reports") + protected List scanReports; + + protected ScanReportCollection() { } + + /** + * Gets the limit. + * + * The requested page limit. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the totalCount. + * + * The total number of resources that are in the collection. + * + * @return the totalCount + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Gets the first. + * + * A page reference. + * + * @return the first + */ + public PageHRefFirst getFirst() { + return first; + } + + /** + * Gets the next. + * + * A page reference. + * + * @return the next + */ + public PageHRefNext getNext() { + return next; + } + + /** + * Gets the scopeId. + * + * The id of the requested scope. + * + * @return the scopeId + */ + public String getScopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The id of the requested subscope. + * + * @return the subscopeId + */ + public String getSubscopeId() { + return subscopeId; + } + + /** + * Gets the scanReports. + * + * The list of scan reports. + * + * @return the scanReports + */ + public List getScanReports() { + return scanReports; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Scope.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Scope.java new file mode 100644 index 00000000..b57a0944 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Scope.java @@ -0,0 +1,183 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The group of resources that you want to evaluate. In the new API-based architecture, a scope can be an Enterprise, + * Account group, Account, or Resource group. + */ +public class Scope extends GenericModel { + + protected String id; + protected String name; + protected String description; + protected String environment; + @SerializedName("properties") + protected List xProperties; + @SerializedName("account_id") + protected String accountId; + @SerializedName("instance_id") + protected String instanceId; + @SerializedName("created_by") + protected String createdBy; + @SerializedName("created_on") + protected Date createdOn; + @SerializedName("updated_by") + protected String updatedBy; + @SerializedName("updated_on") + protected Date updatedOn; + @SerializedName("attachment_count") + protected Double attachmentCount; + + protected Scope() { } + + /** + * Gets the id. + * + * The ID of the scope. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the name. + * + * The scope name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * The scope description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the environment. + * + * The scope environment. This value details what cloud provider the scope targets. + * + * @return the environment + */ + public String getEnvironment() { + return environment; + } + + /** + * Gets the xProperties. + * + * The properties that are supported for scoping by this environment. + * + * @return the xProperties + */ + public List getXProperties() { + return xProperties; + } + + /** + * Gets the accountId. + * + * The ID of the account associated with the scope. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the instanceId. + * + * The ID of the instance associated with the scope. + * + * @return the instanceId + */ + public String getInstanceId() { + return instanceId; + } + + /** + * Gets the createdBy. + * + * The identifier of the account or service ID who created the scope. + * + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * Gets the createdOn. + * + * The date when the scope was created. + * + * @return the createdOn + */ + public Date getCreatedOn() { + return createdOn; + } + + /** + * Gets the updatedBy. + * + * The ID of the user or service ID who updated the scope. + * + * @return the updatedBy + */ + public String getUpdatedBy() { + return updatedBy; + } + + /** + * Gets the updatedOn. + * + * The date when the scope was updated. + * + * @return the updatedOn + */ + public Date getUpdatedOn() { + return updatedOn; + } + + /** + * Gets the attachmentCount. + * + * The number of attachments tied to the scope. + * + * @return the attachmentCount + */ + public Double getAttachmentCount() { + return attachmentCount; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeCollection.java new file mode 100644 index 00000000..45f4896a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeCollection.java @@ -0,0 +1,90 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A list of scopes. + */ +public class ScopeCollection extends GenericModel { + + protected Long limit; + @SerializedName("total_count") + protected Long totalCount; + protected PageHRefFirst first; + protected PageHRefNext next; + protected List scopes; + + protected ScopeCollection() { } + + /** + * Gets the limit. + * + * The requested page limit. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the totalCount. + * + * The total number of resources that are in the collection. + * + * @return the totalCount + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Gets the first. + * + * A page reference. + * + * @return the first + */ + public PageHRefFirst getFirst() { + return first; + } + + /** + * Gets the next. + * + * A page reference. + * + * @return the next + */ + public PageHRefNext getNext() { + return next; + } + + /** + * Gets the scopes. + * + * The array of scopes. + * + * @return the scopes + */ + public List getScopes() { + return scopes; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeID.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeID.java new file mode 100644 index 00000000..0caf6a0c --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeID.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 scope ID that is associated with a report. Attributes for this object will be blank if the report has multiple + * scopes tied to the report. + */ +public class ScopeID extends GenericModel { + + protected String id; + protected String type; + + protected ScopeID() { } + + /** + * Gets the id. + * + * The scope ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the type. + * + * The scope type. + * + * @return the type + */ + public String getType() { + return type; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeProperty.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeProperty.java index d2fdcac5..2b10afa3 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeProperty.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeProperty.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,39 +10,46 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 properties that are supported for scoping by this attachment. + * ScopeProperty. + * + * Classes which extend this class: + * - ScopePropertyScopeAny + * - ScopePropertyScopeType + * - ScopePropertyScopeId + * - ScopePropertyExclusions */ public class ScopeProperty extends GenericModel { protected String name; - protected String value; + protected Object value; protected ScopeProperty() { } /** * Gets the name. * - * The property name. + * key to say the attribute targets the scope type. * * @return the name */ - public String getName() { + public String name() { return name; } /** * Gets the value. * - * The property value. + * The value can be a string or a string list. * * @return the value */ - public String getValue() { + 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/ScopePropertyExclusionItem.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusionItem.java new file mode 100644 index 00000000..8280a0c2 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusionItem.java @@ -0,0 +1,161 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * Any exclusion to be defined in the scope. + */ +public class ScopePropertyExclusionItem extends GenericModel { + + /** + * The type of scope it targets + * + * The scope values are as followed: + * - enterprise: The scope targets an enterprise account + * - enterprise.account_group: The scope targets an account group within an enterprise + * - enterprise.account: The scope targets an account within an enterprise + * - account: The scope targets an account not tied to an enterprise + * - account.resource_group: The scope targets a resource group within an account. + */ + public interface ScopeType { + /** enterprise. */ + String ENTERPRISE = "enterprise"; + /** enterprise.account_group. */ + String ENTERPRISE_ACCOUNT_GROUP = "enterprise.account_group"; + /** enterprise.account. */ + String ENTERPRISE_ACCOUNT = "enterprise.account"; + /** account. */ + String ACCOUNT = "account"; + /** account.resource_group. */ + String ACCOUNT_RESOURCE_GROUP = "account.resource_group"; + } + + @SerializedName("scope_id") + protected String scopeId; + @SerializedName("scope_type") + protected String scopeType; + + /** + * Builder. + */ + public static class Builder { + private String scopeId; + private String scopeType; + + /** + * Instantiates a new Builder from an existing ScopePropertyExclusionItem instance. + * + * @param scopePropertyExclusionItem the instance to initialize the Builder with + */ + private Builder(ScopePropertyExclusionItem scopePropertyExclusionItem) { + this.scopeId = scopePropertyExclusionItem.scopeId; + this.scopeType = scopePropertyExclusionItem.scopeType; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param scopeType the scopeType + */ + public Builder(String scopeType) { + this.scopeType = scopeType; + } + + /** + * Builds a ScopePropertyExclusionItem. + * + * @return the new ScopePropertyExclusionItem instance + */ + public ScopePropertyExclusionItem build() { + return new ScopePropertyExclusionItem(this); + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the ScopePropertyExclusionItem builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the scopeType. + * + * @param scopeType the scopeType + * @return the ScopePropertyExclusionItem builder + */ + public Builder scopeType(String scopeType) { + this.scopeType = scopeType; + return this; + } + } + + protected ScopePropertyExclusionItem() { } + + protected ScopePropertyExclusionItem(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.scopeType, + "scopeType cannot be null"); + scopeId = builder.scopeId; + scopeType = builder.scopeType; + } + + /** + * New builder. + * + * @return a ScopePropertyExclusionItem builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the scopeId. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the scopeType. + * + * The type of scope it targets + * + * The scope values are as followed: + * - enterprise: The scope targets an enterprise account + * - enterprise.account_group: The scope targets an account group within an enterprise + * - enterprise.account: The scope targets an account within an enterprise + * - account: The scope targets an account not tied to an enterprise + * - account.resource_group: The scope targets a resource group within an account. + * + * @return the scopeType + */ + public String scopeType() { + return scopeType; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusions.java new file mode 100644 index 00000000..85042de5 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusions.java @@ -0,0 +1,136 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * Any exclusions or resources that should not be part of the scope. Has to be the same type as the one specified. + */ +public class ScopePropertyExclusions extends ScopeProperty { + + /** + * The key that denotes the user is declaring the exclusions. + */ + public interface Name { + /** exclusions. */ + String EXCLUSIONS = "exclusions"; + } + + + /** + * Builder. + */ + public static class Builder { + private String name; + private List value; + + /** + * Instantiates a new Builder from an existing ScopePropertyExclusions instance. + * + * @param scopePropertyExclusions the instance to initialize the Builder with + */ + public Builder(ScopeProperty scopePropertyExclusions) { + this.name = scopePropertyExclusions.name; + this.value = scopePropertyExclusions.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, List value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ScopePropertyExclusions. + * + * @return the new ScopePropertyExclusions instance + */ + public ScopePropertyExclusions build() { + return new ScopePropertyExclusions(this); + } + + /** + * Adds a new element to value. + * + * @param value the new element to be added + * @return the ScopePropertyExclusions builder + */ + public Builder addValue(ScopePropertyExclusionItem value) { + com.ibm.cloud.sdk.core.util.Validator.notNull(value, + "value cannot be null"); + if (this.value == null) { + this.value = new ArrayList(); + } + this.value.add(value); + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ScopePropertyExclusions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * Existing value will be replaced. + * + * @param value the value + * @return the ScopePropertyExclusions builder + */ + public Builder value(List value) { + this.value = value; + return this; + } + } + + protected ScopePropertyExclusions() { } + + protected ScopePropertyExclusions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a ScopePropertyExclusions 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/ScopePropertyScopeAny.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeAny.java new file mode 100644 index 00000000..124cf0e5 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeAny.java @@ -0,0 +1,108 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * Attribute that details what kind of type of scope. + */ +public class ScopePropertyScopeAny extends ScopeProperty { + + + /** + * Builder. + */ + public static class Builder { + private String name; + private Object value; + + /** + * Instantiates a new Builder from an existing ScopePropertyScopeAny instance. + * + * @param scopePropertyScopeAny the instance to initialize the Builder with + */ + public Builder(ScopeProperty scopePropertyScopeAny) { + this.name = scopePropertyScopeAny.name; + this.value = scopePropertyScopeAny.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, Object value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ScopePropertyScopeAny. + * + * @return the new ScopePropertyScopeAny instance + */ + public ScopePropertyScopeAny build() { + return new ScopePropertyScopeAny(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ScopePropertyScopeAny builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ScopePropertyScopeAny builder + */ + public Builder value(Object value) { + this.value = value; + return this; + } + } + + protected ScopePropertyScopeAny() { } + + protected ScopePropertyScopeAny(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a ScopePropertyScopeAny 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/ScopePropertyScopeId.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeId.java new file mode 100644 index 00000000..770bb52b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeId.java @@ -0,0 +1,117 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 value of the identifier that correlates to scope type. If ScopePropertyScopeType schema uses the value + * enterprise.account_group, the value should be the identifier or ID of the account_group within the enterprise. + */ +public class ScopePropertyScopeId extends ScopeProperty { + + /** + * The key for the scope property. + */ + public interface Name { + /** scope_id. */ + String SCOPE_ID = "scope_id"; + } + + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + + /** + * Instantiates a new Builder from an existing ScopePropertyScopeId instance. + * + * @param scopePropertyScopeId the instance to initialize the Builder with + */ + public Builder(ScopeProperty scopePropertyScopeId) { + this.name = scopePropertyScopeId.name; + this.value = scopePropertyScopeId.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ScopePropertyScopeId. + * + * @return the new ScopePropertyScopeId instance + */ + public ScopePropertyScopeId build() { + return new ScopePropertyScopeId(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ScopePropertyScopeId builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ScopePropertyScopeId builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + } + + protected ScopePropertyScopeId() { } + + protected ScopePropertyScopeId(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a ScopePropertyScopeId 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/ScopePropertyScopeType.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeType.java new file mode 100644 index 00000000..ae49caa1 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeType.java @@ -0,0 +1,139 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; + +/** + * Attribute that details what kind of type of scope. + */ +public class ScopePropertyScopeType extends ScopeProperty { + + /** + * key to say the attribute targets the scope type. + */ + public interface Name { + /** scope_type. */ + String SCOPE_TYPE = "scope_type"; + } + + /** + * The type of scope it targets + * + * The scope values are as followed: + * - enterprise: The scope targets an enterprise account + * - enterprise.account_group: The scope targets an account group within an enterprise + * - enterprise.account: The scope targets an account within an enterprise + * - account: The scope targets an account not tied to an enterprise + * - account.resource_group: The scope targets a resource group within an account. + */ + public interface Value { + /** account. */ + String ACCOUNT = "account"; + /** account.resource_group. */ + String ACCOUNT_RESOURCE_GROUP = "account.resource_group"; + /** enterprise. */ + String ENTERPRISE = "enterprise"; + /** enterprise.account_group. */ + String ENTERPRISE_ACCOUNT_GROUP = "enterprise.account_group"; + /** enterprise.account. */ + String ENTERPRISE_ACCOUNT = "enterprise.account"; + } + + + /** + * Builder. + */ + public static class Builder { + private String name; + private String value; + + /** + * Instantiates a new Builder from an existing ScopePropertyScopeType instance. + * + * @param scopePropertyScopeType the instance to initialize the Builder with + */ + public Builder(ScopeProperty scopePropertyScopeType) { + this.name = scopePropertyScopeType.name; + this.value = scopePropertyScopeType.value; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param value the value + */ + public Builder(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * Builds a ScopePropertyScopeType. + * + * @return the new ScopePropertyScopeType instance + */ + public ScopePropertyScopeType build() { + return new ScopePropertyScopeType(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the ScopePropertyScopeType builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the value. + * + * @param value the value + * @return the ScopePropertyScopeType builder + */ + public Builder value(String value) { + this.value = value; + return this; + } + } + + protected ScopePropertyScopeType() { } + + protected ScopePropertyScopeType(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, + "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, + "value cannot be null"); + name = builder.name; + value = builder.value; + } + + /** + * New builder. + * + * @return a ScopePropertyScopeType 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/ScopePrototype.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePrototype.java new file mode 100644 index 00000000..84e4979a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePrototype.java @@ -0,0 +1,193 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 request body to make a Scope. + */ +public class ScopePrototype extends GenericModel { + + protected String name; + protected String description; + protected String environment; + @SerializedName("properties") + protected List xProperties; + + /** + * Builder. + */ + public static class Builder { + private String name; + private String description; + private String environment; + private List xProperties; + + /** + * Instantiates a new Builder from an existing ScopePrototype instance. + * + * @param scopePrototype the instance to initialize the Builder with + */ + private Builder(ScopePrototype scopePrototype) { + this.name = scopePrototype.name; + this.description = scopePrototype.description; + this.environment = scopePrototype.environment; + this.xProperties = scopePrototype.xProperties; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a ScopePrototype. + * + * @return the new ScopePrototype instance + */ + public ScopePrototype build() { + return new ScopePrototype(this); + } + + /** + * Adds a new element to xProperties. + * + * @param xProperties the new element to be added + * @return the ScopePrototype builder + */ + public Builder addXProperties(ScopeProperty xProperties) { + com.ibm.cloud.sdk.core.util.Validator.notNull(xProperties, + "xProperties cannot be null"); + if (this.xProperties == null) { + this.xProperties = new ArrayList(); + } + this.xProperties.add(xProperties); + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the ScopePrototype builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the ScopePrototype builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the environment. + * + * @param environment the environment + * @return the ScopePrototype builder + */ + public Builder environment(String environment) { + this.environment = environment; + return this; + } + + /** + * Set the xProperties. + * Existing xProperties will be replaced. + * + * @param xProperties the xProperties + * @return the ScopePrototype builder + */ + public Builder xProperties(List xProperties) { + this.xProperties = xProperties; + return this; + } + } + + protected ScopePrototype() { } + + protected ScopePrototype(Builder builder) { + name = builder.name; + description = builder.description; + environment = builder.environment; + xProperties = builder.xProperties; + } + + /** + * New builder. + * + * @return a ScopePrototype builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + * The scope name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * The scope description. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the environment. + * + * The scope environment. + * + * @return the environment + */ + public String environment() { + return environment; + } + + /** + * Gets the xProperties. + * + * The properties that are supported for scoping by this environment. + * + * @return the xProperties + */ + public List xProperties() { + return xProperties; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopesPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopesPager.java new file mode 100644 index 00000000..41779ea3 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopesPager.java @@ -0,0 +1,108 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * ScopesPager can be used to simplify the use of the "listScopes" method. + */ +public class ScopesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListScopesOptions options; + protected SecurityAndComplianceCenterApi client; + protected PageContext pageContext; + + // Hide the default ctor. + protected ScopesPager() { } + + /** + * Constructs a new ScopesPager instance with the specified client and options model instance. + * @param client the SecurityAndComplianceCenterApi instance to be used to invoke the "listScopes" method + * @param options the ListScopesOptions instance to be used to invoke the "listScopes" method + */ + public ScopesPager(SecurityAndComplianceCenterApi client, ListScopesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<Scope> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListScopesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + ScopeCollection result = client.listScopes(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getScopes(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<Scope> containing all results returned by the "listScopes" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Service.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Service.java new file mode 100644 index 00000000..cfcf12f2 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Service.java @@ -0,0 +1,185 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; +import java.util.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The response body for creating a service instance. + */ +public class Service extends GenericModel { + + @SerializedName("created_on") + protected Date createdOn; + @SerializedName("created_by") + protected String createdBy; + @SerializedName("updated_on") + protected Date updatedOn; + @SerializedName("updated_by") + protected String updatedBy; + @SerializedName("service_name") + protected String serviceName; + @SerializedName("service_display_name") + protected String serviceDisplayName; + protected String description; + @SerializedName("monitoring_enabled") + protected Boolean monitoringEnabled; + @SerializedName("enforcement_enabled") + protected Boolean enforcementEnabled; + @SerializedName("service_listing_enabled") + protected Boolean serviceListingEnabled; + @SerializedName("config_information_point") + protected ConfigurationInformationPoints configInformationPoint; + @SerializedName("supported_configs") + protected List supportedConfigs; + + protected Service() { } + + /** + * Gets the createdOn. + * + * The service creation date. + * + * @return the createdOn + */ + public Date getCreatedOn() { + return createdOn; + } + + /** + * Gets the createdBy. + * + * The service author. + * + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * Gets the updatedOn. + * + * The date when the service was modified. + * + * @return the updatedOn + */ + public Date getUpdatedOn() { + return updatedOn; + } + + /** + * Gets the updatedBy. + * + * The user who modified the service. + * + * @return the updatedBy + */ + public String getUpdatedBy() { + return updatedBy; + } + + /** + * Gets the serviceName. + * + * The service name. + * + * @return the serviceName + */ + public String getServiceName() { + return serviceName; + } + + /** + * Gets the serviceDisplayName. + * + * The display name of the service. + * + * @return the serviceDisplayName + */ + public String getServiceDisplayName() { + return serviceDisplayName; + } + + /** + * Gets the description. + * + * The service description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the monitoringEnabled. + * + * The indication of whether monitoring is enabled. + * + * @return the monitoringEnabled + */ + public Boolean isMonitoringEnabled() { + return monitoringEnabled; + } + + /** + * Gets the enforcementEnabled. + * + * The indication of whether enforcement is enabled. + * + * @return the enforcementEnabled + */ + public Boolean isEnforcementEnabled() { + return enforcementEnabled; + } + + /** + * Gets the serviceListingEnabled. + * + * The indication of whether service listing is enabled. + * + * @return the serviceListingEnabled + */ + public Boolean isServiceListingEnabled() { + return serviceListingEnabled; + } + + /** + * Gets the configInformationPoint. + * + * The service configuration information. + * + * @return the configInformationPoint + */ + public ConfigurationInformationPoints getConfigInformationPoint() { + return configInformationPoint; + } + + /** + * Gets the supportedConfigs. + * + * The supported configurations. + * + * @return the supportedConfigs + */ + public List getSupportedConfigs() { + return supportedConfigs; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceCollection.java new file mode 100644 index 00000000..5485565f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceCollection.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The services. + */ +public class ServiceCollection extends GenericModel { + + protected List services; + + protected ServiceCollection() { } + + /** + * Gets the services. + * + * The list of services. + * + * @return the services + */ + public List getServices() { + return services; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Settings.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Settings.java index 1f4ae4ea..f21d5a14 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Settings.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Settings.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; @@ -25,77 +26,8 @@ public class Settings extends GenericModel { @SerializedName("object_storage") protected ObjectStorage objectStorage; - /** - * Builder. - */ - public static class Builder { - private EventNotifications eventNotifications; - private ObjectStorage objectStorage; - - /** - * Instantiates a new Builder from an existing Settings instance. - * - * @param settings the instance to initialize the Builder with - */ - private Builder(Settings settings) { - this.eventNotifications = settings.eventNotifications; - this.objectStorage = settings.objectStorage; - } - - /** - * Instantiates a new builder. - */ - public Builder() { - } - - /** - * Builds a Settings. - * - * @return the new Settings instance - */ - public Settings build() { - return new Settings(this); - } - - /** - * Set the eventNotifications. - * - * @param eventNotifications the eventNotifications - * @return the Settings builder - */ - public Builder eventNotifications(EventNotifications eventNotifications) { - this.eventNotifications = eventNotifications; - return this; - } - - /** - * Set the objectStorage. - * - * @param objectStorage the objectStorage - * @return the Settings builder - */ - public Builder objectStorage(ObjectStorage objectStorage) { - this.objectStorage = objectStorage; - return this; - } - } - protected Settings() { } - protected Settings(Builder builder) { - eventNotifications = builder.eventNotifications; - objectStorage = builder.objectStorage; - } - - /** - * New builder. - * - * @return a Settings builder - */ - public Builder newBuilder() { - return new Builder(this); - } - /** * Gets the eventNotifications. * @@ -103,7 +35,7 @@ public Builder newBuilder() { * * @return the eventNotifications */ - public EventNotifications eventNotifications() { + public EventNotifications getEventNotifications() { return eventNotifications; } @@ -114,7 +46,7 @@ public EventNotifications eventNotifications() { * * @return the objectStorage */ - public ObjectStorage objectStorage() { + public ObjectStorage getObjectStorage() { return objectStorage; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubRule.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubRule.java new file mode 100644 index 00000000..6c99a3ed --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubRule.java @@ -0,0 +1,121 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A rule within a rule used in the requiredConfig. + */ +public class SubRule extends GenericModel { + + protected RuleTarget target; + @SerializedName("required_config") + protected RequiredConfig requiredConfig; + + /** + * Builder. + */ + public static class Builder { + private RuleTarget target; + private RequiredConfig requiredConfig; + + /** + * Instantiates a new Builder from an existing SubRule instance. + * + * @param subRule the instance to initialize the Builder with + */ + private Builder(SubRule subRule) { + this.target = subRule.target; + this.requiredConfig = subRule.requiredConfig; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a SubRule. + * + * @return the new SubRule instance + */ + public SubRule build() { + return new SubRule(this); + } + + /** + * Set the target. + * + * @param target the target + * @return the SubRule builder + */ + public Builder target(RuleTarget target) { + this.target = target; + return this; + } + + /** + * Set the requiredConfig. + * + * @param requiredConfig the requiredConfig + * @return the SubRule builder + */ + public Builder requiredConfig(RequiredConfig requiredConfig) { + this.requiredConfig = requiredConfig; + return this; + } + } + + protected SubRule() { } + + protected SubRule(Builder builder) { + target = builder.target; + requiredConfig = builder.requiredConfig; + } + + /** + * New builder. + * + * @return a SubRule builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the target. + * + * The rule target. + * + * @return the target + */ + public RuleTarget target() { + return target; + } + + /** + * Gets the requiredConfig. + * + * The required configurations for a Rule. + * + * @return the requiredConfig + */ + public RequiredConfig requiredConfig() { + return requiredConfig; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScope.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScope.java new file mode 100644 index 00000000..7987485d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScope.java @@ -0,0 +1,91 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * A segment of a scope. Subscopes are used to ensure that the members of your teams who review results only have access + * to the information regarding the instances that they have access to. + */ +public class SubScope extends GenericModel { + + protected String id; + protected String name; + protected String description; + protected String environment; + @SerializedName("properties") + protected List xProperties; + + protected SubScope() { } + + /** + * Gets the id. + * + * The Subscope ID. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the name. + * + * The name of the Subscope. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + * Text to describe the Subscope. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the environment. + * + * The virtual space where applications can be deployed and managed. + * + * @return the environment + */ + public String getEnvironment() { + return environment; + } + + /** + * Gets the xProperties. + * + * Additional attributes that are supported for scoping by this environment. + * + * @return the xProperties + */ + public List getXProperties() { + return xProperties; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeCollection.java new file mode 100644 index 00000000..d5d747bd --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeCollection.java @@ -0,0 +1,90 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The response body of the subscopes. + */ +public class SubScopeCollection extends GenericModel { + + protected Long limit; + @SerializedName("total_count") + protected Long totalCount; + protected PageHRefFirst first; + protected PageHRefNext next; + protected List subscopes; + + protected SubScopeCollection() { } + + /** + * Gets the limit. + * + * The requested page limit. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the totalCount. + * + * The total number of resources that are in the collection. + * + * @return the totalCount + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Gets the first. + * + * A page reference. + * + * @return the first + */ + public PageHRefFirst getFirst() { + return first; + } + + /** + * Gets the next. + * + * A page reference. + * + * @return the next + */ + public PageHRefNext getNext() { + return next; + } + + /** + * Gets the subscopes. + * + * The array of subscopes. + * + * @return the subscopes + */ + public List getSubscopes() { + return subscopes; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeResponse.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeResponse.java new file mode 100644 index 00000000..c702daa9 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeResponse.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The response body of the subscope. + */ +public class SubScopeResponse extends GenericModel { + + protected List subscopes; + + protected SubScopeResponse() { } + + /** + * Gets the subscopes. + * + * The array of subscopes. + * + * @return the subscopes + */ + public List getSubscopes() { + return subscopes; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubscopesPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubscopesPager.java new file mode 100644 index 00000000..301a090a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubscopesPager.java @@ -0,0 +1,108 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; + +/** + * SubscopesPager can be used to simplify the use of the "listSubscopes" method. + */ +public class SubscopesPager { + private static class PageContext { + private String next; + public String getNext() { + return next; + } + public void setNext(String next) { + this.next = next; + } + } + + protected boolean hasNext; + protected ListSubscopesOptions options; + protected SecurityAndComplianceCenterApi client; + protected PageContext pageContext; + + // Hide the default ctor. + protected SubscopesPager() { } + + /** + * Constructs a new SubscopesPager instance with the specified client and options model instance. + * @param client the SecurityAndComplianceCenterApi instance to be used to invoke the "listSubscopes" method + * @param options the ListSubscopesOptions instance to be used to invoke the "listSubscopes" method + */ + public SubscopesPager(SecurityAndComplianceCenterApi client, ListSubscopesOptions options) { + if (options.start() != null) { + throw new IllegalArgumentException("The options 'start' field should not be set"); + } + + this.hasNext = true; + this.client = client; + this.options = options.newBuilder().build(); + this.pageContext = new PageContext(); + } + + /** + * Returns true if there are more results to be retrieved. + * @return boolean + */ + public boolean hasNext() { + return hasNext; + } + + /** + * Returns the next page of results. + * @return a List<SubScope> that contains the next page of results + */ + public List getNext() { + if (!hasNext()) { + throw new NoSuchElementException("No more results available"); + } + + ListSubscopesOptions.Builder builder = this.options.newBuilder(); + if (this.pageContext.getNext() != null) { + builder.start(this.pageContext.getNext()); + } + this.options = builder.build(); + + SubScopeCollection result = client.listSubscopes(options).execute().getResult(); + + String next = null; + if (result.getNext() != null) { + next = result.getNext().getStart(); + } + this.pageContext.setNext(next); + if (next == null) { + this.hasNext = false; + } + + return result.getSubscopes(); + } + + /** + * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. + * @return a List<SubScope> containing all results returned by the "listSubscopes" method + */ + public List getAll() { + List results = new ArrayList<>(); + while (hasNext()) { + List nextPage = getNext(); + results.addAll(nextPage); + } + return results; + } +} diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SupportedConfigs.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SupportedConfigs.java new file mode 100644 index 00000000..968b67cb --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SupportedConfigs.java @@ -0,0 +1,132 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The location information of supported configurations. + */ +public class SupportedConfigs extends GenericModel { + + @SerializedName("resource_kind") + protected String resourceKind; + @SerializedName("additional_target_attributes") + protected List additionalTargetAttributes; + @SerializedName("properties") + protected List xProperties; + protected String description; + @SerializedName("cip_requires_service_instance") + protected Boolean cipRequiresServiceInstance; + @SerializedName("resource_group_support") + protected Boolean resourceGroupSupport; + @SerializedName("tagging_support") + protected Boolean taggingSupport; + @SerializedName("inherit_tags") + protected Boolean inheritTags; + + protected SupportedConfigs() { } + + /** + * Gets the resourceKind. + * + * The supported config resource kind. + * + * @return the resourceKind + */ + public String getResourceKind() { + return resourceKind; + } + + /** + * Gets the additionalTargetAttributes. + * + * The supported config list of additional target attributes. + * + * @return the additionalTargetAttributes + */ + public List getAdditionalTargetAttributes() { + return additionalTargetAttributes; + } + + /** + * Gets the xProperties. + * + * The supported config list properties. + * + * @return the xProperties + */ + public List getXProperties() { + return xProperties; + } + + /** + * Gets the description. + * + * The supported config description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the cipRequiresServiceInstance. + * + * The indication of whether the configuration information point (CIP) requires a service instance. + * + * @return the cipRequiresServiceInstance + */ + public Boolean isCipRequiresServiceInstance() { + return cipRequiresServiceInstance; + } + + /** + * Gets the resourceGroupSupport. + * + * The supported config resource group support. + * + * @return the resourceGroupSupport + */ + public Boolean isResourceGroupSupport() { + return resourceGroupSupport; + } + + /** + * Gets the taggingSupport. + * + * The supported config tagging support. + * + * @return the taggingSupport + */ + public Boolean isTaggingSupport() { + return taggingSupport; + } + + /** + * Gets the inheritTags. + * + * The supported config inherited tags. + * + * @return the inheritTags + */ + public Boolean isInheritTags() { + return inheritTags; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Tags.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Tags.java index 650cee17..9a62d6e0 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Tags.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/Tags.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,8 +10,10 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ibm.cloud.sdk.core.service.model.GenericModel; @@ -25,8 +27,142 @@ public class Tags extends GenericModel { protected List access; protected List service; + /** + * Builder. + */ + public static class Builder { + private List user; + private List access; + private List service; + + /** + * Instantiates a new Builder from an existing Tags instance. + * + * @param tags the instance to initialize the Builder with + */ + private Builder(Tags tags) { + this.user = tags.user; + this.access = tags.access; + this.service = tags.service; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a Tags. + * + * @return the new Tags instance + */ + public Tags build() { + return new Tags(this); + } + + /** + * Adds a new element to user. + * + * @param user the new element to be added + * @return the Tags builder + */ + public Builder addUser(String user) { + com.ibm.cloud.sdk.core.util.Validator.notNull(user, + "user cannot be null"); + if (this.user == null) { + this.user = new ArrayList(); + } + this.user.add(user); + return this; + } + + /** + * Adds a new element to access. + * + * @param access the new element to be added + * @return the Tags builder + */ + public Builder addAccess(String access) { + com.ibm.cloud.sdk.core.util.Validator.notNull(access, + "access cannot be null"); + if (this.access == null) { + this.access = new ArrayList(); + } + this.access.add(access); + return this; + } + + /** + * Adds a new element to service. + * + * @param service the new element to be added + * @return the Tags builder + */ + public Builder addService(String service) { + com.ibm.cloud.sdk.core.util.Validator.notNull(service, + "service cannot be null"); + if (this.service == null) { + this.service = new ArrayList(); + } + this.service.add(service); + return this; + } + + /** + * Set the user. + * Existing user will be replaced. + * + * @param user the user + * @return the Tags builder + */ + public Builder user(List user) { + this.user = user; + return this; + } + + /** + * Set the access. + * Existing access will be replaced. + * + * @param access the access + * @return the Tags builder + */ + public Builder access(List access) { + this.access = access; + return this; + } + + /** + * Set the service. + * Existing service will be replaced. + * + * @param service the service + * @return the Tags builder + */ + public Builder service(List service) { + this.service = service; + return this; + } + } + protected Tags() { } + protected Tags(Builder builder) { + user = builder.user; + access = builder.access; + service = builder.service; + } + + /** + * New builder. + * + * @return a Tags builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the user. * @@ -34,7 +170,7 @@ protected Tags() { } * * @return the user */ - public List getUser() { + public List user() { return user; } @@ -45,7 +181,7 @@ public List getUser() { * * @return the access */ - public List getAccess() { + public List access() { return access; } @@ -56,7 +192,7 @@ public List getAccess() { * * @return the service */ - public List getService() { + public List service() { return service; } } 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 2709b610..3be41bb2 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,71 +10,135 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; import java.util.List; import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The rule target. + * The details of the target account. */ public class Target extends GenericModel { - @SerializedName("service_name") - protected String serviceName; - @SerializedName("service_display_name") - protected String serviceDisplayName; - @SerializedName("resource_kind") - protected String resourceKind; - @SerializedName("additional_target_attributes") - protected List additionalTargetAttributes; + protected String id; + @SerializedName("account_id") + protected String accountId; + @SerializedName("trusted_profile_id") + protected String trustedProfileId; + protected String name; + protected List credentials; + @SerializedName("created_by") + protected String createdBy; + @SerializedName("created_on") + protected Date createdOn; + @SerializedName("updated_by") + protected String updatedBy; + @SerializedName("updated_on") + protected Date updatedOn; protected Target() { } /** - * Gets the serviceName. + * Gets the id. + * + * The UUID of the target. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Gets the accountId. + * + * The target account ID. + * + * @return the accountId + */ + public String getAccountId() { + return accountId; + } + + /** + * Gets the trustedProfileId. + * + * The trusted profile ID. + * + * @return the trustedProfileId + */ + public String getTrustedProfileId() { + return trustedProfileId; + } + + /** + * Gets the name. + * + * The target name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the credentials. + * + * List of credentials. + * + * @return the credentials + */ + public List getCredentials() { + return credentials; + } + + /** + * Gets the createdBy. * - * The target service name. + * The user ID who created the target. * - * @return the serviceName + * @return the createdBy */ - public String getServiceName() { - return serviceName; + public String getCreatedBy() { + return createdBy; } /** - * Gets the serviceDisplayName. + * Gets the createdOn. * - * The display name of the target service. + * The time when the target was created. * - * @return the serviceDisplayName + * @return the createdOn */ - public String getServiceDisplayName() { - return serviceDisplayName; + public Date getCreatedOn() { + return createdOn; } /** - * Gets the resourceKind. + * Gets the updatedBy. * - * The target resource kind. + * The user ID who updated the target. * - * @return the resourceKind + * @return the updatedBy */ - public String getResourceKind() { - return resourceKind; + public String getUpdatedBy() { + return updatedBy; } /** - * Gets the additionalTargetAttributes. + * Gets the updatedOn. * - * The additional target attributes used to filter to a subset of resources. + * The time when the target was updated. * - * @return the additionalTargetAttributes + * @return the updatedOn */ - public List getAdditionalTargetAttributes() { - return additionalTargetAttributes; + public Date getUpdatedOn() { + return updatedOn; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetCollection.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetCollection.java new file mode 100644 index 00000000..7d5a2f5e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetCollection.java @@ -0,0 +1,90 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.List; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The target list collection. + */ +public class TargetCollection extends GenericModel { + + protected Long limit; + @SerializedName("total_count") + protected Long totalCount; + protected PageHRefFirst first; + protected PageHRefNext next; + protected List targets; + + protected TargetCollection() { } + + /** + * Gets the limit. + * + * The requested page limit. + * + * @return the limit + */ + public Long getLimit() { + return limit; + } + + /** + * Gets the totalCount. + * + * The total number of resources that are in the collection. + * + * @return the totalCount + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Gets the first. + * + * A page reference. + * + * @return the first + */ + public PageHRefFirst getFirst() { + return first; + } + + /** + * Gets the next. + * + * A page reference. + * + * @return the next + */ + public PageHRefNext getNext() { + return next; + } + + /** + * Gets the targets. + * + * The details of the target account. + * + * @return the targets + */ + public List getTargets() { + return targets; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetInfo.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetInfo.java index 7a3c9bd0..888f7d8f 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetInfo.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetInfo.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.annotations.SerializedName; @@ -23,12 +24,15 @@ public class TargetInfo extends GenericModel { protected String id; @SerializedName("account_id") protected String accountId; + @SerializedName("service_name") + protected String serviceName; + @SerializedName("service_display_name") + protected String serviceDisplayName; @SerializedName("resource_crn") protected String resourceCrn; @SerializedName("resource_name") protected String resourceName; - @SerializedName("service_name") - protected String serviceName; + protected Tags tags; protected TargetInfo() { } @@ -54,6 +58,28 @@ public String getAccountId() { return accountId; } + /** + * Gets the serviceName. + * + * The target service name. + * + * @return the serviceName + */ + public String getServiceName() { + return serviceName; + } + + /** + * Gets the serviceDisplayName. + * + * The target service display name. + * + * @return the serviceDisplayName + */ + public String getServiceDisplayName() { + return serviceDisplayName; + } + /** * Gets the resourceCrn. * @@ -77,14 +103,14 @@ public String getResourceName() { } /** - * Gets the serviceName. + * Gets the tags. * - * The target service name. + * The collection of different types of tags. * - * @return the serviceName + * @return the tags */ - public String getServiceName() { - return serviceName; + public Tags getTags() { + return tags; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TestEvent.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TestEvent.java index 70226060..700ce1d4 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TestEvent.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TestEvent.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; 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 b6399c45..bcf25af7 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,8 +10,11 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; /** @@ -19,21 +22,21 @@ */ public class UpdateProviderTypeInstanceOptions extends GenericModel { + protected String instanceId; protected String providerTypeId; protected String providerTypeInstanceId; - protected UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest; - protected String xCorrelationId; - protected String xRequestId; + protected String name; + protected Map attributes; /** * Builder. */ public static class Builder { + private String instanceId; private String providerTypeId; private String providerTypeInstanceId; - private UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest; - private String xCorrelationId; - private String xRequestId; + private String name; + private Map attributes; /** * Instantiates a new Builder from an existing UpdateProviderTypeInstanceOptions instance. @@ -41,11 +44,11 @@ public static class Builder { * @param updateProviderTypeInstanceOptions the instance to initialize the Builder with */ private Builder(UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptions) { + this.instanceId = updateProviderTypeInstanceOptions.instanceId; this.providerTypeId = updateProviderTypeInstanceOptions.providerTypeId; this.providerTypeInstanceId = updateProviderTypeInstanceOptions.providerTypeInstanceId; - this.updateProviderTypeInstanceRequest = updateProviderTypeInstanceOptions.updateProviderTypeInstanceRequest; - this.xCorrelationId = updateProviderTypeInstanceOptions.xCorrelationId; - this.xRequestId = updateProviderTypeInstanceOptions.xRequestId; + this.name = updateProviderTypeInstanceOptions.name; + this.attributes = updateProviderTypeInstanceOptions.attributes; } /** @@ -57,14 +60,14 @@ public Builder() { /** * Instantiates a new builder with required properties. * + * @param instanceId the instanceId * @param providerTypeId the providerTypeId * @param providerTypeInstanceId the providerTypeInstanceId - * @param updateProviderTypeInstanceRequest the updateProviderTypeInstanceRequest */ - public Builder(String providerTypeId, String providerTypeInstanceId, UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest) { + public Builder(String instanceId, String providerTypeId, String providerTypeInstanceId) { + this.instanceId = instanceId; this.providerTypeId = providerTypeId; this.providerTypeInstanceId = providerTypeInstanceId; - this.updateProviderTypeInstanceRequest = updateProviderTypeInstanceRequest; } /** @@ -76,6 +79,17 @@ public UpdateProviderTypeInstanceOptions build() { return new UpdateProviderTypeInstanceOptions(this); } + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the UpdateProviderTypeInstanceOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + /** * Set the providerTypeId. * @@ -99,35 +113,24 @@ public Builder providerTypeInstanceId(String providerTypeInstanceId) { } /** - * Set the updateProviderTypeInstanceRequest. - * - * @param updateProviderTypeInstanceRequest the updateProviderTypeInstanceRequest - * @return the UpdateProviderTypeInstanceOptions builder - */ - public Builder updateProviderTypeInstanceRequest(UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest) { - this.updateProviderTypeInstanceRequest = updateProviderTypeInstanceRequest; - return this; - } - - /** - * Set the xCorrelationId. + * Set the name. * - * @param xCorrelationId the xCorrelationId + * @param name the name * @return the UpdateProviderTypeInstanceOptions builder */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; + public Builder name(String name) { + this.name = name; return this; } /** - * Set the xRequestId. + * Set the attributes. * - * @param xRequestId the xRequestId + * @param attributes the attributes * @return the UpdateProviderTypeInstanceOptions builder */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; + public Builder attributes(Map attributes) { + this.attributes = attributes; return this; } } @@ -135,17 +138,17 @@ public Builder xRequestId(String xRequestId) { protected UpdateProviderTypeInstanceOptions() { } protected UpdateProviderTypeInstanceOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.providerTypeId, "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"); + instanceId = builder.instanceId; providerTypeId = builder.providerTypeId; providerTypeInstanceId = builder.providerTypeInstanceId; - updateProviderTypeInstanceRequest = builder.updateProviderTypeInstanceRequest; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + name = builder.name; + attributes = builder.attributes; } /** @@ -157,6 +160,17 @@ public Builder newBuilder() { return new Builder(this); } + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + /** * Gets the providerTypeId. * @@ -180,40 +194,25 @@ public String providerTypeInstanceId() { } /** - * Gets the updateProviderTypeInstanceRequest. - * - * Provider type instance object to be patched. - * - * @return the updateProviderTypeInstanceRequest - */ - public UpdateProviderTypeInstanceRequest updateProviderTypeInstanceRequest() { - return updateProviderTypeInstanceRequest; - } - - /** - * Gets the xCorrelationId. + * Gets the name. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this headers is not supplied in a request, the service generates a random (version 4) UUID. + * The provider type instance name. * - * @return the xCorrelationId + * @return the name */ - public String xCorrelationId() { - return xCorrelationId; + public String name() { + return name; } /** - * Gets the xRequestId. + * Gets the attributes. * - * The supplied or generated value of this header is logged for a request and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this headers is not supplied in a request, the service generates a random (version 4) UUID. + * The attributes for connecting to the provider type instance. * - * @return the xRequestId + * @return the attributes */ - public String xRequestId() { - return xRequestId; + 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/UpdateScopeOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateScopeOptions.java new file mode 100644 index 00000000..e33a627c --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateScopeOptions.java @@ -0,0 +1,186 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 updateScope options. + */ +public class UpdateScopeOptions extends GenericModel { + + protected String instanceId; + protected String scopeId; + protected String name; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String scopeId; + private String name; + private String description; + + /** + * Instantiates a new Builder from an existing UpdateScopeOptions instance. + * + * @param updateScopeOptions the instance to initialize the Builder with + */ + private Builder(UpdateScopeOptions updateScopeOptions) { + this.instanceId = updateScopeOptions.instanceId; + this.scopeId = updateScopeOptions.scopeId; + this.name = updateScopeOptions.name; + this.description = updateScopeOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param scopeId the scopeId + */ + public Builder(String instanceId, String scopeId) { + this.instanceId = instanceId; + this.scopeId = scopeId; + } + + /** + * Builds a UpdateScopeOptions. + * + * @return the new UpdateScopeOptions instance + */ + public UpdateScopeOptions build() { + return new UpdateScopeOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the UpdateScopeOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the UpdateScopeOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateScopeOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the UpdateScopeOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected UpdateScopeOptions() { } + + protected UpdateScopeOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.scopeId, + "scopeId cannot be empty"); + instanceId = builder.instanceId; + scopeId = builder.scopeId; + name = builder.name; + description = builder.description; + } + + /** + * New builder. + * + * @return a UpdateScopeOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope being targeted. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the name. + * + * The scope name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * The scope description. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSettingsOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSettingsOptions.java index aceba84e..09ca6da7 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSettingsOptions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSettingsOptions.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; @@ -19,19 +20,17 @@ */ public class UpdateSettingsOptions extends GenericModel { - protected EventNotifications eventNotifications; - protected ObjectStorage objectStorage; - protected String xCorrelationId; - protected String xRequestId; + protected String instanceId; + protected ObjectStoragePrototype objectStorage; + protected EventNotificationsPrototype eventNotifications; /** * Builder. */ public static class Builder { - private EventNotifications eventNotifications; - private ObjectStorage objectStorage; - private String xCorrelationId; - private String xRequestId; + private String instanceId; + private ObjectStoragePrototype objectStorage; + private EventNotificationsPrototype eventNotifications; /** * Instantiates a new Builder from an existing UpdateSettingsOptions instance. @@ -39,10 +38,9 @@ public static class Builder { * @param updateSettingsOptions the instance to initialize the Builder with */ private Builder(UpdateSettingsOptions updateSettingsOptions) { - this.eventNotifications = updateSettingsOptions.eventNotifications; + this.instanceId = updateSettingsOptions.instanceId; this.objectStorage = updateSettingsOptions.objectStorage; - this.xCorrelationId = updateSettingsOptions.xCorrelationId; - this.xRequestId = updateSettingsOptions.xRequestId; + this.eventNotifications = updateSettingsOptions.eventNotifications; } /** @@ -51,6 +49,15 @@ private Builder(UpdateSettingsOptions updateSettingsOptions) { public Builder() { } + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + */ + public Builder(String instanceId) { + this.instanceId = instanceId; + } + /** * Builds a UpdateSettingsOptions. * @@ -61,13 +68,13 @@ public UpdateSettingsOptions build() { } /** - * Set the eventNotifications. + * Set the instanceId. * - * @param eventNotifications the eventNotifications + * @param instanceId the instanceId * @return the UpdateSettingsOptions builder */ - public Builder eventNotifications(EventNotifications eventNotifications) { - this.eventNotifications = eventNotifications; + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; return this; } @@ -77,42 +84,19 @@ public Builder eventNotifications(EventNotifications eventNotifications) { * @param objectStorage the objectStorage * @return the UpdateSettingsOptions builder */ - public Builder objectStorage(ObjectStorage objectStorage) { + public Builder objectStorage(ObjectStoragePrototype objectStorage) { this.objectStorage = objectStorage; return this; } /** - * Set the xCorrelationId. - * - * @param xCorrelationId the xCorrelationId - * @return the UpdateSettingsOptions builder - */ - public Builder xCorrelationId(String xCorrelationId) { - this.xCorrelationId = xCorrelationId; - return this; - } - - /** - * Set the xRequestId. - * - * @param xRequestId the xRequestId - * @return the UpdateSettingsOptions builder - */ - public Builder xRequestId(String xRequestId) { - this.xRequestId = xRequestId; - return this; - } - - /** - * Set the settings. + * Set the eventNotifications. * - * @param settings the settings + * @param eventNotifications the eventNotifications * @return the UpdateSettingsOptions builder */ - public Builder settings(Settings settings) { - this.eventNotifications = settings.eventNotifications(); - this.objectStorage = settings.objectStorage(); + public Builder eventNotifications(EventNotificationsPrototype eventNotifications) { + this.eventNotifications = eventNotifications; return this; } } @@ -120,10 +104,11 @@ public Builder settings(Settings settings) { protected UpdateSettingsOptions() { } protected UpdateSettingsOptions(Builder builder) { - eventNotifications = builder.eventNotifications; + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + instanceId = builder.instanceId; objectStorage = builder.objectStorage; - xCorrelationId = builder.xCorrelationId; - xRequestId = builder.xRequestId; + eventNotifications = builder.eventNotifications; } /** @@ -136,51 +121,36 @@ public Builder newBuilder() { } /** - * Gets the eventNotifications. + * Gets the instanceId. * - * The Event Notifications settings. + * The ID of the Security and Compliance Center instance. * - * @return the eventNotifications + * @return the instanceId */ - public EventNotifications eventNotifications() { - return eventNotifications; + public String instanceId() { + return instanceId; } /** * Gets the objectStorage. * - * The Cloud Object Storage settings. + * The payload to connect a Cloud Object Storage instance to an Security and Compliance Center instance. * * @return the objectStorage */ - public ObjectStorage objectStorage() { + public ObjectStoragePrototype objectStorage() { return objectStorage; } /** - * Gets the xCorrelationId. - * - * The supplied or generated value of this header is logged for a request, and repeated in a response header for the - * corresponding response. The same value is used for downstream requests and retries of those requests. If a value of - * this header is not supplied in a request, the service generates a random (version 4) UUID. - * - * @return the xCorrelationId - */ - public String xCorrelationId() { - return xCorrelationId; - } - - /** - * Gets the xRequestId. + * Gets the eventNotifications. * - * The supplied or generated value of this header is logged for a request, and repeated in a response header for the - * corresponding response. The same value is not used for downstream requests and retries of those requests. If a - * value of this header is not supplied in a request, the service generates a random (version 4) UUID. + * The payload to connect an Event Notification instance with a Security and Compliance Center instance. * - * @return the xRequestId + * @return the eventNotifications */ - public String xRequestId() { - return xRequestId; + public EventNotificationsPrototype eventNotifications() { + return eventNotifications; } } diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSubscopeOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSubscopeOptions.java new file mode 100644 index 00000000..6ccf483e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSubscopeOptions.java @@ -0,0 +1,216 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 updateSubscope options. + */ +public class UpdateSubscopeOptions extends GenericModel { + + protected String instanceId; + protected String scopeId; + protected String subscopeId; + protected String name; + protected String description; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String scopeId; + private String subscopeId; + private String name; + private String description; + + /** + * Instantiates a new Builder from an existing UpdateSubscopeOptions instance. + * + * @param updateSubscopeOptions the instance to initialize the Builder with + */ + private Builder(UpdateSubscopeOptions updateSubscopeOptions) { + this.instanceId = updateSubscopeOptions.instanceId; + this.scopeId = updateSubscopeOptions.scopeId; + this.subscopeId = updateSubscopeOptions.subscopeId; + this.name = updateSubscopeOptions.name; + this.description = updateSubscopeOptions.description; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param scopeId the scopeId + * @param subscopeId the subscopeId + */ + public Builder(String instanceId, String scopeId, String subscopeId) { + this.instanceId = instanceId; + this.scopeId = scopeId; + this.subscopeId = subscopeId; + } + + /** + * Builds a UpdateSubscopeOptions. + * + * @return the new UpdateSubscopeOptions instance + */ + public UpdateSubscopeOptions build() { + return new UpdateSubscopeOptions(this); + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the UpdateSubscopeOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the scopeId. + * + * @param scopeId the scopeId + * @return the UpdateSubscopeOptions builder + */ + public Builder scopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + + /** + * Set the subscopeId. + * + * @param subscopeId the subscopeId + * @return the UpdateSubscopeOptions builder + */ + public Builder subscopeId(String subscopeId) { + this.subscopeId = subscopeId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateSubscopeOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the UpdateSubscopeOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected UpdateSubscopeOptions() { } + + protected UpdateSubscopeOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.scopeId, + "scopeId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.subscopeId, + "subscopeId cannot be empty"); + instanceId = builder.instanceId; + scopeId = builder.scopeId; + subscopeId = builder.subscopeId; + name = builder.name; + description = builder.description; + } + + /** + * New builder. + * + * @return a UpdateSubscopeOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the scopeId. + * + * The ID of the scope being targeted. + * + * @return the scopeId + */ + public String scopeId() { + return scopeId; + } + + /** + * Gets the subscopeId. + * + * The ID of the scope being targeted. + * + * @return the subscopeId + */ + public String subscopeId() { + return subscopeId; + } + + /** + * Gets the name. + * + * The scope name. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + * The scope description. + * + * @return the description + */ + public String description() { + return description; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpgradeAttachmentOptions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpgradeAttachmentOptions.java new file mode 100644 index 00000000..4a80d789 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpgradeAttachmentOptions.java @@ -0,0 +1,240 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ibm.cloud.sdk.core.service.model.GenericModel; + +/** + * The upgradeAttachment options. + */ +public class UpgradeAttachmentOptions extends GenericModel { + + protected String instanceId; + protected String profileId; + protected String attachmentId; + protected List attachmentParameters; + protected String accountId; + + /** + * Builder. + */ + public static class Builder { + private String instanceId; + private String profileId; + private String attachmentId; + private List attachmentParameters; + private String accountId; + + /** + * Instantiates a new Builder from an existing UpgradeAttachmentOptions instance. + * + * @param upgradeAttachmentOptions the instance to initialize the Builder with + */ + private Builder(UpgradeAttachmentOptions upgradeAttachmentOptions) { + this.instanceId = upgradeAttachmentOptions.instanceId; + this.profileId = upgradeAttachmentOptions.profileId; + this.attachmentId = upgradeAttachmentOptions.attachmentId; + this.attachmentParameters = upgradeAttachmentOptions.attachmentParameters; + this.accountId = upgradeAttachmentOptions.accountId; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Instantiates a new builder with required properties. + * + * @param instanceId the instanceId + * @param profileId the profileId + * @param attachmentId the attachmentId + * @param attachmentParameters the attachmentParameters + */ + public Builder(String instanceId, String profileId, String attachmentId, List attachmentParameters) { + this.instanceId = instanceId; + this.profileId = profileId; + this.attachmentId = attachmentId; + this.attachmentParameters = attachmentParameters; + } + + /** + * Builds a UpgradeAttachmentOptions. + * + * @return the new UpgradeAttachmentOptions instance + */ + public UpgradeAttachmentOptions build() { + return new UpgradeAttachmentOptions(this); + } + + /** + * Adds a new element to attachmentParameters. + * + * @param attachmentParameters the new element to be added + * @return the UpgradeAttachmentOptions builder + */ + public Builder addAttachmentParameters(Parameter attachmentParameters) { + com.ibm.cloud.sdk.core.util.Validator.notNull(attachmentParameters, + "attachmentParameters cannot be null"); + if (this.attachmentParameters == null) { + this.attachmentParameters = new ArrayList(); + } + this.attachmentParameters.add(attachmentParameters); + return this; + } + + /** + * Set the instanceId. + * + * @param instanceId the instanceId + * @return the UpgradeAttachmentOptions builder + */ + public Builder instanceId(String instanceId) { + this.instanceId = instanceId; + return this; + } + + /** + * Set the profileId. + * + * @param profileId the profileId + * @return the UpgradeAttachmentOptions builder + */ + public Builder profileId(String profileId) { + this.profileId = profileId; + return this; + } + + /** + * Set the attachmentId. + * + * @param attachmentId the attachmentId + * @return the UpgradeAttachmentOptions builder + */ + public Builder attachmentId(String attachmentId) { + this.attachmentId = attachmentId; + return this; + } + + /** + * Set the attachmentParameters. + * Existing attachmentParameters will be replaced. + * + * @param attachmentParameters the attachmentParameters + * @return the UpgradeAttachmentOptions builder + */ + public Builder attachmentParameters(List attachmentParameters) { + this.attachmentParameters = attachmentParameters; + return this; + } + + /** + * Set the accountId. + * + * @param accountId the accountId + * @return the UpgradeAttachmentOptions builder + */ + public Builder accountId(String accountId) { + this.accountId = accountId; + return this; + } + } + + protected UpgradeAttachmentOptions() { } + + protected UpgradeAttachmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.instanceId, + "instanceId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.profileId, + "profileId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.attachmentId, + "attachmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.attachmentParameters, + "attachmentParameters cannot be null"); + instanceId = builder.instanceId; + profileId = builder.profileId; + attachmentId = builder.attachmentId; + attachmentParameters = builder.attachmentParameters; + accountId = builder.accountId; + } + + /** + * New builder. + * + * @return a UpgradeAttachmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the instanceId. + * + * The ID of the Security and Compliance Center instance. + * + * @return the instanceId + */ + public String instanceId() { + return instanceId; + } + + /** + * Gets the profileId. + * + * The profile ID. + * + * @return the profileId + */ + public String profileId() { + return profileId; + } + + /** + * Gets the attachmentId. + * + * The attachment ID. + * + * @return the attachmentId + */ + public String attachmentId() { + return attachmentId; + } + + /** + * Gets the attachmentParameters. + * + * The attachment_parameters to set for a Profile Attachment. + * + * @return the attachmentParameters + */ + public List attachmentParameters() { + return attachmentParameters; + } + + /** + * Gets the accountId. + * + * The user account ID. + * + * @return the accountId + */ + public String accountId() { + return accountId; + } +} + diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/package-info.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/package-info.java index 7388da39..7ce05be7 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/package-info.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/package-info.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ + /** * Security and Compliance Center API v3. */ 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 993fad97..581cca2d 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -19,72 +19,110 @@ import com.ibm.cloud.sdk.core.util.CredentialUtils; import com.ibm.cloud.sdk.core.util.DateUtils; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalProperty; import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalTargetAttribute; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AssessmentPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AssessmentWithStats; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Attachment; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentItem; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentParameterPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentScope; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentsAccountPager; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentsNotificationsPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentsPager; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentsPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComparePredefinedProfilesResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CompareProfileResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CompareProfilesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceScore; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceStats; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDocs; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceStatsWithNonCompliant; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionList; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionListConditionListConditionAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionListConditionListConditionOr; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRuleConditionSubRuleConditionAll; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRuleConditionSubRuleConditionAllIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRuleConditionSubRuleConditionAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConfigurationInformationPoints; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Control; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlChanges; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlChangesUpdated; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrariesPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrary; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryDelete; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationWithStats; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSummary; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlWithStats; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlsInControlLib; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateAttachmentOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateCustomControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProviderTypeInstanceOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateRuleOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanReport; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanReportOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Credential; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CredentialResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DateRange; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersChanges; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersDifference; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteCustomControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteCustomProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteProviderTypeInstanceOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteRuleOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvalDetails; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Endpoint; import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvalStats; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Evaluation; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationPage; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProviderInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.model.EventNotifications; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.FailedControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EventNotificationsPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetLatestReportsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypeByIdOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypeInstanceOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypesInstancesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportControlsOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportEvaluationOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportDownloadFileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportRuleOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportSummaryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportTagsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportViolationsDriftOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScanReportDownloadFileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScanReportOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetServiceOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetSettingsOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Implementation; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetTargetOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Import; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.InstanceAttachmentsPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.LabelType; import com.ibm.cloud.security_and_compliance_center_api.v3.model.LastScan; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListAttachmentsAccountOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Link; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListControlLibrariesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListInstanceAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfileAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfileParametersOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfilesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProviderTypeInstancesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProviderTypesOptions; @@ -92,77 +130,109 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListReportResourcesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListReportsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListRulesOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListScanReportsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListScopesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListServicesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListSubscopesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListTargetsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayload; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadById; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadByProperties; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ObjectStorage; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PageHRef; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ObjectStoragePrototype; 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.PaginatedCollectionFirst; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PaginatedCollectionNext; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.model.PostTestEventOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Profile; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControlsPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileDefaultParametersResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileInfo; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileItem; 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; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypesCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypesInstancesResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderType; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstance; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceCustomControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileParametersOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceTargetOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Report; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportControls; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportEvaluationsPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportLatest; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportPage; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportResourcesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportScope; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportSummary; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportTags; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportViolationDataPoint; 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.RequiredConfigItemsRequiredConfigAndDepth1; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigBase; -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.RequiredConfigConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionList; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionListConditionListConditionAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionListConditionListConditionOr; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRuleConditionSubRuleConditionAll; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRuleConditionSubRuleConditionAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf; 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; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ResourceSummaryItem; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Rule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleCollection; 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.RuleParameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTargetPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RulesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScanReport; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScanReportCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeID; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyExclusionItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyExclusions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeId; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeType; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Service; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ServiceCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Settings; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScopeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScopeResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubscopesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SupportedConfigs; 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.TargetCollection; 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.UpdateScopeOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSettingsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpgradeAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; -import com.ibm.cloud.security_and_compliance_center_api.test.SdkIntegrationTestBase; +import com.ibm.cloud.test.SdkIntegrationTestBase; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; @@ -195,12 +265,14 @@ public class SecurityAndComplianceCenterApiIT extends SdkIntegrationTestBase { String objectStorageLocationForUpdateSettingsLink = null; String profileIdForReportLink = null; String profileIdLink = null; - String providerTypeIdLink = null; String providerTypeInstanceIdLink = null; String reportIdForReportLink = null; String ruleIdLink = null; + String scanIdForScanReportLink = null; + String scopeIdLink = null; + String subScopeIdLink = null; + String targetIdLink = null; String typeForReportLink = null; - String xCorrelationIdLink = null; /** * This method provides our config filename to the base class. @@ -236,8 +308,7 @@ public void constructService() { public void testGetSettings() throws Exception { try { GetSettingsOptions getSettingsOptions = new GetSettingsOptions.Builder() - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .build(); // Invoke operation @@ -247,13 +318,12 @@ public void testGetSettings() throws Exception { assertEquals(response.getStatusCode(), 200); Settings settingsResult = response.getResult(); - assertNotNull(settingsResult); - eventNotificationsCrnForUpdateSettingsLink = settingsResult.eventNotifications().instanceCrn(); - objectStorageCrnForUpdateSettingsLink = settingsResult.objectStorage().instanceCrn(); - objectStorageBucketForUpdateSettingsLink = settingsResult.objectStorage().bucket(); - objectStorageLocationForUpdateSettingsLink = settingsResult.objectStorage().bucketLocation(); - xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); + + eventNotificationsCrnForUpdateSettingsLink = settingsResult.getEventNotifications().getInstanceCrn(); + objectStorageCrnForUpdateSettingsLink = settingsResult.getObjectStorage().getInstanceCrn(); + objectStorageBucketForUpdateSettingsLink = settingsResult.getObjectStorage().getBucket(); + objectStorageLocationForUpdateSettingsLink = settingsResult.getObjectStorage().getBucketLocation(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -261,314 +331,950 @@ public void testGetSettings() throws Exception { } @Test(dependsOnMethods = { "testGetSettings" }) - public void testCreateRule() throws Exception { + public void testUpdateSettings() throws Exception { try { - AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() - .name("location") - .operator("string_equals") - .value("us-east") + ObjectStoragePrototype objectStoragePrototypeModel = new ObjectStoragePrototype.Builder() + .bucket("px-scan-results") + .instanceCrn("crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") .build(); - TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() - .serviceName("cloud-object-storage") - .resourceKind("bucket") - .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + EventNotificationsPrototype eventNotificationsPrototypeModel = new EventNotificationsPrototype.Builder() + .instanceCrn("crn:v1:staging: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("scc-sdk-integration") + .build(); + + UpdateSettingsOptions updateSettingsOptions = new UpdateSettingsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .objectStorage(objectStoragePrototypeModel) + .eventNotifications(eventNotificationsPrototypeModel) + .build(); + + // Invoke operation + Response response = service.updateSettings(updateSettingsOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + Settings settingsResult = response.getResult(); + assertNotNull(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() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .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 = { "testPostTestEvent" }) + public void testListInstanceAttachments() throws Exception { + try { + ListInstanceAttachmentsOptions listInstanceAttachmentsOptions = new ListInstanceAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId(accountIdForReportLink) + .versionGroupLabel("6702d85a-6437-4d6f-8701-c0146648787b") + .limit(Long.valueOf("10")) + .sort("created_on") + .direction("desc") + .start("testString") + .build(); + + // Invoke operation + Response response = service.listInstanceAttachments(listInstanceAttachmentsOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ProfileAttachmentCollection profileAttachmentCollectionResult = response.getResult(); + assertNotNull(profileAttachmentCollectionResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testListInstanceAttachments" }) + public void testListInstanceAttachmentsWithPager() throws Exception { + try { + ListInstanceAttachmentsOptions options = new ListInstanceAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId(accountIdForReportLink) + .versionGroupLabel("6702d85a-6437-4d6f-8701-c0146648787b") + .limit(Long.valueOf("10")) + .sort("created_on") + .direction("desc") + .build(); + + // Test getNext(). + List allResults = new ArrayList<>(); + InstanceAttachmentsPager pager = new InstanceAttachmentsPager(service, options); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertFalse(allResults.isEmpty()); + + // Test getAll(); + pager = new InstanceAttachmentsPager(service, options); + List allItems = pager.getAll(); + assertNotNull(allItems); + assertFalse(allItems.isEmpty()); + + assertEquals(allItems.size(), allResults.size()); + 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 = { "testListInstanceAttachments" }) + public void testCreateProfileAttachment() throws Exception { + try { + Parameter parameterModel = new Parameter.Builder() + .assessmentType("automated") + .assessmentId("rule-e16fcfea-fe21-4d30-a721-423611481fea") + .parameterName("tls_version") + .parameterDisplayName("IBM Cloud Internet Services TLS version") + .parameterType("string_list") + .parameterValue("[\"1.2\", \"1.3\"]") .build(); - RequiredConfigItemsRequiredConfigBase requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigBase.Builder() + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList()) + .build(); + + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() + .enabled(true) + .controls(attachmentNotificationsControlsModel) + .build(); + + MultiCloudScopePayloadById multiCloudScopePayloadModel = new MultiCloudScopePayloadById.Builder() + .id("8baad3b5-2e69-4027-9967-efac19508e1c") + .build(); + + DateRange dateRangeModel = new DateRange.Builder() + .startDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .endDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .build(); + + ProfileAttachmentBase profileAttachmentBaseModel = new ProfileAttachmentBase.Builder() + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .description("This is a profile attachment targeting IBM CIS Foundation using a SDK") + .name("Profile Attachment for IBM CIS Foundation SDK test") + .notifications(attachmentNotificationsModel) + .schedule("daily") + .scope(java.util.Arrays.asList(multiCloudScopePayloadModel)) + .status("disabled") + .dataSelectionRange(dateRangeModel) + .build(); + + CreateProfileAttachmentOptions createProfileAttachmentOptions = new CreateProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .newAttachments(java.util.Arrays.asList(profileAttachmentBaseModel)) + .newProfileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3") + .accountId(accountIdForReportLink) + .build(); + + // Invoke operation + Response response = service.createProfileAttachment(createProfileAttachmentOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 201); + + ProfileAttachmentResponse profileAttachmentResponseResult = response.getResult(); + assertNotNull(profileAttachmentResponseResult); + + attachmentIdLink = profileAttachmentResponseResult.getAttachments().get(0).getId(); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testCreateProfileAttachment" }) + public void testGetProfileAttachment() throws Exception { + try { + GetProfileAttachmentOptions getProfileAttachmentOptions = new GetProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId(attachmentIdLink) + .accountId(accountIdForReportLink) + .build(); + + // Invoke operation + Response response = service.getProfileAttachment(getProfileAttachmentOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ProfileAttachment profileAttachmentResult = response.getResult(); + assertNotNull(profileAttachmentResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testGetProfileAttachment" }) + public void testReplaceProfileAttachment() throws Exception { + try { + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList("testString")) + .build(); + + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() + .enabled(true) + .controls(attachmentNotificationsControlsModel) + .build(); + + MultiCloudScopePayloadById multiCloudScopePayloadModel = new MultiCloudScopePayloadById.Builder() + .id("testString") + .build(); + + DateRange dateRangeModel = new DateRange.Builder() + .startDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .endDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .build(); + + ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions = new ReplaceProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId(attachmentIdLink) + .attachmentParameters(java.util.Arrays.asList(parameterModel)) .description("testString") - .property("hard_quota") - .operator("num_equals") - .value("${hard_quota}") + .name("testString") + .notifications(attachmentNotificationsModel) + .schedule("daily") + .scope(java.util.Arrays.asList(multiCloudScopePayloadModel)) + .status("enabled") + .dataSelectionRange(dateRangeModel) + .accountId(accountIdForReportLink) .build(); - RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() - .description("The Cloud Object Storage rule.") - .and(java.util.Arrays.asList(requiredConfigItemsModel)) + // Invoke operation + Response response = service.replaceProfileAttachment(replaceProfileAttachmentOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ProfileAttachment profileAttachmentResult = response.getResult(); + assertNotNull(profileAttachmentResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testReplaceProfileAttachment" }) + public void testUpgradeAttachment() throws Exception { + try { + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + + UpgradeAttachmentOptions upgradeAttachmentOptions = new UpgradeAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId(attachmentIdLink) + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .accountId(accountIdForReportLink) + .build(); + + // Invoke operation + Response response = service.upgradeAttachment(upgradeAttachmentOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ProfileAttachment profileAttachmentResult = response.getResult(); + assertNotNull(profileAttachmentResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testUpgradeAttachment" }) + public void testCreateScan() throws Exception { + try { + CreateScanOptions createScanOptions = new CreateScanOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .attachmentId("4deb572c-9f37-4126-9cc0-d550672533cb") + .accountId(accountIdForReportLink) + .build(); + + // Invoke operation + Response response = service.createScan(createScanOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 201); + + CreateScanResponse createScanResponseResult = response.getResult(); + assertNotNull(createScanResponseResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testCreateScan" }) + public void testCreateControlLibrary() throws Exception { + try { + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e") + .assessmentDescription("This rule will check on regulation") + .build(); + + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("apprapp") + .environment("ibm-cloud") + .controlSpecificationId("testString") + .controlSpecificationDescription("This field is used to describe a control specification") + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) + .build(); + + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + + ControlPrototype controlPrototypeModel = new ControlPrototype.Builder() + .controlName("security") + .controlDescription("This is a description of a control") + .controlCategory("test-control") + .controlRequirement(true) + .controlParent("testString") + .controlSpecifications(java.util.Arrays.asList(controlSpecificationPrototypeModel)) + .controlDocs(controlDocModel) + .status("disabled") + .build(); + + CreateControlLibraryOptions createControlLibraryOptions = new CreateControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryName("custom control library from SDK") + .controlLibraryDescription("This is a custom control library made from the SDK test framework") + .controlLibraryType("custom") + .controlLibraryVersion("0.0.1") + .controls(java.util.Arrays.asList(controlPrototypeModel)) + .accountId(accountIdForReportLink) + .build(); + + // Invoke operation + Response response = service.createControlLibrary(createControlLibraryOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 201); + + ControlLibrary controlLibraryResult = response.getResult(); + assertNotNull(controlLibraryResult); + + controlLibraryIdLink = controlLibraryResult.getId(); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testCreateControlLibrary" }) + public void testListControlLibraries() throws Exception { + try { + ListControlLibrariesOptions listControlLibrariesOptions = new ListControlLibrariesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId(accountIdForReportLink) + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke operation + Response response = service.listControlLibraries(listControlLibrariesOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ControlLibraryCollection controlLibraryCollectionResult = response.getResult(); + assertNotNull(controlLibraryCollectionResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testListControlLibraries" }) + public void testListControlLibrariesWithPager() throws Exception { + try { + ListControlLibrariesOptions options = new ListControlLibrariesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId(accountIdForReportLink) + .limit(Long.valueOf("10")) + .build(); + + // Test getNext(). + List allResults = new ArrayList<>(); + ControlLibrariesPager pager = new ControlLibrariesPager(service, options); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertFalse(allResults.isEmpty()); + + // Test getAll(); + pager = new ControlLibrariesPager(service, options); + List allItems = pager.getAll(); + assertNotNull(allItems); + assertFalse(allItems.isEmpty()); + + assertEquals(allItems.size(), allResults.size()); + 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 = { "testListControlLibraries" }) + public void testReplaceCustomControlLibrary() throws Exception { + try { + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e") + .assessmentDescription("This rule will check on regulation") + .build(); + + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("apprapp") + .environment("ibm-cloud") + .controlSpecificationId("testString") + .controlSpecificationDescription("This field is used to describe a control specification") + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) + .build(); + + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + + ControlPrototype controlPrototypeModel = new ControlPrototype.Builder() + .controlName("security") + .controlDescription("This is a description of a control") + .controlCategory("test-control") + .controlRequirement(true) + .controlParent("testString") + .controlSpecifications(java.util.Arrays.asList(controlSpecificationPrototypeModel)) + .controlDocs(controlDocModel) + .status("disabled") + .build(); + + ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptions = new ReplaceCustomControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId(controlLibraryIdLink) + .controlLibraryName("custom control library from SDK") + .controlLibraryDescription("This is a custom control library made from the SDK test framework") + .controlLibraryType("custom") + .controlLibraryVersion("0.0.2") + .controls(java.util.Arrays.asList(controlPrototypeModel)) + .bssAccount("testString") + .build(); + + // Invoke operation + Response response = service.replaceCustomControlLibrary(replaceCustomControlLibraryOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ControlLibrary controlLibraryResult = response.getResult(); + assertNotNull(controlLibraryResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testReplaceCustomControlLibrary" }) + public void testGetControlLibrary() throws Exception { + try { + GetControlLibraryOptions getControlLibraryOptions = new GetControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId(controlLibraryIdLink) + .accountId(accountIdForReportLink) + .build(); + + // Invoke operation + Response response = service.getControlLibrary(getControlLibraryOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ControlLibrary controlLibraryResult = response.getResult(); + assertNotNull(controlLibraryResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testGetControlLibrary" }) + public void testCreateProfile() throws Exception { + try { + ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() + .controlLibraryId("a046fb6b-aba5-4646-b190-a2c76241e7af") + .controlId("60dae3b5-6104-4b3e-bac7-26cc7b741aca") + .build(); + + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("automated") + .assessmentId("rule-e16fcfea-fe21-4d30-a721-423611481fea") + .parameterName("tls_version") + .parameterDefaultValue("[\"1.2\",\"1.3\"]") + .parameterDisplayName("IBM Cloud Internet Services TLS version") + .parameterType("string_list") + .build(); + + CreateProfileOptions createProfileOptions = new CreateProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileName("Example Profile") + .profileVersion("0.0.1") + .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .profileDescription("This profile is created as an example of the SDK gen") + .latest(true) + .versionGroupLabel("testString") + .accountId(accountIdForReportLink) + .build(); + + // Invoke operation + Response response = service.createProfile(createProfileOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 201); + + Profile profileResult = response.getResult(); + assertNotNull(profileResult); + + profileIdLink = profileResult.id(); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testCreateProfile" }) + public void testListProfiles() throws Exception { + try { + ListProfilesOptions listProfilesOptions = new ListProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId(accountIdForReportLink) + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke operation + Response response = service.listProfiles(listProfilesOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ProfileCollection profileCollectionResult = response.getResult(); + assertNotNull(profileCollectionResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testListProfiles" }) + public void testListProfilesWithPager() throws Exception { + try { + ListProfilesOptions options = new ListProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId(accountIdForReportLink) + .limit(Long.valueOf("10")) + .build(); + + // Test getNext(). + List allResults = new ArrayList<>(); + ProfilesPager pager = new ProfilesPager(service, options); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertFalse(allResults.isEmpty()); + + // Test getAll(); + pager = new ProfilesPager(service, options); + List allItems = pager.getAll(); + assertNotNull(allItems); + assertFalse(allItems.isEmpty()); + + assertEquals(allItems.size(), allResults.size()); + 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 = { "testListProfiles" }) + public void testReplaceProfile() throws Exception { + try { + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") .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") + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") .build(); - Import importModel = new Import.Builder() + Assessment assessmentModel = new Assessment.Builder() + .assessmentId("382c2b06-e6b2-43ee-b189-c1c7743b67ee") + .assessmentType("ibm-cloud-rule") + .assessmentMethod("ibm-cloud-rule") + .assessmentDescription("Check whether Cloud Object Storage is accessible only by using private endpoints") + .parameterCount(Long.valueOf("1")) .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()) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + ControlSpecification controlSpecificationModel = new ControlSpecification.Builder() + .id("testString") + .responsibility("testString") + .componentId("testString") + .componentName("testString") + .componentType("testString") + .environment("testString") + .description("testString") + .assessmentsCount(Long.valueOf("26")) + .assessments(java.util.Arrays.asList(assessmentModel)) + .build(); + + ProfileControls profileControlsModel = new ProfileControls.Builder() + .controlRequirement(true) + .controlLibraryId("a046fb6b-aba5-4646-b190-a2c76241e7af") + .controlId("60dae3b5-6104-4b3e-bac7-26cc7b741aca") + .controlLibraryVersion("testString") + .controlName("testString") + .controlDescription("testString") + .controlSeverity("testString") + .controlCategory("testString") + .controlParent("testString") + .controlDocs(controlDocModel) + .controlSpecifications(java.util.Arrays.asList(controlSpecificationModel)) + .build(); + + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("automated") + .assessmentId("rule-e16fcfea-fe21-4d30-a721-423611481fea") + .parameterName("tls_version") + .parameterDefaultValue("[\"1.2\",\"1.3\"]") + .parameterDisplayName("IBM Cloud Internet Services TLS version") + .parameterType("string_list") + .build(); + + ReplaceProfileOptions replaceProfileOptions = new ReplaceProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) + .newProfileType("custom") + .newControls(java.util.Arrays.asList(profileControlsModel)) + .newDefaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .newId("testString") + .newProfileName("Example Profile Updated") + .newInstanceId("testString") + .newHierarchyEnabled(true) + .newProfileDescription("This profile has been updated") + .newProfileVersion("0.0.2") + .newVersionGroupLabel("testString") + .newLatest(true) + .newCreatedBy("testString") + .newCreatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + .newUpdatedBy("testString") + .newUpdatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + .newControlsCount(Long.valueOf("26")) + .newAttachmentsCount(Long.valueOf("26")) + .accountId(accountIdForReportLink) .build(); // Invoke operation - Response response = service.createRule(createRuleOptions).execute(); + Response response = service.replaceProfile(replaceProfileOptions).execute(); // Validate response assertNotNull(response); - assertEquals(response.getStatusCode(), 201); + assertEquals(response.getStatusCode(), 200); + + Profile profileResult = response.getResult(); + assertNotNull(profileResult); - 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", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testCreateRule" }) - public void testGetRule() throws Exception { + @Test(dependsOnMethods = { "testReplaceProfile" }) + public void testGetProfile() throws Exception { try { - GetRuleOptions getRuleOptions = new GetRuleOptions.Builder() - .ruleId(ruleIdLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + GetProfileOptions getProfileOptions = new GetProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) + .accountId(accountIdForReportLink) .build(); // Invoke operation - Response response = service.getRule(getRuleOptions).execute(); + Response response = service.getProfile(getProfileOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - Rule ruleResult = response.getResult(); + Profile profileResult = response.getResult(); + assertNotNull(profileResult); - assertNotNull(ruleResult); - eTagLink = response.getHeaders().values("ETag").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 = { "testGetRule" }) - public void testGetLatestReports() throws Exception { + @Test(dependsOnMethods = { "testGetProfile" }) + public void testReplaceProfileParameters() throws Exception { try { - GetLatestReportsOptions getLatestReportsOptions = new GetLatestReportsOptions.Builder() - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") - .sort("profile_name") + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("testString") + .parameterDefaultValue("testString") + .parameterDisplayName("testString") + .parameterType("testString") + .build(); + + ReplaceProfileParametersOptions replaceProfileParametersOptions = new ReplaceProfileParametersOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .id("testString") + .accountId(accountIdForReportLink) .build(); // Invoke operation - Response response = service.getLatestReports(getLatestReportsOptions).execute(); + Response response = service.replaceProfileParameters(replaceProfileParametersOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ReportLatest reportLatestResult = response.getResult(); + ProfileDefaultParametersResponse profileDefaultParametersResponseResult = response.getResult(); + assertNotNull(profileDefaultParametersResponseResult); - 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(); - groupIdForReportLink = reportLatestResult.getReports().get(0).getGroupId(); - profileIdForReportLink = reportLatestResult.getReports().get(0).getProfile().getId(); - typeForReportLink = reportLatestResult.getReports().get(0).getType(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testGetLatestReports" }) - public void testUpdateSettings() throws Exception { + @Test(dependsOnMethods = { "testReplaceProfileParameters" }) + public void testListProfileParameters() throws Exception { try { - EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .instanceCrn(eventNotificationsCrnForUpdateSettingsLink) - .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::") - .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) - .bucketEndpoint("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .build(); - - UpdateSettingsOptions updateSettingsOptions = new UpdateSettingsOptions.Builder() - .eventNotifications(eventNotificationsModel) - .objectStorage(objectStorageModel) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + ListProfileParametersOptions listProfileParametersOptions = new ListProfileParametersOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) .build(); // Invoke operation - Response response = service.updateSettings(updateSettingsOptions).execute(); + Response response = service.listProfileParameters(listProfileParametersOptions).execute(); // Validate response assertNotNull(response); - assertEquals(response.getStatusCode(), 204); + assertEquals(response.getStatusCode(), 200); - Settings settingsResult = response.getResult(); + ProfileDefaultParametersResponse profileDefaultParametersResponseResult = response.getResult(); + assertNotNull(profileDefaultParametersResponseResult); - 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 { + @Test(dependsOnMethods = { "testListProfileParameters" }) + public void testCompareProfiles() throws Exception { try { - PostTestEventOptions postTestEventOptions = new PostTestEventOptions.Builder() - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + CompareProfilesOptions compareProfilesOptions = new CompareProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("2f598907-970d-4d52-9071-5cc95912f55e") + .accountId(accountIdForReportLink) .build(); // Invoke operation - Response response = service.postTestEvent(postTestEventOptions).execute(); + Response response = service.compareProfiles(compareProfilesOptions).execute(); // Validate response assertNotNull(response); - assertEquals(response.getStatusCode(), 202); + assertEquals(response.getStatusCode(), 200); - TestEvent testEventResult = response.getResult(); + ComparePredefinedProfilesResponse comparePredefinedProfilesResponseResult = response.getResult(); + assertNotNull(comparePredefinedProfilesResponseResult); - 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 { + @Test(dependsOnMethods = { "testCompareProfiles" }) + public void testListProfileAttachments() throws Exception { try { - ParameterInfo parameterInfoModel = new ParameterInfo.Builder() - .parameterName("session_invalidation_in_seconds") - .parameterDisplayName("Sign out due to inactivity in seconds") - .parameterType("numeric") - .parameterValue("public") + ListProfileAttachmentsOptions listProfileAttachmentsOptions = new ListProfileAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .accountId(accountIdForReportLink) .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") - .parameterCount(Long.valueOf("26")) - .parameters(java.util.Arrays.asList(parameterInfoModel)) - .build(); + // Invoke operation + Response response = service.listProfileAttachments(listProfileAttachmentsOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); - 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") - .assessmentsCount(Long.valueOf("26")) - .assessments(java.util.Arrays.asList(implementationModel)) - .build(); + ProfileAttachmentCollection profileAttachmentCollectionResult = response.getResult(); + assertNotNull(profileAttachmentCollectionResult); - ControlDocs controlDocsModel = new ControlDocs.Builder() - .controlDocsId("sc-7") - .controlDocsType("ibm-cloud") - .build(); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } - ControlsInControlLib controlsInControlLibModel = new ControlsInControlLib.Builder() - .controlName("SC-7") - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") - .controlDescription("Boundary Protection") - .controlCategory("System and Communications Protection") - .controlParent("") - .controlTags(java.util.Arrays.asList("1fa45e17-9322-4e6c-bbd6-1c51db08e790")) - .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) - .controlDocs(controlDocsModel) - .controlRequirement(true) - .status("enabled") + @Test(dependsOnMethods = { "testListProfileAttachments" }) + public void testCreateScope() throws Exception { + try { + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("scope_id") + .value("ff88f007f9ff4622aac4fbc0eda36255") .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)) - .controlLibraryVersion("1.0.0") - .latest(true) - .controlsCount(Long.valueOf("26")) - .xCorrelationId("testString") - .xRequestId("testString") + CreateScopeOptions createScopeOptions = new CreateScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .name("ibm scope") + .description("The scope that is defined for IBM resources.") + .environment("ibm-cloud") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) .build(); // Invoke operation - Response response = service.createCustomControlLibrary(createCustomControlLibraryOptions).execute(); + Response response = service.createScope(createScopeOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 201); - ControlLibrary controlLibraryResult = response.getResult(); + Scope scopeResult = response.getResult(); + assertNotNull(scopeResult); - assertNotNull(controlLibraryResult); - controlLibraryIdLink = controlLibraryResult.id(); + scopeIdLink = scopeResult.getId(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testCreateCustomControlLibrary" }) - public void testListControlLibraries() throws Exception { + @Test(dependsOnMethods = { "testCreateScope" }) + public void testListScopes() throws Exception { try { - ListControlLibrariesOptions listControlLibrariesOptions = new ListControlLibrariesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("1")) - .controlLibraryType("custom") + ListScopesOptions listScopesOptions = new ListScopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .start("testString") + .name("testString") + .description("testString") + .environment("testString") .build(); // Invoke operation - Response response = service.listControlLibraries(listControlLibrariesOptions).execute(); + Response response = service.listScopes(listScopesOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ControlLibraryCollection controlLibraryCollectionResult = response.getResult(); + ScopeCollection scopeCollectionResult = response.getResult(); + assertNotNull(scopeCollectionResult); - assertNotNull(controlLibraryCollectionResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testListControlLibraries" }) - public void testListControlLibrariesWithPager() throws Exception { + @Test(dependsOnMethods = { "testListScopes" }) + public void testListScopesWithPager() throws Exception { try { - ListControlLibrariesOptions options = new ListControlLibrariesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("50")) - .controlLibraryType("custom") + ListScopesOptions options = new ListScopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .name("testString") + .description("testString") + .environment("testString") .build(); // Test getNext(). - List allResults = new ArrayList<>(); - ControlLibrariesPager pager = new ControlLibrariesPager(service, options); + List allResults = new ArrayList<>(); + ScopesPager pager = new ScopesPager(service, options); while (pager.hasNext()) { - List nextPage = pager.getNext(); + List nextPage = pager.getNext(); assertNotNull(nextPage); allResults.addAll(nextPage); } assertFalse(allResults.isEmpty()); // Test getAll(); - pager = new ControlLibrariesPager(service, options); - List allItems = pager.getAll(); + pager = new ScopesPager(service, options); + List allItems = pager.getAll(); assertNotNull(allItems); assertFalse(allItems.isEmpty()); @@ -580,205 +1286,144 @@ public void testListControlLibrariesWithPager() throws Exception { } } - @Test(dependsOnMethods = { "testListControlLibraries" }) - public void testGetControlLibrary() throws Exception { + @Test(dependsOnMethods = { "testListScopes" }) + public void testUpdateScope() throws Exception { try { - GetControlLibraryOptions getControlLibraryOptions = new GetControlLibraryOptions.Builder() - .controlLibrariesId(controlLibraryIdLink) - .xCorrelationId("testString") - .xRequestId("testString") + UpdateScopeOptions updateScopeOptions = new UpdateScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .name("updated name of scope") + .description("updated scope description") .build(); // Invoke operation - Response response = service.getControlLibrary(getControlLibraryOptions).execute(); + Response response = service.updateScope(updateScopeOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ControlLibrary controlLibraryResult = response.getResult(); + Scope scopeResult = response.getResult(); + assertNotNull(scopeResult); - assertNotNull(controlLibraryResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testGetControlLibrary" }) - public void testReplaceCustomControlLibrary() throws Exception { + @Test(dependsOnMethods = { "testUpdateScope" }) + public void testGetScope() throws Exception { try { - ParameterInfo parameterInfoModel = new ParameterInfo.Builder() - .parameterName("session_invalidation_in_seconds") - .parameterDisplayName("Sign out due to inactivity in seconds") - .parameterType("numeric") - .parameterValue("public") - .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") - .parameterCount(Long.valueOf("26")) - .parameters(java.util.Arrays.asList(parameterInfoModel)) - .build(); - - 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") - .assessmentsCount(Long.valueOf("26")) - .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") - .controlParent("") - .controlTags(java.util.Arrays.asList("1fa45e17-9322-4e6c-bbd6-1c51db08e790")) - .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) - .controlDocs(controlDocsModel) - .controlRequirement(true) - .status("enabled") - .build(); - - ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptions = new ReplaceCustomControlLibraryOptions.Builder() - .controlLibrariesId(controlLibraryIdLink) - .id("testString") - .accountId(config.get("ACCOUNTID")) - .controlLibraryName("IBM Cloud for Financial Services") - .controlLibraryDescription("IBM Cloud for Financial Services") - .controlLibraryType("custom") - .controlLibraryVersion("1.1.0") - .createdOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .createdBy("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .updatedBy("testString") - .latest(true) - .hierarchyEnabled(true) - .controlsCount(Long.valueOf("26")) - .controlParentsCount(Long.valueOf("26")) - .controls(java.util.Arrays.asList(controlsInControlLibModel)) - .xCorrelationId("testString") - .xRequestId("testString") + GetScopeOptions getScopeOptions = new GetScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) .build(); // Invoke operation - Response response = service.replaceCustomControlLibrary(replaceCustomControlLibraryOptions).execute(); + Response response = service.getScope(getScopeOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ControlLibrary controlLibraryResult = response.getResult(); + Scope scopeResult = response.getResult(); + assertNotNull(scopeResult); - assertNotNull(controlLibraryResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testReplaceCustomControlLibrary" }) - public void testCreateProfile() throws Exception { + @Test(dependsOnMethods = { "testGetScope" }) + public void testCreateSubscope() throws Exception { try { - ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() - .controlLibraryId(controlLibraryIdLink) - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("scope_id") + .value("1f689f08ec9b47b885c2659c17029581") .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") + ScopePrototype scopePrototypeModel = new ScopePrototype.Builder() + .name("ibm subscope update") + .description("The subscope that is defined for IBM resources.") + .environment("ibm-cloud") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) .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)) - .xCorrelationId("testString") - .xRequestId("testString") + CreateSubscopeOptions createSubscopeOptions = new CreateSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .subscopes(java.util.Arrays.asList(scopePrototypeModel)) .build(); // Invoke operation - Response response = service.createProfile(createProfileOptions).execute(); + Response response = service.createSubscope(createSubscopeOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 201); - Profile profileResult = response.getResult(); + SubScopeResponse subScopeResponseResult = response.getResult(); + assertNotNull(subScopeResponseResult); - assertNotNull(profileResult); - profileIdLink = profileResult.getId(); + subScopeIdLink = subScopeResponseResult.getSubscopes().get(0).getId(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testCreateProfile" }) - public void testListProfiles() throws Exception { + @Test(dependsOnMethods = { "testCreateSubscope" }) + public void testListSubscopes() throws Exception { try { - ListProfilesOptions listProfilesOptions = new ListProfilesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("1")) - .profileType("custom") + ListSubscopesOptions listSubscopesOptions = new ListSubscopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .limit(Long.valueOf("10")) + .start("testString") + .name("testString") + .description("testString") + .environment("testString") .build(); // Invoke operation - Response response = service.listProfiles(listProfilesOptions).execute(); + Response response = service.listSubscopes(listSubscopesOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ProfileCollection profileCollectionResult = response.getResult(); + SubScopeCollection subScopeCollectionResult = response.getResult(); + assertNotNull(subScopeCollectionResult); - assertNotNull(profileCollectionResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testListProfiles" }) - public void testListProfilesWithPager() throws Exception { + @Test(dependsOnMethods = { "testListSubscopes" }) + public void testListSubscopesWithPager() throws Exception { try { - ListProfilesOptions options = new ListProfilesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + ListSubscopesOptions options = new ListSubscopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) .limit(Long.valueOf("10")) - .profileType("custom") + .name("testString") + .description("testString") + .environment("testString") .build(); // Test getNext(). - List allResults = new ArrayList<>(); - ProfilesPager pager = new ProfilesPager(service, options); + List allResults = new ArrayList<>(); + SubscopesPager pager = new SubscopesPager(service, options); while (pager.hasNext()) { - List nextPage = pager.getNext(); + List nextPage = pager.getNext(); assertNotNull(nextPage); allResults.addAll(nextPage); } assertFalse(allResults.isEmpty()); // Test getAll(); - pager = new ProfilesPager(service, options); - List allItems = pager.getAll(); + pager = new SubscopesPager(service, options); + List allItems = pager.getAll(); assertNotNull(allItems); assertFalse(allItems.isEmpty()); @@ -790,453 +1435,427 @@ public void testListProfilesWithPager() throws Exception { } } - @Test(dependsOnMethods = { "testListProfiles" }) - public void testGetProfile() throws Exception { + @Test(dependsOnMethods = { "testListSubscopes" }) + public void testGetSubscope() throws Exception { try { - GetProfileOptions getProfileOptions = new GetProfileOptions.Builder() - .profileId(profileIdLink) - .xCorrelationId("testString") - .xRequestId("testString") + GetSubscopeOptions getSubscopeOptions = new GetSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .subscopeId(subScopeIdLink) .build(); // Invoke operation - Response response = service.getProfile(getProfileOptions).execute(); + Response response = service.getSubscope(getSubscopeOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - Profile profileResult = response.getResult(); + SubScope subScopeResult = response.getResult(); + assertNotNull(subScopeResult); - assertNotNull(profileResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testGetProfile" }) - public void testReplaceProfile() throws Exception { + @Test(dependsOnMethods = { "testGetSubscope" }) + public void testUpdateSubscope() throws Exception { try { - 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(); - - 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)) - .xCorrelationId("testString") - .xRequestId("testString") + UpdateSubscopeOptions updateSubscopeOptions = new UpdateSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .subscopeId(subScopeIdLink) + .name("updated name of scope") + .description("updated scope description") .build(); // Invoke operation - Response response = service.replaceProfile(replaceProfileOptions).execute(); + Response response = service.updateSubscope(updateSubscopeOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - Profile profileResult = response.getResult(); + SubScope subScopeResult = response.getResult(); + assertNotNull(subScopeResult); - assertNotNull(profileResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testReplaceProfile" }) - public void testListRules() throws Exception { + @Test(dependsOnMethods = { "testUpdateSubscope" }) + public void testCreateTarget() throws Exception { try { - ListRulesOptions listRulesOptions = new ListRulesOptions.Builder() - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") - .type("system_defined") - .search("testString") - .serviceName("testString") + Account accountModel = new Account.Builder() + .id("531fc3e28bfc43c5a2cea07786d93f5c") + .name("NIST") + .type("account_type") + .build(); + + Tags tagsModel = new Tags.Builder() + .user(java.util.Arrays.asList("testString")) + .access(java.util.Arrays.asList("testString")) + .service(java.util.Arrays.asList("testString")) + .build(); + + Resource resourceModel = new Resource.Builder() + .reportId("30b434b3-cb08-4845-af10-7a8fc682b6a8") + .homeAccountId("2411ffdc16844b07b42521c3443f456d") + .id("crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::") + .resourceName("jeff's key") + .account(accountModel) + .componentId("cloud-object_storage") + .componentName("cloud-object_storage") + .environment("ibm cloud") + .tags(tagsModel) + .status("compliant") + .totalCount(Long.valueOf("140")) + .passCount(Long.valueOf("123")) + .failureCount(Long.valueOf("12")) + .errorCount(Long.valueOf("5")) + .skippedCount(Long.valueOf("7")) + .completedCount(Long.valueOf("135")) + .serviceName("pm-20") + .instanceCrn("testString") + .build(); + + Credential credentialModel = new Credential.Builder() + .secretCrn("testString") + .resources(java.util.Arrays.asList(resourceModel)) + .build(); + + CreateTargetOptions createTargetOptions = new CreateTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("62ecf99b240144dea9125666249edfcb") + .trustedProfileId("Profile-cb2c1829-9a8d-4218-b9cd-9f83fc814e54") + .name("Target for IBM account") + .credentials(java.util.Arrays.asList(credentialModel)) .build(); // Invoke operation - Response response = service.listRules(listRulesOptions).execute(); + Response response = service.createTarget(createTargetOptions).execute(); // Validate response assertNotNull(response); - assertEquals(response.getStatusCode(), 200); + assertEquals(response.getStatusCode(), 201); - RulesPageBase rulesPageBaseResult = response.getResult(); + Target targetResult = response.getResult(); + assertNotNull(targetResult); - assertNotNull(rulesPageBaseResult); + targetIdLink = targetResult.getId(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testListRules" }) - public void testReplaceRule() throws Exception { + @Test(dependsOnMethods = { "testCreateTarget" }) + public void testListTargets() throws Exception { try { - AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() - .name("location") - .operator("string_equals") - .value("us-south") - .build(); - - TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() - .serviceName("cloud-object-storage") - .resourceKind("bucket") - .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) - .build(); - - RequiredConfigItemsRequiredConfigBase requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigBase.Builder() - .description("testString") - .property("hard_quota") - .operator("num_equals") - .value("${hard_quota}") - .build(); - - RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() - .description("The Cloud Object Storage rule.") - .and(java.util.Arrays.asList(requiredConfigItemsModel)) + ListTargetsOptions listTargetsOptions = new ListTargetsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .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(); + // Invoke operation + Response response = service.listTargets(listTargetsOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); - Import importModel = new Import.Builder() - .parameters(java.util.Arrays.asList(parameterModel)) - .build(); + TargetCollection targetCollectionResult = response.getResult(); + assertNotNull(targetCollectionResult); - ReplaceRuleOptions replaceRuleOptions = new ReplaceRuleOptions.Builder() - .ruleId(ruleIdLink) - .ifMatch(eTagLink) - .description("Example rule") - .target(targetPrototypeModel) - .requiredConfig(requiredConfigModel) - .version("1.0.1") - .xImport(importModel) - .labels(java.util.Arrays.asList()) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testListTargets" }) + public void testGetTarget() throws Exception { + try { + GetTargetOptions getTargetOptions = new GetTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId(targetIdLink) .build(); // Invoke operation - Response response = service.replaceRule(replaceRuleOptions).execute(); + Response response = service.getTarget(getTargetOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - Rule ruleResult = response.getResult(); + Target targetResult = response.getResult(); + assertNotNull(targetResult); - assertNotNull(ruleResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testReplaceRule" }) - public void testCreateAttachment() throws Exception { + @Test(dependsOnMethods = { "testGetTarget" }) + public void testReplaceTarget() throws Exception { try { - PropertyItem propertyScopeId = new PropertyItem.Builder() - .name("scope_id") - .value(config.get("ACCOUNTID")) + Account accountModel = new Account.Builder() + .id("531fc3e28bfc43c5a2cea07786d93f5c") + .name("NIST") + .type("account_type") + .build(); + + Tags tagsModel = new Tags.Builder() + .user(java.util.Arrays.asList("testString")) + .access(java.util.Arrays.asList("testString")) + .service(java.util.Arrays.asList("testString")) + .build(); + + Resource resourceModel = new Resource.Builder() + .reportId("30b434b3-cb08-4845-af10-7a8fc682b6a8") + .homeAccountId("2411ffdc16844b07b42521c3443f456d") + .id("crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::") + .resourceName("jeff's key") + .account(accountModel) + .componentId("cloud-object_storage") + .componentName("cloud-object_storage") + .environment("ibm cloud") + .tags(tagsModel) + .status("compliant") + .totalCount(Long.valueOf("140")) + .passCount(Long.valueOf("123")) + .failureCount(Long.valueOf("12")) + .errorCount(Long.valueOf("5")) + .skippedCount(Long.valueOf("7")) + .completedCount(Long.valueOf("135")) + .serviceName("pm-20") + .instanceCrn("testString") .build(); - PropertyItem propertyScopeType = new PropertyItem.Builder() - .name("scope_type") - .value("account") - .build(); - - - MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() - .environment("ibm-cloud") - .xProperties(java.util.Arrays.asList(propertyScopeId,propertyScopeType)) + Credential credentialModel = new Credential.Builder() + .secretCrn("dummy") + .resources(java.util.Arrays.asList(resourceModel)) .build(); - FailedControls failedControlsModel = new FailedControls.Builder() - .thresholdLimit(Long.valueOf("15")) - .failedControlIds(java.util.Arrays.asList()) + ReplaceTargetOptions replaceTargetOptions = new ReplaceTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId(targetIdLink) + .accountId("be200c80cabc456e91139e4152327823") + .trustedProfileId("Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3") + .name("Sample Target Name") + .credentials(java.util.Arrays.asList(credentialModel)) .build(); - AttachmentsNotificationsPrototype attachmentsNotificationsPrototypeModel = new AttachmentsNotificationsPrototype.Builder() - .enabled(false) - .controls(failedControlsModel) - .build(); + // Invoke operation + Response response = service.replaceTarget(replaceTargetOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); - 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(); + Target targetResult = response.getResult(); + assertNotNull(targetResult); - AttachmentsPrototype attachmentsPrototypeModel = new AttachmentsPrototype.Builder() - .id("130003ea8bfa43c5aacea07a86da3000") - .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(); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } - CreateAttachmentOptions createAttachmentOptions = new CreateAttachmentOptions.Builder() - .profileId(profileIdLink) - .attachments(java.util.Arrays.asList(attachmentsPrototypeModel)) - .xCorrelationId("testString") - .xRequestId("testString") + @Test(dependsOnMethods = { "testReplaceTarget" }) + public void testCreateProviderTypeInstance() throws Exception { + try { + CreateProviderTypeInstanceOptions createProviderTypeInstanceOptions = new CreateProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .name("workload-protection-instance-1") + .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) .build(); // Invoke operation - Response response = service.createAttachment(createAttachmentOptions).execute(); + Response response = service.createProviderTypeInstance(createProviderTypeInstanceOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 201); - AttachmentPrototype attachmentPrototypeResult = response.getResult(); + ProviderTypeInstance providerTypeInstanceResult = response.getResult(); + assertNotNull(providerTypeInstanceResult); - assertNotNull(attachmentPrototypeResult); - attachmentIdLink = attachmentPrototypeResult.attachments().get(0).id(); + providerTypeInstanceIdLink = providerTypeInstanceResult.getId(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testCreateAttachment" }) - public void testListAttachments() throws Exception { + @Test(dependsOnMethods = { "testCreateProviderTypeInstance" }) + public void testListProviderTypeInstances() throws Exception { try { - ListAttachmentsOptions listAttachmentsOptions = new ListAttachmentsOptions.Builder() - .profileId(profileIdLink) - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("1")) + ListProviderTypeInstancesOptions listProviderTypeInstancesOptions = new ListProviderTypeInstancesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .build(); // Invoke operation - Response response = service.listAttachments(listAttachmentsOptions).execute(); + Response response = service.listProviderTypeInstances(listProviderTypeInstancesOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - AttachmentCollection attachmentCollectionResult = response.getResult(); + ProviderTypeInstanceCollection providerTypeInstanceCollectionResult = response.getResult(); + assertNotNull(providerTypeInstanceCollectionResult); - 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 = { "testListAttachments" }) - public void testListAttachmentsWithPager() throws Exception { + @Test(dependsOnMethods = { "testListProviderTypeInstances" }) + public void testGetProviderTypeInstance() throws Exception { try { - ListAttachmentsOptions options = new ListAttachmentsOptions.Builder() - .profileId(profileIdLink) - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) + GetProviderTypeInstanceOptions getProviderTypeInstanceOptions = new GetProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .providerTypeInstanceId(providerTypeInstanceIdLink) .build(); - // Test getNext(). - List allResults = new ArrayList<>(); - AttachmentsPager pager = new AttachmentsPager(service, options); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertFalse(allResults.isEmpty()); + // Invoke operation + Response response = service.getProviderTypeInstance(getProviderTypeInstanceOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); - // Test getAll(); - pager = new AttachmentsPager(service, options); - List allItems = pager.getAll(); - assertNotNull(allItems); - assertFalse(allItems.isEmpty()); + ProviderTypeInstance providerTypeInstanceResult = response.getResult(); + assertNotNull(providerTypeInstanceResult); - assertEquals(allItems.size(), allResults.size()); - 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 = { "testListAttachments" }) - public void testGetProfileAttachment() throws Exception { + @Test(dependsOnMethods = { "testGetProviderTypeInstance" }) + public void testUpdateProviderTypeInstance() throws Exception { try { - GetProfileAttachmentOptions getProfileAttachmentOptions = new GetProfileAttachmentOptions.Builder() - .attachmentId(attachmentIdLink) - .profileId(profileIdLink) - .xCorrelationId("testString") - .xRequestId("testString") + UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptions = new UpdateProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .providerTypeInstanceId(providerTypeInstanceIdLink) + .name("workload-protection-instance-1") + .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) .build(); // Invoke operation - Response response = service.getProfileAttachment(getProfileAttachmentOptions).execute(); + Response response = service.updateProviderTypeInstance(updateProviderTypeInstanceOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - AttachmentItem attachmentItemResult = response.getResult(); + ProviderTypeInstance providerTypeInstanceResult = response.getResult(); + assertNotNull(providerTypeInstanceResult); - assertNotNull(attachmentItemResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testGetProfileAttachment" }) - public void testReplaceProfileAttachment() throws Exception { + @Test(dependsOnMethods = { "testUpdateProviderTypeInstance" }) + public void testListProviderTypes() throws Exception { try { - PropertyItem propertyScopeId = new PropertyItem.Builder() - .name("scope_id") - .value(config.get("ACCOUNTID")) - .build(); - - PropertyItem propertyScopeType = new PropertyItem.Builder() - .name("scope_type") - .value("account") - .build(); - - MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() - .environment("ibm-cloud") - .xProperties(java.util.Arrays.asList(propertyScopeId,propertyScopeType)) - .build(); - - FailedControls failedControlsModel = new FailedControls.Builder() - .thresholdLimit(Long.valueOf("15")) - .failedControlIds(java.util.Arrays.asList()) + ListProviderTypesOptions listProviderTypesOptions = new ListProviderTypesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .build(); - AttachmentsNotificationsPrototype attachmentsNotificationsPrototypeModel = new AttachmentsNotificationsPrototype.Builder() - .enabled(false) - .controls(failedControlsModel) - .build(); + // Invoke operation + Response response = service.listProviderTypes(listProviderTypesOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); - 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(); + ProviderTypeCollection providerTypeCollectionResult = response.getResult(); + assertNotNull(providerTypeCollectionResult); - LastScan lastScanModel = new LastScan.Builder() - .id("e8a39d25-0051-4328-8462-988ad321f49a") - .status("in_progress") - .time(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .build(); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } - ReplaceProfileAttachmentOptions replaceProfileAttachmentOptions = new ReplaceProfileAttachmentOptions.Builder() - .attachmentId(attachmentIdLink) - .id("testString") - .profileId(profileIdLink) - .accountId(config.get("ACCOUNTID")) - .instanceId(config.get("INSTANCEID")) - .scope(java.util.Arrays.asList(multiCloudScopeModel)) - .createdOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .createdBy("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .updatedBy("testString") - .status("enabled") - .schedule("every_30_days") - .notifications(attachmentsNotificationsPrototypeModel) - .attachmentParameters(java.util.Arrays.asList(attachmentParameterPrototypeModel)) - .lastScan(lastScanModel) - .nextScanTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .name("account-0d8c3805dfea40aa8ad02265a18eb12b") - .description("Test description") - .xCorrelationId("testString") - .xRequestId("testString") + @Test(dependsOnMethods = { "testListProviderTypes" }) + public void testGetProviderTypeById() throws Exception { + try { + GetProviderTypeByIdOptions getProviderTypeByIdOptions = new GetProviderTypeByIdOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .build(); // Invoke operation - Response response = service.replaceProfileAttachment(replaceProfileAttachmentOptions).execute(); + Response response = service.getProviderTypeById(getProviderTypeByIdOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - AttachmentItem attachmentItemResult = response.getResult(); + ProviderType providerTypeResult = response.getResult(); + assertNotNull(providerTypeResult); - assertNotNull(attachmentItemResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testReplaceProfileAttachment" }) - public void testCreateScan() throws Exception { + @Test(dependsOnMethods = { "testGetProviderTypeById" }) + public void testGetLatestReports() throws Exception { try { - CreateScanOptions createScanOptions = new CreateScanOptions.Builder() - .attachmentId(config.get("ATTACHMENTID")) - .xCorrelationId("testString") - .xRequestId("testString") + GetLatestReportsOptions getLatestReportsOptions = new GetLatestReportsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .sort("profile_name") .build(); // Invoke operation - Response response = service.createScan(createScanOptions).execute(); + Response response = service.getLatestReports(getLatestReportsOptions).execute(); // Validate response assertNotNull(response); - assertEquals(response.getStatusCode(), 201); + assertEquals(response.getStatusCode(), 200); - Scan scanResult = response.getResult(); + ReportLatest reportLatestResult = response.getResult(); + assertNotNull(reportLatestResult); - assertNotNull(scanResult); + accountIdForReportLink = reportLatestResult.getReports().get(0).getAccount().id(); + reportIdForReportLink = reportLatestResult.getReports().get(0).getId(); + attachmentIdForReportLink = reportLatestResult.getReports().get(0).getAttachment().getId(); + groupIdForReportLink = reportLatestResult.getReports().get(0).getGroupId(); + profileIdForReportLink = reportLatestResult.getReports().get(0).getProfile().getId(); + typeForReportLink = reportLatestResult.getReports().get(0).getType(); } catch (ServiceResponseException e) { - if(e.getMessage() != null && e.getMessage().contains("Another scan is currently in progress.")){ - return; - } fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testCreateScan" }) + @Test(dependsOnMethods = { "testGetLatestReports" }) public void testListReports() throws Exception { try { ListReportsOptions listReportsOptions = new ListReportsOptions.Builder() - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") - .attachmentId(attachmentIdForReportLink) + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportAttachmentId(attachmentIdForReportLink) .groupId(groupIdForReportLink) - .profileId(profileIdForReportLink) + .reportProfileId(profileIdForReportLink) .type(typeForReportLink) - .limit(Long.valueOf("1")) + .start("testString") + .limit(Long.valueOf("10")) .sort("profile_name") .build(); // Invoke operation - Response response = service.listReports(listReportsOptions).execute(); + Response response = service.listReports(listReportsOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ReportPage reportPageResult = response.getResult(); + ReportCollection reportCollectionResult = response.getResult(); + assertNotNull(reportCollectionResult); - 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())); @@ -1247,11 +1866,10 @@ public void testListReports() throws Exception { public void testListReportsWithPager() throws Exception { try { ListReportsOptions options = new ListReportsOptions.Builder() - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") - .attachmentId(attachmentIdForReportLink) + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportAttachmentId(attachmentIdForReportLink) .groupId(groupIdForReportLink) - .profileId(profileIdForReportLink) + .reportProfileId(profileIdForReportLink) .type(typeForReportLink) .limit(Long.valueOf("10")) .sort("profile_name") @@ -1281,14 +1899,14 @@ public void testListReportsWithPager() throws Exception { } } - @Test(dependsOnMethods = { "testListReports" }) public void testGetReport() throws Exception { try { GetReportOptions getReportOptions = new GetReportOptions.Builder() .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopeId("testString") .build(); // Invoke operation @@ -1298,9 +1916,8 @@ public void testGetReport() throws Exception { assertEquals(response.getStatusCode(), 200); 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())); @@ -1311,9 +1928,8 @@ public void testGetReport() throws Exception { public void testGetReportSummary() throws Exception { try { GetReportSummaryOptions getReportSummaryOptions = new GetReportSummaryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") .build(); // Invoke operation @@ -1323,9 +1939,8 @@ public void testGetReportSummary() throws Exception { assertEquals(response.getStatusCode(), 200); 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())); @@ -1333,44 +1948,45 @@ public void testGetReportSummary() throws Exception { } @Test(dependsOnMethods = { "testGetReportSummary" }) - public void testGetReportEvaluation() throws Exception { + public void testGetReportDownloadFile() throws Exception { try { - GetReportEvaluationOptions getReportEvaluationOptions = new GetReportEvaluationOptions.Builder() + GetReportDownloadFileOptions getReportDownloadFileOptions = new GetReportDownloadFileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + .accept("application/csv") .excludeSummary(true) .build(); // Invoke operation - Response response = service.getReportEvaluation(getReportEvaluationOptions).execute(); + Response response = service.getReportDownloadFile(getReportDownloadFileOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - InputStream inputStreamResult = response.getResult(); + try (InputStream inputStreamResult = response.getResult();) { + assertNotNull(inputStreamResult); + } - 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 = { "testGetReportSummary" }) + @Test(dependsOnMethods = { "testGetReportDownloadFile" }) public void testGetReportControls() throws Exception { try { GetReportControlsOptions getReportControlsOptions = new GetReportControlsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") .controlId("testString") .controlName("testString") .controlDescription("testString") .controlCategory("testString") .status("compliant") .sort("control_name") + .scopeId("testString") + .subscopeId("testString") .build(); // Invoke operation @@ -1380,9 +1996,8 @@ public void testGetReportControls() throws Exception { assertEquals(response.getStatusCode(), 200); 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())); @@ -1390,12 +2005,35 @@ public void testGetReportControls() throws Exception { } @Test(dependsOnMethods = { "testGetReportControls" }) + public void testGetReportRule() throws Exception { + try { + GetReportRuleOptions getReportRuleOptions = new GetReportRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .ruleId("rule-61fa114a-2bb9-43fd-8068-b873b48bdf79") + .build(); + + // Invoke operation + Response response = service.getReportRule(getReportRuleOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + RuleInfo ruleInfoResult = response.getResult(); + assertNotNull(ruleInfoResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testGetReportRule" }) public void testListReportEvaluations() throws Exception { try { ListReportEvaluationsOptions listReportEvaluationsOptions = new ListReportEvaluationsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") .assessmentId("testString") .assessmentMethod("testString") .componentId("testString") @@ -1403,7 +2041,11 @@ public void testListReportEvaluations() throws Exception { .targetEnv("testString") .targetName("testString") .status("failure") - .limit(Long.valueOf("1")) + .start("testString") + .limit(Long.valueOf("10")) + .sort("assessment_id") + .scopeId("testString") + .subscopeId("testString") .build(); // Invoke operation @@ -1413,9 +2055,8 @@ public void testListReportEvaluations() throws Exception { assertEquals(response.getStatusCode(), 200); 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())); @@ -1426,9 +2067,8 @@ public void testListReportEvaluations() throws Exception { public void testListReportEvaluationsWithPager() throws Exception { try { ListReportEvaluationsOptions options = new ListReportEvaluationsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") .assessmentId("testString") .assessmentMethod("testString") .componentId("testString") @@ -1437,6 +2077,9 @@ public void testListReportEvaluationsWithPager() throws Exception { .targetName("testString") .status("failure") .limit(Long.valueOf("10")) + .sort("assessment_id") + .scopeId("testString") + .subscopeId("testString") .build(); // Test getNext(). @@ -1447,10 +2090,13 @@ public void testListReportEvaluationsWithPager() throws Exception { assertNotNull(nextPage); allResults.addAll(nextPage); } + assertFalse(allResults.isEmpty()); // Test getAll(); pager = new ReportEvaluationsPager(service, options); List allItems = pager.getAll(); + assertNotNull(allItems); + assertFalse(allItems.isEmpty()); assertEquals(allItems.size(), allResults.size()); System.out.println(String.format("Retrieved a total of %d item(s) with pagination.", allResults.size())); @@ -1460,342 +2106,547 @@ public void testListReportEvaluationsWithPager() throws Exception { } } - @Test(dependsOnMethods = { "testListReportEvaluations" }) public void testListReportResources() throws Exception { try { ListReportResourcesOptions listReportResourcesOptions = new ListReportResourcesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .id("testString") + .resourceName("testString") + .accountId(accountIdForReportLink) + .componentId("testString") + .status("compliant") + .sort("account_id") + .start("testString") + .limit(Long.valueOf("10")) + .scopeId("testString") + .subscopeId("testString") + .build(); + + // Invoke operation + Response response = service.listReportResources(listReportResourcesOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ResourcePage resourcePageResult = response.getResult(); + assertNotNull(resourcePageResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testListReportResources" }) + public void testListReportResourcesWithPager() throws Exception { + try { + ListReportResourcesOptions options = new ListReportResourcesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") .id("testString") .resourceName("testString") .accountId(accountIdForReportLink) .componentId("testString") .status("compliant") .sort("account_id") - .limit(Long.valueOf("1")) + .limit(Long.valueOf("10")) + .scopeId("testString") + .subscopeId("testString") + .build(); + + // Test getNext(). + List allResults = new ArrayList<>(); + ReportResourcesPager pager = new ReportResourcesPager(service, options); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertFalse(allResults.isEmpty()); + + // Test getAll(); + pager = new ReportResourcesPager(service, options); + List allItems = pager.getAll(); + assertNotNull(allItems); + assertFalse(allItems.isEmpty()); + + assertEquals(allItems.size(), allResults.size()); + 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 = { "testListReportResources" }) + public void testGetReportTags() throws Exception { + try { + GetReportTagsOptions getReportTagsOptions = new GetReportTagsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .build(); + + // Invoke operation + Response response = service.getReportTags(getReportTagsOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ReportTags reportTagsResult = response.getResult(); + assertNotNull(reportTagsResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testGetReportTags" }) + public void testGetReportViolationsDrift() throws Exception { + try { + GetReportViolationsDriftOptions getReportViolationsDriftOptions = new GetReportViolationsDriftOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .scanTimeDuration(Long.valueOf("0")) + .scopeId("testString") + .subscopeId("testString") + .build(); + + // Invoke operation + Response response = service.getReportViolationsDrift(getReportViolationsDriftOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 200); + + ReportViolationsDrift reportViolationsDriftResult = response.getResult(); + assertNotNull(reportViolationsDriftResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testGetReportViolationsDrift" }) + public void testListScanReports() throws Exception { + try { + ListScanReportsOptions listScanReportsOptions = new ListScanReportsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId(reportIdForReportLink) + .scopeId("testString") + .subscopeId("testString") + .sort("status") .build(); // Invoke operation - Response response = service.listReportResources(listReportResourcesOptions).execute(); + Response response = service.listScanReports(listScanReportsOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ResourcePage resourcePageResult = response.getResult(); + ScanReportCollection scanReportCollectionResult = response.getResult(); + assertNotNull(scanReportCollectionResult); - assertNotNull(resourcePageResult); - xCorrelationIdLink = response.getHeaders().values("X-Correlation-ID").get(0); + scanIdForScanReportLink = scanReportCollectionResult.getScanReports().get(0).getId(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testListReportResources" }) - public void testListReportResourcesWithPager() throws Exception { + @Test(dependsOnMethods = { "testListScanReports" }) + public void testCreateScanReport() throws Exception { try { - ListReportResourcesOptions options = new ListReportResourcesOptions.Builder() + CreateScanReportOptions createScanReportOptions = new CreateScanReportOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") - .id("testString") - .resourceName("testString") - .accountId(accountIdForReportLink) - .componentId("testString") - .status("compliant") - .sort("account_id") - .limit(Long.valueOf("10")) + .format("csv") + .scopeId("132009ff-b982-412e-a110-ad8797e10f84") + .subscopeId("c7ddcbcc-6a43-4ab3-b6a7-b2d8f65cd54a") .build(); - // Test getNext(). - List allResults = new ArrayList<>(); - ReportResourcesPager pager = new ReportResourcesPager(service, options); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } + // Invoke operation + Response response = service.createScanReport(createScanReportOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 202); - // Test getAll(); - pager = new ReportResourcesPager(service, options); - List allItems = pager.getAll(); + CreateScanReport createScanReportResult = response.getResult(); + assertNotNull(createScanReportResult); - assertEquals(allItems.size(), allResults.size()); - 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 = { "testListReportResources" }) - public void testGetReportTags() throws Exception { + @Test(dependsOnMethods = { "testCreateScanReport" }) + public void testGetScanReport() throws Exception { try { - GetReportTagsOptions getReportTagsOptions = new GetReportTagsOptions.Builder() + GetScanReportOptions getScanReportOptions = new GetScanReportOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + .jobId(scanIdForScanReportLink) .build(); // Invoke operation - Response response = service.getReportTags(getReportTagsOptions).execute(); + Response response = service.getScanReport(getScanReportOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ReportTags reportTagsResult = response.getResult(); + ScanReport scanReportResult = response.getResult(); + assertNotNull(scanReportResult); - 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())); } } - @Test(dependsOnMethods = { "testGetReportTags" }) - public void testGetReportViolationsDrift() throws Exception { + @Test(dependsOnMethods = { "testGetScanReport" }) + public void testGetScanReportDownloadFile() throws Exception { try { - GetReportViolationsDriftOptions getReportViolationsDriftOptions = new GetReportViolationsDriftOptions.Builder() + GetScanReportDownloadFileOptions getScanReportDownloadFileOptions = new GetScanReportDownloadFileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId(reportIdForReportLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") - .scanTimeDuration(Long.valueOf("0")) + .jobId(scanIdForScanReportLink) + .accept("application/csv") .build(); // Invoke operation - Response response = service.getReportViolationsDrift(getReportViolationsDriftOptions).execute(); + Response response = service.getScanReportDownloadFile(getScanReportDownloadFileOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ReportViolationsDrift reportViolationsDriftResult = response.getResult(); + try (InputStream inputStreamResult = response.getResult();) { + assertNotNull(inputStreamResult); + } - 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())); } } - @Test(dependsOnMethods = { "testGetReportViolationsDrift" }) - public void testListProviderTypes() throws Exception { + @Test(dependsOnMethods = { "testGetScanReportDownloadFile" }) + public void testListRules() throws Exception { try { - ListProviderTypesOptions listProviderTypesOptions = new ListProviderTypesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + ListRulesOptions listRulesOptions = new ListRulesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .start("testString") + .type("system_defined") + .search("testString") + .serviceName("testString") + .sort("updated_on") .build(); // Invoke operation - Response response = service.listProviderTypes(listProviderTypesOptions).execute(); + Response response = service.listRules(listRulesOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ProviderTypesCollection providerTypesCollectionResult = response.getResult(); + RuleCollection ruleCollectionResult = response.getResult(); + assertNotNull(ruleCollectionResult); + + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + + @Test(dependsOnMethods = { "testListRules" }) + public void testListRulesWithPager() throws Exception { + try { + ListRulesOptions options = new ListRulesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .type("system_defined") + .search("testString") + .serviceName("testString") + .sort("updated_on") + .build(); - assertNotNull(providerTypesCollectionResult); - for(ProviderTypeItem providerTypeItem: providerTypesCollectionResult.getProviderTypes()){ - if(providerTypeItem.getName().equals("workload-protection")){ - providerTypeIdLink = providerTypeItem.getId(); - break; - } + // Test getNext(). + List allResults = new ArrayList<>(); + RulesPager pager = new RulesPager(service, options); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); } + assertFalse(allResults.isEmpty()); + // Test getAll(); + pager = new RulesPager(service, options); + List allItems = pager.getAll(); + assertNotNull(allItems); + assertFalse(allItems.isEmpty()); + + assertEquals(allItems.size(), allResults.size()); + 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 = { "testListProviderTypes" }) - public void testGetProviderTypeById() throws Exception { + @Test(dependsOnMethods = { "testListRules" }) + public void testCreateRule() throws Exception { try { - GetProviderTypeByIdOptions getProviderTypeByIdOptions = new GetProviderTypeByIdOptions.Builder() - .providerTypeId(providerTypeIdLink) - .xCorrelationId("testString") - .xRequestId("testString") + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("location") + .operator("string_equals") + .value("us-east") + .build(); + + RuleTargetPrototype ruleTargetPrototypeModel = new RuleTargetPrototype.Builder() + .serviceName("cloud-object-storage") + .resourceKind("bucket") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .build(); + + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .description("testString") + .property("hard_quota") + .operator("num_equals") + .value("${hard_quota}") + .build(); + + RequiredConfigConditionListConditionListConditionAnd requiredConfigModel = new RequiredConfigConditionListConditionListConditionAnd.Builder() + .description("The Cloud Object Storage rule.") + .and(java.util.Arrays.asList(conditionItemModel)) + .build(); + + RuleParameter ruleParameterModel = new RuleParameter.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(ruleParameterModel)) + .build(); + + CreateRuleOptions createRuleOptions = new CreateRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .description("Example rule") + .target(ruleTargetPrototypeModel) + .requiredConfig(requiredConfigModel) + .version("1.0.0") + .xImport(importModel) + .labels(java.util.Arrays.asList()) .build(); // Invoke operation - Response response = service.getProviderTypeById(getProviderTypeByIdOptions).execute(); + Response response = service.createRule(createRuleOptions).execute(); // Validate response assertNotNull(response); - assertEquals(response.getStatusCode(), 200); + assertEquals(response.getStatusCode(), 201); - ProviderTypeItem providerTypeItemResult = response.getResult(); + Rule ruleResult = response.getResult(); + assertNotNull(ruleResult); - assertNotNull(providerTypeItemResult); + ruleIdLink = ruleResult.getId(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testGetProviderTypeById" }) - public void testListProviderTypeInstances() throws Exception { + @Test(dependsOnMethods = { "testCreateRule" }) + public void testGetRule() throws Exception { try { - ListProviderTypeInstancesOptions listProviderTypeInstancesOptions = new ListProviderTypeInstancesOptions.Builder() - .providerTypeId(providerTypeIdLink) - .xCorrelationId("testString") - .xRequestId("testString") + GetRuleOptions getRuleOptions = new GetRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .ruleId(ruleIdLink) .build(); // Invoke operation - Response response = service.listProviderTypeInstances(listProviderTypeInstancesOptions).execute(); + Response response = service.getRule(getRuleOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ProviderTypeInstancesResponse providerTypeInstancesResponseResult = response.getResult(); + Rule ruleResult = response.getResult(); + assertNotNull(ruleResult); - assertNotNull(providerTypeInstancesResponseResult); + eTagLink = response.getHeaders().values("ETag").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 = { "testListProviderTypeInstances" }) - public void testCreateProviderTypeInstance() throws Exception { + @Test(dependsOnMethods = { "testGetRule" }) + public void testReplaceRule() throws Exception { try { - CreateProviderTypeInstanceOptions createProviderTypeInstanceOptions = new CreateProviderTypeInstanceOptions.Builder() - .providerTypeId(providerTypeIdLink) - .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::")) - .xCorrelationId("testString") - .xRequestId("testString") + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("location") + .operator("string_equals") + .value("us-south") + .build(); + + RuleTargetPrototype ruleTargetPrototypeModel = new RuleTargetPrototype.Builder() + .serviceName("cloud-object-storage") + .resourceKind("bucket") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .build(); + + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .description("testString") + .property("hard_quota") + .operator("num_equals") + .value("${hard_quota}") + .build(); + + RequiredConfigConditionListConditionListConditionAnd requiredConfigModel = new RequiredConfigConditionListConditionListConditionAnd.Builder() + .description("The Cloud Object Storage rule.") + .and(java.util.Arrays.asList(conditionItemModel)) + .build(); + + RuleParameter ruleParameterModel = new RuleParameter.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(ruleParameterModel)) + .build(); + + ReplaceRuleOptions replaceRuleOptions = new ReplaceRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .ruleId(ruleIdLink) + .ifMatch(eTagLink) + .description("Example rule") + .target(ruleTargetPrototypeModel) + .requiredConfig(requiredConfigModel) + .version("1.0.1") + .xImport(importModel) + .labels(java.util.Arrays.asList()) .build(); // Invoke operation - Response response = service.createProviderTypeInstance(createProviderTypeInstanceOptions).execute(); + Response response = service.replaceRule(replaceRuleOptions).execute(); // Validate response assertNotNull(response); - assertEquals(response.getStatusCode(), 201); + assertEquals(response.getStatusCode(), 200); - ProviderTypeInstanceItem providerTypeInstanceItemResult = response.getResult(); + Rule ruleResult = response.getResult(); + assertNotNull(ruleResult); - assertNotNull(providerTypeInstanceItemResult); - providerTypeInstanceIdLink = providerTypeInstanceItemResult.getId(); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testCreateProviderTypeInstance" }) - public void testGetProviderTypeInstance() throws Exception { + @Test(dependsOnMethods = { "testReplaceRule" }) + public void testListServices() throws Exception { try { - GetProviderTypeInstanceOptions getProviderTypeInstanceOptions = new GetProviderTypeInstanceOptions.Builder() - .providerTypeId(providerTypeIdLink) - .providerTypeInstanceId(providerTypeInstanceIdLink) - .xCorrelationId("testString") - .xRequestId("testString") - .build(); + ListServicesOptions listServicesOptions = new ListServicesOptions(); // Invoke operation - Response response = service.getProviderTypeInstance(getProviderTypeInstanceOptions).execute(); + Response response = service.listServices(listServicesOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ProviderTypeInstanceItem providerTypeInstanceItemResult = response.getResult(); + ServiceCollection serviceCollectionResult = response.getResult(); + assertNotNull(serviceCollectionResult); - assertNotNull(providerTypeInstanceItemResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testGetProviderTypeInstance" }) - public void testUpdateProviderTypeInstance() throws Exception { + @Test(dependsOnMethods = { "testListServices" }) + public void testGetService() throws Exception { try { - UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName updateProviderTypeInstanceRequestModel = new UpdateProviderTypeInstanceRequestProviderTypeInstancePrototypeForPatchingName.Builder() - .name("workload-protection-instance-1") - .build(); - - UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptions = new UpdateProviderTypeInstanceOptions.Builder() - .providerTypeId(providerTypeIdLink) - .providerTypeInstanceId(providerTypeInstanceIdLink) - .updateProviderTypeInstanceRequest(updateProviderTypeInstanceRequestModel) - .xCorrelationId("testString") - .xRequestId("testString") + GetServiceOptions getServiceOptions = new GetServiceOptions.Builder() + .servicesName("cloud-object-storage") .build(); // Invoke operation - Response response = service.updateProviderTypeInstance(updateProviderTypeInstanceOptions).execute(); + Response response = service.getService(getServiceOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ProviderTypeInstanceItem providerTypeInstanceItemResult = response.getResult(); + Service serviceResult = response.getResult(); + assertNotNull(serviceResult); - assertNotNull(providerTypeInstanceItemResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testUpdateProviderTypeInstance" }) - public void testGetProviderTypesInstances() throws Exception { + @Test(dependsOnMethods = { "testGetService" }) + public void testDeleteProfileAttachment() throws Exception { try { - GetProviderTypesInstancesOptions getProviderTypesInstancesOptions = new GetProviderTypesInstancesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + DeleteProfileAttachmentOptions deleteProfileAttachmentOptions = new DeleteProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId(attachmentIdLink) + .accountId(accountIdForReportLink) .build(); // Invoke operation - Response response = service.getProviderTypesInstances(getProviderTypesInstancesOptions).execute(); + Response response = service.deleteProfileAttachment(deleteProfileAttachmentOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - ProviderTypesInstancesResponse providerTypesInstancesResponseResult = response.getResult(); + ProfileAttachment profileAttachmentResult = response.getResult(); + assertNotNull(profileAttachmentResult); - assertNotNull(providerTypesInstancesResponseResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testGetProviderTypesInstances" }) - public void testDeleteProfileAttachment() throws Exception { + @Test(dependsOnMethods = { "testDeleteProfileAttachment" }) + public void testDeleteCustomControlLibrary() throws Exception { try { - DeleteProfileAttachmentOptions deleteProfileAttachmentOptions = new DeleteProfileAttachmentOptions.Builder() - .attachmentId(attachmentIdLink) - .profileId(profileIdLink) - .xCorrelationId("testString") - .xRequestId("testString") + DeleteCustomControlLibraryOptions deleteCustomControlLibraryOptions = new DeleteCustomControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId(controlLibraryIdLink) + .accountId(accountIdForReportLink) .build(); // Invoke operation - Response response = service.deleteProfileAttachment(deleteProfileAttachmentOptions).execute(); + Response response = service.deleteCustomControlLibrary(deleteCustomControlLibraryOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 200); - AttachmentItem attachmentItemResult = response.getResult(); + ControlLibrary controlLibraryResult = response.getResult(); + assertNotNull(controlLibraryResult); - assertNotNull(attachmentItemResult); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - - @Test(dependsOnMethods = { "testDeleteProfileAttachment" }) + + @Test(dependsOnMethods = { "testDeleteCustomControlLibrary" }) public void testDeleteCustomProfile() throws Exception { try { DeleteCustomProfileOptions deleteCustomProfileOptions = new DeleteCustomProfileOptions.Builder() - .profileId(profileIdLink) - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId(profileIdLink) + .accountId(accountIdForReportLink) .build(); // Invoke operation @@ -1805,8 +2656,8 @@ public void testDeleteCustomProfile() throws Exception { assertEquals(response.getStatusCode(), 200); Profile profileResult = response.getResult(); - assertNotNull(profileResult); + } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); @@ -1814,40 +2665,54 @@ public void testDeleteCustomProfile() throws Exception { } @Test(dependsOnMethods = { "testDeleteCustomProfile" }) - public void testDeleteCustomControlLibrary() throws Exception { + public void testDeleteSubscope() throws Exception { try { - DeleteCustomControlLibraryOptions deleteCustomControlLibraryOptions = new DeleteCustomControlLibraryOptions.Builder() - .controlLibrariesId(controlLibraryIdLink) - .xCorrelationId("testString") - .xRequestId("testString") + DeleteSubscopeOptions deleteSubscopeOptions = new DeleteSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .subscopeId(subScopeIdLink) .build(); // Invoke operation - Response response = service.deleteCustomControlLibrary(deleteCustomControlLibraryOptions).execute(); + Response response = service.deleteSubscope(deleteSubscopeOptions).execute(); // Validate response assertNotNull(response); - assertEquals(response.getStatusCode(), 200); + assertEquals(response.getStatusCode(), 204); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } - ControlLibraryDelete controlLibraryDeleteResult = response.getResult(); + @Test(dependsOnMethods = { "testDeleteSubscope" }) + public void testDeleteScope() throws Exception { + try { + DeleteScopeOptions deleteScopeOptions = new DeleteScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId(scopeIdLink) + .build(); - assertNotNull(controlLibraryDeleteResult); + // Invoke operation + Response response = service.deleteScope(deleteScopeOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 204); } catch (ServiceResponseException e) { fail(String.format("Service returned status code %d: %s%nError details: %s", e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); } } - @Test(dependsOnMethods = { "testDeleteCustomControlLibrary" }) - public void testDeleteRule() throws Exception { + @Test(dependsOnMethods = { "testDeleteScope" }) + public void testDeleteTarget() throws Exception { try { - DeleteRuleOptions deleteRuleOptions = new DeleteRuleOptions.Builder() - .ruleId(ruleIdLink) - .xCorrelationId(xCorrelationIdLink) - .xRequestId("testString") + DeleteTargetOptions deleteTargetOptions = new DeleteTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId(targetIdLink) .build(); // Invoke operation - Response response = service.deleteRule(deleteRuleOptions).execute(); + Response response = service.deleteTarget(deleteTargetOptions).execute(); // Validate response assertNotNull(response); assertEquals(response.getStatusCode(), 204); @@ -1857,14 +2722,13 @@ public void testDeleteRule() throws Exception { } } - @Test(dependsOnMethods = { "testDeleteRule" }) + @Test(dependsOnMethods = { "testDeleteTarget" }) public void testDeleteProviderTypeInstance() throws Exception { try { DeleteProviderTypeInstanceOptions deleteProviderTypeInstanceOptions = new DeleteProviderTypeInstanceOptions.Builder() - .providerTypeId(providerTypeIdLink) + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .providerTypeInstanceId(providerTypeInstanceIdLink) - .xCorrelationId("testString") - .xRequestId("testString") .build(); // Invoke operation @@ -1878,6 +2742,25 @@ public void testDeleteProviderTypeInstance() throws Exception { } } + @Test(dependsOnMethods = { "testDeleteProviderTypeInstance" }) + public void testDeleteRule() throws Exception { + try { + DeleteRuleOptions deleteRuleOptions = new DeleteRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .ruleId(ruleIdLink) + .build(); + + // Invoke operation + Response response = service.deleteRule(deleteRuleOptions).execute(); + // Validate response + assertNotNull(response); + assertEquals(response.getStatusCode(), 204); + } catch (ServiceResponseException e) { + fail(String.format("Service returned status code %d: %s%nError details: %s", + e.getStatusCode(), e.getMessage(), e.getDebuggingInfo())); + } + } + @AfterClass public void tearDown() { // Add any clean up logic here 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 f9040fb6..1553644b 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,6 +10,7 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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; import com.ibm.cloud.sdk.core.http.Response; @@ -19,72 +20,110 @@ import com.ibm.cloud.sdk.core.util.DateUtils; import com.ibm.cloud.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalProperty; import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalTargetAttribute; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AssessmentPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AssessmentWithStats; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Attachment; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentItem; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentParameterPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentScope; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentsAccountPager; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentsNotificationsPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentsPager; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentsPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComparePredefinedProfilesResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CompareProfileResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CompareProfilesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceScore; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceStats; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDocs; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceStatsWithNonCompliant; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionList; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionListConditionListConditionAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionListConditionListConditionOr; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRuleConditionSubRuleConditionAll; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRuleConditionSubRuleConditionAllIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRuleConditionSubRuleConditionAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConfigurationInformationPoints; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Control; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlChanges; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlChangesUpdated; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrariesPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrary; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryDelete; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationWithStats; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSummary; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlWithStats; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlsInControlLib; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateAttachmentOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateCustomControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateControlLibraryOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProviderTypeInstanceOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateRuleOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanReport; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanReportOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScanResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Credential; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CredentialResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DateRange; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersChanges; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersDifference; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteCustomControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteCustomProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteProviderTypeInstanceOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteRuleOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvalDetails; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DeleteTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Endpoint; import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvalStats; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Evaluation; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationPage; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProviderInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.model.EventNotifications; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.FailedControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EventNotificationsPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetLatestReportsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypeByIdOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypeInstanceOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetProviderTypesInstancesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportControlsOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportEvaluationOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportDownloadFileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportRuleOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportSummaryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportTagsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetReportViolationsDriftOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScanReportDownloadFileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScanReportOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetServiceOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetSettingsOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Implementation; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.GetTargetOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Import; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.InstanceAttachmentsPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.LabelType; import com.ibm.cloud.security_and_compliance_center_api.v3.model.LastScan; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListAttachmentsAccountOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Link; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListControlLibrariesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListInstanceAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfileAttachmentsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfileParametersOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProfilesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProviderTypeInstancesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListProviderTypesOptions; @@ -92,75 +131,107 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListReportResourcesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListReportsOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListRulesOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListScanReportsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListScopesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListServicesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListSubscopesOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ListTargetsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayload; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadById; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadByProperties; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ObjectStorage; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PageHRef; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ObjectStoragePrototype; 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.PaginatedCollectionFirst; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PaginatedCollectionNext; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.model.PostTestEventOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Profile; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControlsPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileDefaultParametersResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileInfo; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileItem; 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; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypesCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypesInstancesResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderType; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstance; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceCustomControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileParametersOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceRuleOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceTargetOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Report; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportControls; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportEvaluationsPager; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportLatest; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportPage; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportResourcesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportScope; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportSummary; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportTags; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportViolationDataPoint; 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.RequiredConfigItemsRequiredConfigAndDepth1; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigItemsRequiredConfigBase; -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.RequiredConfigConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionList; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionListConditionListConditionAnd; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionListConditionListConditionOr; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRuleConditionSubRuleConditionAll; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRuleConditionSubRuleConditionAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf; 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; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ResourceSummaryItem; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Rule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleCollection; 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.RuleParameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTargetPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RulesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScanReport; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScanReportCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeID; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyExclusionItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyExclusions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeId; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeType; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Service; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ServiceCollection; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Settings; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScopeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScopeResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubscopesPager; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SupportedConfigs; 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.TargetCollection; 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.UpdateScopeOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSettingsOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpgradeAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.IOException; import java.io.InputStream; @@ -194,21 +265,16 @@ public void testConstructorWithNullAuthenticator() throws Throwable { new SecurityAndComplianceCenterApi(serviceName, null); } - // Construct the service URL using the default server variable values + // Test the getServiceUrlForRegion() method @Test - public void testConstructServiceURLwithDefaultValues() throws Throwable { - String defaultFormattedUrl = "https://us-south.compliance.cloud.ibm.com/instances/instance_id/v3"; - String constructedUrl = SecurityAndComplianceCenterApi.constructServiceUrl(null); - assertEquals(constructedUrl, defaultFormattedUrl); - } - - // Construct the service URL with an invalid server variable name (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConstructServiceURLWithInvalidVariable() throws Throwable { - Map variables = new HashMap<>(); - variables.put("invalid_variable_name", "value"); - - SecurityAndComplianceCenterApi.constructServiceUrl(variables); + public void testGetServiceUrlForRegion() throws Throwable { + assertNull(SecurityAndComplianceCenterApi.getServiceUrlForRegion("INVALID_REGION")); + assertEquals(SecurityAndComplianceCenterApi.getServiceUrlForRegion("us-south"), "https://us-south.compliance.cloud.ibm.com"); + assertEquals(SecurityAndComplianceCenterApi.getServiceUrlForRegion("eu-de"), "https://eu-de.compliance.cloud.ibm.com"); + assertEquals(SecurityAndComplianceCenterApi.getServiceUrlForRegion("eu-fr2"), "https://eu-fr2.compliance.cloud.ibm.com"); + assertEquals(SecurityAndComplianceCenterApi.getServiceUrlForRegion("ca-tor"), "https://ca-tor.compliance.cloud.ibm.com"); + assertEquals(SecurityAndComplianceCenterApi.getServiceUrlForRegion("au-syd"), "https://au-syd.compliance.cloud.ibm.com"); + assertEquals(SecurityAndComplianceCenterApi.getServiceUrlForRegion("eu-es"), "https://eu-es.compliance.cloud.ibm.com"); } // Test the getSettings operation with a valid options model parameter @@ -216,7 +282,7 @@ public void testConstructServiceURLWithInvalidVariable() throws Throwable { public void testGetSettingsWOptions() throws Throwable { // Register a mock response 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"; + String getSettingsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/settings"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -224,8 +290,7 @@ public void testGetSettingsWOptions() throws Throwable { // Construct an instance of the GetSettingsOptions model GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .build(); // Invoke getSettings() with a valid options model and verify the result @@ -256,41 +321,42 @@ public void testGetSettingsWRetries() throws Throwable { testGetSettingsWOptions(); } + // Test the getSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.getSettings(null).execute(); + } + // Test the updateSettings operation with a valid options model parameter @Test public void testUpdateSettingsWOptions() throws Throwable { // Register a mock response 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"; + String updateSettingsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/settings"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the EventNotifications model - EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .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: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") + // Construct an instance of the ObjectStoragePrototype model + ObjectStoragePrototype objectStoragePrototypeModel = new ObjectStoragePrototype.Builder() + .bucket("px-scan-results") + .instanceCrn("crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::") .build(); - // Construct an instance of the ObjectStorage model - ObjectStorage objectStorageModel = new ObjectStorage.Builder() - .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") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + // Construct an instance of the EventNotificationsPrototype model + EventNotificationsPrototype eventNotificationsPrototypeModel = new EventNotificationsPrototype.Builder() + .instanceCrn("crn:v1:staging: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("scc-sdk-integration") .build(); // Construct an instance of the UpdateSettingsOptions model UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .eventNotifications(eventNotificationsModel) - .objectStorage(objectStorageModel) - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .objectStorage(objectStoragePrototypeModel) + .eventNotifications(eventNotificationsPrototypeModel) .build(); // Invoke updateSettings() with a valid options model and verify the result @@ -321,12 +387,19 @@ public void testUpdateSettingsWRetries() throws Throwable { testUpdateSettingsWOptions(); } + // Test the updateSettings operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.updateSettings(null).execute(); + } + // Test the postTestEvent operation with a valid options model parameter @Test public void testPostTestEventWOptions() throws Throwable { // Register a mock response String mockResponseBody = "{\"success\": false}"; - String postTestEventPath = "/test_event"; + String postTestEventPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/test_event"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(202) @@ -334,8 +407,7 @@ public void testPostTestEventWOptions() throws Throwable { // Construct an instance of the PostTestEventOptions model PostTestEventOptions postTestEventOptionsModel = new PostTestEventOptions.Builder() - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .build(); // Invoke postTestEvent() with a valid options model and verify the result @@ -366,30 +438,39 @@ public void testPostTestEventWRetries() throws Throwable { testPostTestEventWOptions(); } - // Test the listControlLibraries operation with a valid options model parameter + // Test the postTestEvent operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPostTestEventNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.postTestEvent(null).execute(); + } + + // Test the listInstanceAttachments operation with a valid options model parameter @Test - public void testListControlLibrariesWOptions() throws Throwable { + public void testListInstanceAttachmentsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"total_count\": 1, \"limit\": 20, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"control_libraries\": [{\"id\": \"id\", \"account_id\": \"accountId\", \"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"controlLibraryType\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"version_group_label\": \"versionGroupLabel\", \"control_library_version\": \"controlLibraryVersion\", \"latest\": true, \"controls_count\": 13}]}"; - String listControlLibrariesPath = "/control_libraries"; + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"attachments\": [{\"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}], \"description\": \"description\", \"name\": \"name\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}, \"schedule\": \"daily\", \"scope\": [{\"id\": \"id\"}], \"status\": \"enabled\", \"data_selection_range\": {\"start_date\": \"2025-02-28T05:42:58.000Z\", \"end_date\": \"2025-02-28T05:42:58.000Z\"}, \"account_id\": \"accountId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"instance_id\": \"instanceId\", \"last_scan\": {\"id\": \"id\", \"status\": \"status\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"profile_id\": \"profileId\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}]}"; + String listInstanceAttachmentsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/attachments"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListControlLibrariesOptions model - ListControlLibrariesOptions listControlLibrariesOptionsModel = new ListControlLibrariesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("50")) - .controlLibraryType("custom") + // Construct an instance of the ListInstanceAttachmentsOptions model + ListInstanceAttachmentsOptions listInstanceAttachmentsOptionsModel = new ListInstanceAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .versionGroupLabel("6702d85a-6437-4d6f-8701-c0146648787b") + .limit(Long.valueOf("10")) + .sort("created_on") + .direction("desc") .start("testString") .build(); - // Invoke listControlLibraries() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.listControlLibraries(listControlLibrariesOptionsModel).execute(); + // Invoke listInstanceAttachments() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listInstanceAttachments(listInstanceAttachmentsOptionsModel).execute(); assertNotNull(response); - ControlLibraryCollection responseObj = response.getResult(); + ProfileAttachmentCollection responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -398,31 +479,41 @@ public void testListControlLibrariesWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listControlLibrariesPath); + assertEquals(parsedPath, listInstanceAttachmentsPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("50")); - assertEquals(query.get("control_library_type"), "custom"); + assertEquals(query.get("account_id"), "testString"); + assertEquals(query.get("version_group_label"), "6702d85a-6437-4d6f-8701-c0146648787b"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("sort"), "created_on"); + assertEquals(query.get("direction"), "desc"); assertEquals(query.get("start"), "testString"); } - // Test the listControlLibraries operation with and without retries enabled + // Test the listInstanceAttachments operation with and without retries enabled @Test - public void testListControlLibrariesWRetries() throws Throwable { + public void testListInstanceAttachmentsWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testListControlLibrariesWOptions(); + testListInstanceAttachmentsWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testListControlLibrariesWOptions(); + testListInstanceAttachmentsWOptions(); } - // Test the listControlLibraries operation using the ControlLibrariesPager.getNext() method + // Test the listInstanceAttachments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListInstanceAttachmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listInstanceAttachments(null).execute(); + } + + // Test the listInstanceAttachments operation using the InstanceAttachmentsPager.getNext() method @Test - public void testListControlLibrariesWithPagerGetNext() throws Throwable { + public void testListInstanceAttachmentsWithPagerGetNext() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"control_libraries\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"control_library_name\":\"controlLibraryName\",\"control_library_description\":\"controlLibraryDescription\",\"control_library_type\":\"controlLibraryType\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"version_group_label\":\"versionGroupLabel\",\"control_library_version\":\"controlLibraryVersion\",\"latest\":true,\"controls_count\":13}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"control_libraries\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"control_library_name\":\"controlLibraryName\",\"control_library_description\":\"controlLibraryDescription\",\"control_library_type\":\"controlLibraryType\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"version_group_label\":\"versionGroupLabel\",\"control_library_version\":\"controlLibraryVersion\",\"latest\":true,\"controls_count\":13}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"attachments\":[{\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}],\"description\":\"description\",\"name\":\"name\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":15,\"failed_control_ids\":[\"failedControlIds\"]}},\"schedule\":\"daily\",\"scope\":[{\"id\":\"id\"}],\"status\":\"enabled\",\"data_selection_range\":{\"start_date\":\"2025-02-28T05:42:58.000Z\",\"end_date\":\"2025-02-28T05:42:58.000Z\"},\"account_id\":\"accountId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"id\":\"id\",\"instance_id\":\"instanceId\",\"last_scan\":{\"id\":\"id\",\"status\":\"status\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"profile_id\":\"profileId\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"attachments\":[{\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}],\"description\":\"description\",\"name\":\"name\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":15,\"failed_control_ids\":[\"failedControlIds\"]}},\"schedule\":\"daily\",\"scope\":[{\"id\":\"id\"}],\"status\":\"enabled\",\"data_selection_range\":{\"start_date\":\"2025-02-28T05:42:58.000Z\",\"end_date\":\"2025-02-28T05:42:58.000Z\"},\"account_id\":\"accountId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"id\":\"id\",\"instance_id\":\"instanceId\",\"last_scan\":{\"id\":\"id\",\"status\":\"status\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"profile_id\":\"profileId\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\"}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -436,29 +527,31 @@ public void testListControlLibrariesWithPagerGetNext() throws Throwable { .setResponseCode(400) .setBody("{\"message\": \"No more results available!\"}")); - ListControlLibrariesOptions listControlLibrariesOptions = new ListControlLibrariesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("50")) - .controlLibraryType("custom") + ListInstanceAttachmentsOptions listInstanceAttachmentsOptions = new ListInstanceAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .versionGroupLabel("6702d85a-6437-4d6f-8701-c0146648787b") + .limit(Long.valueOf("10")) + .sort("created_on") + .direction("desc") .build(); - List allResults = new ArrayList<>(); - ControlLibrariesPager pager = new ControlLibrariesPager(securityAndComplianceCenterApiService, listControlLibrariesOptions); + List allResults = new ArrayList<>(); + InstanceAttachmentsPager pager = new InstanceAttachmentsPager(securityAndComplianceCenterApiService, listInstanceAttachmentsOptions); while (pager.hasNext()) { - List nextPage = pager.getNext(); + List nextPage = pager.getNext(); assertNotNull(nextPage); allResults.addAll(nextPage); } assertEquals(allResults.size(), 2); } - // Test the listControlLibraries operation using the ControlLibrariesPager.getAll() method + // Test the listInstanceAttachments operation using the InstanceAttachmentsPager.getAll() method @Test - public void testListControlLibrariesWithPagerGetAll() throws Throwable { + public void testListInstanceAttachmentsWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"control_libraries\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"control_library_name\":\"controlLibraryName\",\"control_library_description\":\"controlLibraryDescription\",\"control_library_type\":\"controlLibraryType\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"version_group_label\":\"versionGroupLabel\",\"control_library_version\":\"controlLibraryVersion\",\"latest\":true,\"controls_count\":13}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"control_libraries\":[{\"id\":\"id\",\"account_id\":\"accountId\",\"control_library_name\":\"controlLibraryName\",\"control_library_description\":\"controlLibraryDescription\",\"control_library_type\":\"controlLibraryType\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"version_group_label\":\"versionGroupLabel\",\"control_library_version\":\"controlLibraryVersion\",\"latest\":true,\"controls_count\":13}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"attachments\":[{\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}],\"description\":\"description\",\"name\":\"name\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":15,\"failed_control_ids\":[\"failedControlIds\"]}},\"schedule\":\"daily\",\"scope\":[{\"id\":\"id\"}],\"status\":\"enabled\",\"data_selection_range\":{\"start_date\":\"2025-02-28T05:42:58.000Z\",\"end_date\":\"2025-02-28T05:42:58.000Z\"},\"account_id\":\"accountId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"id\":\"id\",\"instance_id\":\"instanceId\",\"last_scan\":{\"id\":\"id\",\"status\":\"status\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"profile_id\":\"profileId\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"attachments\":[{\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}],\"description\":\"description\",\"name\":\"name\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":15,\"failed_control_ids\":[\"failedControlIds\"]}},\"schedule\":\"daily\",\"scope\":[{\"id\":\"id\"}],\"status\":\"enabled\",\"data_selection_range\":{\"start_date\":\"2025-02-28T05:42:58.000Z\",\"end_date\":\"2025-02-28T05:42:58.000Z\"},\"account_id\":\"accountId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"id\":\"id\",\"instance_id\":\"instanceId\",\"last_scan\":{\"id\":\"id\",\"status\":\"status\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"profile_id\":\"profileId\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\"}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -472,98 +565,90 @@ public void testListControlLibrariesWithPagerGetAll() throws Throwable { .setResponseCode(400) .setBody("{\"message\": \"No more results available!\"}")); - ListControlLibrariesOptions listControlLibrariesOptions = new ListControlLibrariesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("50")) - .controlLibraryType("custom") + ListInstanceAttachmentsOptions listInstanceAttachmentsOptions = new ListInstanceAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .versionGroupLabel("6702d85a-6437-4d6f-8701-c0146648787b") + .limit(Long.valueOf("10")) + .sort("created_on") + .direction("desc") .build(); - ControlLibrariesPager pager = new ControlLibrariesPager(securityAndComplianceCenterApiService, listControlLibrariesOptions); - List allResults = pager.getAll(); + InstanceAttachmentsPager pager = new InstanceAttachmentsPager(securityAndComplianceCenterApiService, listInstanceAttachmentsOptions); + List allResults = pager.getAll(); assertNotNull(allResults); assertEquals(allResults.size(), 2); } - // Test the createCustomControlLibrary operation with a valid options model parameter + // Test the createProfileAttachment operation with a valid options model parameter @Test - public void testCreateCustomControlLibraryWOptions() throws Throwable { + public void testCreateProfileAttachmentWOptions() 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\", \"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"; + String mockResponseBody = "{\"profile_id\": \"profileId\", \"attachments\": [{\"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}], \"description\": \"description\", \"name\": \"name\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}, \"schedule\": \"daily\", \"scope\": [{\"id\": \"id\"}], \"status\": \"enabled\", \"data_selection_range\": {\"start_date\": \"2025-02-28T05:42:58.000Z\", \"end_date\": \"2025-02-28T05:42:58.000Z\"}, \"account_id\": \"accountId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"instance_id\": \"instanceId\", \"last_scan\": {\"id\": \"id\", \"status\": \"status\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"profile_id\": \"profileId\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}]}"; + String createProfileAttachmentPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/9c265b4a-4cdf-47f1-acd3-17b5808f7f3f/attachments"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the ParameterInfo model - ParameterInfo parameterInfoModel = new ParameterInfo.Builder() - .parameterName("session_invalidation_in_seconds") - .parameterDisplayName("Sign out due to inactivity in seconds") - .parameterType("numeric") - .parameterValue("public") + // Construct an instance of the Parameter model + Parameter parameterModel = new Parameter.Builder() + .assessmentType("automated") + .assessmentId("rule-e16fcfea-fe21-4d30-a721-423611481fea") + .parameterName("tls_version") + .parameterDisplayName("IBM Cloud Internet Services TLS version") + .parameterType("string_list") + .parameterValue("[\"1.2\", \"1.3\"]") .build(); - // Construct an instance of the Implementation model - 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") - .parameterCount(Long.valueOf("26")) - .parameters(java.util.Arrays.asList(parameterInfoModel)) + // Construct an instance of the AttachmentNotificationsControls model + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList()) .build(); - // Construct an instance of the ControlSpecifications model - 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") - .assessmentsCount(Long.valueOf("26")) - .assessments(java.util.Arrays.asList(implementationModel)) + // Construct an instance of the AttachmentNotifications model + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() + .enabled(true) + .controls(attachmentNotificationsControlsModel) .build(); - // Construct an instance of the ControlDocs model - ControlDocs controlDocsModel = new ControlDocs.Builder() - .controlDocsId("sc-7") - .controlDocsType("ibm-cloud") + // Construct an instance of the MultiCloudScopePayloadById model + MultiCloudScopePayloadById multiCloudScopePayloadModel = new MultiCloudScopePayloadById.Builder() + .id("8baad3b5-2e69-4027-9967-efac19508e1c") .build(); - // Construct an instance of the ControlsInControlLib model - ControlsInControlLib controlsInControlLibModel = new ControlsInControlLib.Builder() - .controlName("SC-7") - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") - .controlDescription("Boundary Protection") - .controlCategory("System and Communications Protection") - .controlParent("testString") - .controlTags(java.util.Arrays.asList("1fa45e17-9322-4e6c-bbd6-1c51db08e790")) - .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) - .controlDocs(controlDocsModel) - .controlRequirement(true) - .status("enabled") + // Construct an instance of the DateRange model + DateRange dateRangeModel = new DateRange.Builder() + .startDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .endDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) .build(); - // Construct an instance of the CreateCustomControlLibraryOptions model - CreateCustomControlLibraryOptions createCustomControlLibraryOptionsModel = 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") - .latest(true) - .controlsCount(Long.valueOf("26")) - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the ProfileAttachmentBase model + ProfileAttachmentBase profileAttachmentBaseModel = new ProfileAttachmentBase.Builder() + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .description("This is a profile attachment targeting IBM CIS Foundation using a SDK") + .name("Profile Attachment for IBM CIS Foundation SDK test") + .notifications(attachmentNotificationsModel) + .schedule("daily") + .scope(java.util.Arrays.asList(multiCloudScopePayloadModel)) + .status("disabled") + .dataSelectionRange(dateRangeModel) + .build(); + + // Construct an instance of the CreateProfileAttachmentOptions model + CreateProfileAttachmentOptions createProfileAttachmentOptionsModel = new CreateProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .newAttachments(java.util.Arrays.asList(profileAttachmentBaseModel)) + .newProfileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3") + .accountId("testString") .build(); - // Invoke createCustomControlLibrary() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.createCustomControlLibrary(createCustomControlLibraryOptionsModel).execute(); + // Invoke createProfileAttachment() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createProfileAttachment(createProfileAttachmentOptionsModel).execute(); assertNotNull(response); - ControlLibrary responseObj = response.getResult(); + ProfileAttachmentResponse responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -572,312 +657,1567 @@ public void testCreateCustomControlLibraryWOptions() throws Throwable { assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createCustomControlLibraryPath); - // Verify that there is no query string + assertEquals(parsedPath, createProfileAttachmentPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); } - // Test the createCustomControlLibrary operation with and without retries enabled + // Test the createProfileAttachment operation with and without retries enabled @Test - public void testCreateCustomControlLibraryWRetries() throws Throwable { + public void testCreateProfileAttachmentWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testCreateCustomControlLibraryWOptions(); + testCreateProfileAttachmentWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testCreateCustomControlLibraryWOptions(); + testCreateProfileAttachmentWOptions(); } - // Test the createCustomControlLibrary operation with a null options model (negative test) + // Test the createProfileAttachment operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateCustomControlLibraryNoOptions() throws Throwable { + public void testCreateProfileAttachmentNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.createCustomControlLibrary(null).execute(); + securityAndComplianceCenterApiService.createProfileAttachment(null).execute(); } - // Test the deleteCustomControlLibrary operation with a valid options model parameter + // Test the getProfileAttachment operation with a valid options model parameter @Test - public void testDeleteCustomControlLibraryWOptions() throws Throwable { + public void testGetProfileAttachmentWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"deleted\": \"deleted\"}"; - String deleteCustomControlLibraryPath = "/control_libraries/testString"; + String mockResponseBody = "{\"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}], \"description\": \"description\", \"name\": \"name\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}, \"schedule\": \"daily\", \"scope\": [{\"id\": \"id\"}], \"status\": \"enabled\", \"data_selection_range\": {\"start_date\": \"2025-02-28T05:42:58.000Z\", \"end_date\": \"2025-02-28T05:42:58.000Z\"}, \"account_id\": \"accountId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"instance_id\": \"instanceId\", \"last_scan\": {\"id\": \"id\", \"status\": \"status\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"profile_id\": \"profileId\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}"; + String getProfileAttachmentPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/9c265b4a-4cdf-47f1-acd3-17b5808f7f3f/attachments/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the DeleteCustomControlLibraryOptions model - DeleteCustomControlLibraryOptions deleteCustomControlLibraryOptionsModel = new DeleteCustomControlLibraryOptions.Builder() - .controlLibrariesId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the GetProfileAttachmentOptions model + GetProfileAttachmentOptions getProfileAttachmentOptionsModel = new GetProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId("testString") + .accountId("testString") .build(); - // Invoke deleteCustomControlLibrary() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.deleteCustomControlLibrary(deleteCustomControlLibraryOptionsModel).execute(); + // Invoke getProfileAttachment() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getProfileAttachment(getProfileAttachmentOptionsModel).execute(); assertNotNull(response); - ControlLibraryDelete responseObj = response.getResult(); + ProfileAttachment responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteCustomControlLibraryPath); - // Verify that there is no query string + assertEquals(parsedPath, getProfileAttachmentPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); } - // Test the deleteCustomControlLibrary operation with and without retries enabled + // Test the getProfileAttachment operation with and without retries enabled @Test - public void testDeleteCustomControlLibraryWRetries() throws Throwable { + public void testGetProfileAttachmentWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testDeleteCustomControlLibraryWOptions(); + testGetProfileAttachmentWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testDeleteCustomControlLibraryWOptions(); + testGetProfileAttachmentWOptions(); } - // Test the deleteCustomControlLibrary operation with a null options model (negative test) + // Test the getProfileAttachment operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteCustomControlLibraryNoOptions() throws Throwable { + public void testGetProfileAttachmentNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.deleteCustomControlLibrary(null).execute(); + securityAndComplianceCenterApiService.getProfileAttachment(null).execute(); } - // Test the getControlLibrary operation with a valid options model parameter + // Test the replaceProfileAttachment operation with a valid options model parameter @Test - public void testGetControlLibraryWOptions() throws Throwable { + public void testReplaceProfileAttachmentWOptions() 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\", \"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"; + String mockResponseBody = "{\"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}], \"description\": \"description\", \"name\": \"name\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}, \"schedule\": \"daily\", \"scope\": [{\"id\": \"id\"}], \"status\": \"enabled\", \"data_selection_range\": {\"start_date\": \"2025-02-28T05:42:58.000Z\", \"end_date\": \"2025-02-28T05:42:58.000Z\"}, \"account_id\": \"accountId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"instance_id\": \"instanceId\", \"last_scan\": {\"id\": \"id\", \"status\": \"status\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"profile_id\": \"profileId\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}"; + String replaceProfileAttachmentPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/9c265b4a-4cdf-47f1-acd3-17b5808f7f3f/attachments/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetControlLibraryOptions model - GetControlLibraryOptions getControlLibraryOptionsModel = new GetControlLibraryOptions.Builder() - .controlLibrariesId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the Parameter model + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") .build(); - // Invoke getControlLibrary() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.getControlLibrary(getControlLibraryOptionsModel).execute(); + // Construct an instance of the AttachmentNotificationsControls model + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList("testString")) + .build(); + + // Construct an instance of the AttachmentNotifications model + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() + .enabled(true) + .controls(attachmentNotificationsControlsModel) + .build(); + + // Construct an instance of the MultiCloudScopePayloadById model + MultiCloudScopePayloadById multiCloudScopePayloadModel = new MultiCloudScopePayloadById.Builder() + .id("testString") + .build(); + + // Construct an instance of the DateRange model + DateRange dateRangeModel = new DateRange.Builder() + .startDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .endDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .build(); + + // Construct an instance of the ReplaceProfileAttachmentOptions model + ReplaceProfileAttachmentOptions replaceProfileAttachmentOptionsModel = new ReplaceProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId("testString") + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .description("testString") + .name("testString") + .notifications(attachmentNotificationsModel) + .schedule("daily") + .scope(java.util.Arrays.asList(multiCloudScopePayloadModel)) + .status("enabled") + .dataSelectionRange(dateRangeModel) + .accountId("testString") + .build(); + + // Invoke replaceProfileAttachment() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.replaceProfileAttachment(replaceProfileAttachmentOptionsModel).execute(); assertNotNull(response); - ControlLibrary responseObj = response.getResult(); + ProfileAttachment 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"); + assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getControlLibraryPath); - // Verify that there is no query string + assertEquals(parsedPath, replaceProfileAttachmentPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); } - // Test the getControlLibrary operation with and without retries enabled + // Test the replaceProfileAttachment operation with and without retries enabled @Test - public void testGetControlLibraryWRetries() throws Throwable { + public void testReplaceProfileAttachmentWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testGetControlLibraryWOptions(); + testReplaceProfileAttachmentWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testGetControlLibraryWOptions(); + testReplaceProfileAttachmentWOptions(); } - // Test the getControlLibrary operation with a null options model (negative test) + // Test the replaceProfileAttachment operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetControlLibraryNoOptions() throws Throwable { + public void testReplaceProfileAttachmentNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.getControlLibrary(null).execute(); + securityAndComplianceCenterApiService.replaceProfileAttachment(null).execute(); } - // Test the replaceCustomControlLibrary operation with a valid options model parameter + // Test the deleteProfileAttachment operation with a valid options model parameter @Test - public void testReplaceCustomControlLibraryWOptions() throws Throwable { + public void testDeleteProfileAttachmentWOptions() 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\", \"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"; + String mockResponseBody = "{\"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}], \"description\": \"description\", \"name\": \"name\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}, \"schedule\": \"daily\", \"scope\": [{\"id\": \"id\"}], \"status\": \"enabled\", \"data_selection_range\": {\"start_date\": \"2025-02-28T05:42:58.000Z\", \"end_date\": \"2025-02-28T05:42:58.000Z\"}, \"account_id\": \"accountId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"instance_id\": \"instanceId\", \"last_scan\": {\"id\": \"id\", \"status\": \"status\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"profile_id\": \"profileId\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}"; + String deleteProfileAttachmentPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/9c265b4a-4cdf-47f1-acd3-17b5808f7f3f/attachments/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ParameterInfo model - ParameterInfo parameterInfoModel = new ParameterInfo.Builder() - .parameterName("session_invalidation_in_seconds") - .parameterDisplayName("Sign out due to inactivity in seconds") - .parameterType("numeric") - .parameterValue("public") - .build(); - - // Construct an instance of the Implementation model - 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") - .parameterCount(Long.valueOf("26")) - .parameters(java.util.Arrays.asList(parameterInfoModel)) - .build(); - - // Construct an instance of the ControlSpecifications model - 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") - .assessmentsCount(Long.valueOf("26")) - .assessments(java.util.Arrays.asList(implementationModel)) - .build(); - - // Construct an instance of the ControlDocs model - ControlDocs controlDocsModel = new ControlDocs.Builder() - .controlDocsId("sc-7") - .controlDocsType("ibm-cloud") - .build(); - - // Construct an instance of the ControlsInControlLib model - ControlsInControlLib controlsInControlLibModel = new ControlsInControlLib.Builder() - .controlName("SC-7") - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") - .controlDescription("Boundary Protection") - .controlCategory("System and Communications Protection") - .controlParent("testString") - .controlTags(java.util.Arrays.asList("1fa45e17-9322-4e6c-bbd6-1c51db08e790")) - .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) - .controlDocs(controlDocsModel) - .controlRequirement(true) - .status("enabled") - .build(); - - // Construct an instance of the ReplaceCustomControlLibraryOptions model - ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptionsModel = new ReplaceCustomControlLibraryOptions.Builder() - .controlLibrariesId("testString") - .id("testString") + // Construct an instance of the DeleteProfileAttachmentOptions model + DeleteProfileAttachmentOptions deleteProfileAttachmentOptionsModel = new DeleteProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId("testString") .accountId("testString") - .controlLibraryName("IBM Cloud for Financial Services") - .controlLibraryDescription("IBM Cloud for Financial Services") - .controlLibraryType("custom") - .versionGroupLabel("testString") - .controlLibraryVersion("1.1.0") - .createdOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .createdBy("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .updatedBy("testString") - .latest(true) - .hierarchyEnabled(true) - .controlsCount(Long.valueOf("26")) - .controlParentsCount(Long.valueOf("26")) - .controls(java.util.Arrays.asList(controlsInControlLibModel)) - .xCorrelationId("testString") - .xRequestId("testString") .build(); - // Invoke replaceCustomControlLibrary() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.replaceCustomControlLibrary(replaceCustomControlLibraryOptionsModel).execute(); + // Invoke deleteProfileAttachment() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.deleteProfileAttachment(deleteProfileAttachmentOptionsModel).execute(); assertNotNull(response); - ControlLibrary responseObj = response.getResult(); + ProfileAttachment responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, replaceCustomControlLibraryPath); - // Verify that there is no query string + assertEquals(parsedPath, deleteProfileAttachmentPath); + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); } - // Test the replaceCustomControlLibrary operation with and without retries enabled + // Test the deleteProfileAttachment operation with and without retries enabled @Test - public void testReplaceCustomControlLibraryWRetries() throws Throwable { + public void testDeleteProfileAttachmentWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testReplaceCustomControlLibraryWOptions(); + testDeleteProfileAttachmentWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testReplaceCustomControlLibraryWOptions(); + testDeleteProfileAttachmentWOptions(); } - // Test the replaceCustomControlLibrary operation with a null options model (negative test) + // Test the deleteProfileAttachment operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceCustomControlLibraryNoOptions() throws Throwable { + public void testDeleteProfileAttachmentNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.replaceCustomControlLibrary(null).execute(); + securityAndComplianceCenterApiService.deleteProfileAttachment(null).execute(); } - // Test the listProfiles operation with a valid options model parameter + // Test the upgradeAttachment operation with a valid options model parameter @Test - public void testListProfilesWOptions() throws Throwable { + public void testUpgradeAttachmentWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"total_count\": 1, \"limit\": 20, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"profiles\": [{\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"profileType\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"versionGroupLabel\", \"latest\": 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, \"attachments_count\": 16}]}"; - String listProfilesPath = "/profiles"; + String mockResponseBody = "{\"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}], \"description\": \"description\", \"name\": \"name\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}, \"schedule\": \"daily\", \"scope\": [{\"id\": \"id\"}], \"status\": \"enabled\", \"data_selection_range\": {\"start_date\": \"2025-02-28T05:42:58.000Z\", \"end_date\": \"2025-02-28T05:42:58.000Z\"}, \"account_id\": \"accountId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"instance_id\": \"instanceId\", \"last_scan\": {\"id\": \"id\", \"status\": \"status\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"profile_id\": \"profileId\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}"; + String upgradeAttachmentPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/9c265b4a-4cdf-47f1-acd3-17b5808f7f3f/attachments/testString/upgrade"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListProfilesOptions model - ListProfilesOptions listProfilesOptionsModel = new ListProfilesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) - .profileType("custom") - .start("testString") + // Construct an instance of the Parameter model + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") .build(); - // Invoke listProfiles() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.listProfiles(listProfilesOptionsModel).execute(); + // Construct an instance of the UpgradeAttachmentOptions model + UpgradeAttachmentOptions upgradeAttachmentOptionsModel = new UpgradeAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId("testString") + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .accountId("testString") + .build(); + + // Invoke upgradeAttachment() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.upgradeAttachment(upgradeAttachmentOptionsModel).execute(); assertNotNull(response); - ProfileCollection responseObj = response.getResult(); + ProfileAttachment 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"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listProfilesPath); + assertEquals(parsedPath, upgradeAttachmentPath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("profile_type"), "custom"); - assertEquals(query.get("start"), "testString"); + assertEquals(query.get("account_id"), "testString"); } - // Test the listProfiles operation with and without retries enabled + // Test the upgradeAttachment operation with and without retries enabled @Test - public void testListProfilesWRetries() throws Throwable { + public void testUpgradeAttachmentWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testListProfilesWOptions(); + testUpgradeAttachmentWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testListProfilesWOptions(); + testUpgradeAttachmentWOptions(); } - // Test the listProfiles operation using the ProfilesPager.getNext() method - @Test - public void testListProfilesWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"profiles\":[{\"id\":\"id\",\"profile_name\":\"profileName\",\"profile_description\":\"profileDescription\",\"profile_type\":\"profileType\",\"profile_version\":\"profileVersion\",\"version_group_label\":\"versionGroupLabel\",\"latest\":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,\"attachments_count\":16}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"profiles\":[{\"id\":\"id\",\"profile_name\":\"profileName\",\"profile_description\":\"profileDescription\",\"profile_type\":\"profileType\",\"profile_version\":\"profileVersion\",\"version_group_label\":\"versionGroupLabel\",\"latest\":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,\"attachments_count\":16}]}"; - server.enqueue(new MockResponse() + // Test the upgradeAttachment operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpgradeAttachmentNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.upgradeAttachment(null).execute(); + } + + // Test the createScan operation with a valid options model parameter + @Test + public void testCreateScanWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"attachment_id\": \"attachmentId\", \"report_id\": \"reportId\", \"status\": \"status\", \"last_scan_time\": \"2019-01-01T12:00:00.000Z\", \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"scan_type\": \"scanType\", \"occurence\": 9}"; + String createScanPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scans"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateScanOptions model + CreateScanOptions createScanOptionsModel = new CreateScanOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .attachmentId("4deb572c-9f37-4126-9cc0-d550672533cb") + .accountId("testString") + .build(); + + // Invoke createScan() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createScan(createScanOptionsModel).execute(); + assertNotNull(response); + CreateScanResponse responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createScanPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the createScan operation with and without retries enabled + @Test + public void testCreateScanWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testCreateScanWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testCreateScanWOptions(); + } + + // Test the createScan operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateScanNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.createScan(null).execute(); + } + + // Test the createControlLibrary operation with a valid options model parameter + @Test + public void testCreateControlLibraryWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"custom\", \"control_library_version\": \"controlLibraryVersion\", \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"controlId\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_severity\": \"controlSeverity\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"status\": \"status\"}], \"id\": \"id\", \"account_id\": \"accountId\", \"version_group_label\": \"versionGroupLabel\", \"latest\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19}"; + String createControlLibraryPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the AssessmentPrototype model + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e") + .assessmentDescription("This rule will check on regulation") + .build(); + + // Construct an instance of the ControlSpecificationPrototype model + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("apprapp") + .environment("ibm-cloud") + .controlSpecificationId("testString") + .controlSpecificationDescription("This field is used to describe a control specification") + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) + .build(); + + // Construct an instance of the ControlDoc model + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + + // Construct an instance of the ControlPrototype model + ControlPrototype controlPrototypeModel = new ControlPrototype.Builder() + .controlName("security") + .controlDescription("This is a description of a control") + .controlCategory("test-control") + .controlRequirement(true) + .controlParent("testString") + .controlSpecifications(java.util.Arrays.asList(controlSpecificationPrototypeModel)) + .controlDocs(controlDocModel) + .status("disabled") + .build(); + + // Construct an instance of the CreateControlLibraryOptions model + CreateControlLibraryOptions createControlLibraryOptionsModel = new CreateControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryName("custom control library from SDK") + .controlLibraryDescription("This is a custom control library made from the SDK test framework") + .controlLibraryType("custom") + .controlLibraryVersion("0.0.1") + .controls(java.util.Arrays.asList(controlPrototypeModel)) + .accountId("testString") + .build(); + + // Invoke createControlLibrary() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createControlLibrary(createControlLibraryOptionsModel).execute(); + assertNotNull(response); + ControlLibrary responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createControlLibraryPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the createControlLibrary operation with and without retries enabled + @Test + public void testCreateControlLibraryWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testCreateControlLibraryWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testCreateControlLibraryWOptions(); + } + + // Test the createControlLibrary operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateControlLibraryNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.createControlLibrary(null).execute(); + } + + // Test the listControlLibraries operation with a valid options model parameter + @Test + public void testListControlLibrariesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"control_libraries\": [{\"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"custom\", \"control_library_version\": \"controlLibraryVersion\", \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"controlId\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_severity\": \"controlSeverity\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"status\": \"status\"}], \"id\": \"id\", \"account_id\": \"accountId\", \"version_group_label\": \"versionGroupLabel\", \"latest\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19}]}"; + String listControlLibrariesPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListControlLibrariesOptions model + ListControlLibrariesOptions listControlLibrariesOptionsModel = new ListControlLibrariesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listControlLibraries() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listControlLibraries(listControlLibrariesOptionsModel).execute(); + assertNotNull(response); + ControlLibraryCollection 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, listControlLibrariesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listControlLibraries operation with and without retries enabled + @Test + public void testListControlLibrariesWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testListControlLibrariesWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testListControlLibrariesWOptions(); + } + + // Test the listControlLibraries operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListControlLibrariesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listControlLibraries(null).execute(); + } + + // Test the listControlLibraries operation using the ControlLibrariesPager.getNext() method + @Test + public void testListControlLibrariesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"control_libraries\":[{\"control_library_name\":\"controlLibraryName\",\"control_library_description\":\"controlLibraryDescription\",\"control_library_type\":\"custom\",\"control_library_version\":\"controlLibraryVersion\",\"controls\":[{\"control_name\":\"controlName\",\"control_id\":\"controlId\",\"control_description\":\"controlDescription\",\"control_category\":\"controlCategory\",\"control_parent\":\"controlParent\",\"control_severity\":\"controlSeverity\",\"control_tags\":[\"controlTags\"],\"control_specifications\":[{\"id\":\"id\",\"responsibility\":\"responsibility\",\"component_id\":\"componentId\",\"component_name\":\"componentName\",\"component_type\":\"componentType\",\"environment\":\"environment\",\"description\":\"description\",\"assessments_count\":16,\"assessments\":[{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]}]}],\"control_docs\":{\"control_docs_id\":\"controlDocsId\",\"control_docs_type\":\"controlDocsType\"},\"status\":\"status\"}],\"id\":\"id\",\"account_id\":\"accountId\",\"version_group_label\":\"versionGroupLabel\",\"latest\":true,\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"hierarchy_enabled\":true,\"controls_count\":13,\"control_parents_count\":19}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"control_libraries\":[{\"control_library_name\":\"controlLibraryName\",\"control_library_description\":\"controlLibraryDescription\",\"control_library_type\":\"custom\",\"control_library_version\":\"controlLibraryVersion\",\"controls\":[{\"control_name\":\"controlName\",\"control_id\":\"controlId\",\"control_description\":\"controlDescription\",\"control_category\":\"controlCategory\",\"control_parent\":\"controlParent\",\"control_severity\":\"controlSeverity\",\"control_tags\":[\"controlTags\"],\"control_specifications\":[{\"id\":\"id\",\"responsibility\":\"responsibility\",\"component_id\":\"componentId\",\"component_name\":\"componentName\",\"component_type\":\"componentType\",\"environment\":\"environment\",\"description\":\"description\",\"assessments_count\":16,\"assessments\":[{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]}]}],\"control_docs\":{\"control_docs_id\":\"controlDocsId\",\"control_docs_type\":\"controlDocsType\"},\"status\":\"status\"}],\"id\":\"id\",\"account_id\":\"accountId\",\"version_group_label\":\"versionGroupLabel\",\"latest\":true,\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"hierarchy_enabled\":true,\"controls_count\":13,\"control_parents_count\":19}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListControlLibrariesOptions listControlLibrariesOptions = new ListControlLibrariesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ControlLibrariesPager pager = new ControlLibrariesPager(securityAndComplianceCenterApiService, listControlLibrariesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listControlLibraries operation using the ControlLibrariesPager.getAll() method + @Test + public void testListControlLibrariesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"control_libraries\":[{\"control_library_name\":\"controlLibraryName\",\"control_library_description\":\"controlLibraryDescription\",\"control_library_type\":\"custom\",\"control_library_version\":\"controlLibraryVersion\",\"controls\":[{\"control_name\":\"controlName\",\"control_id\":\"controlId\",\"control_description\":\"controlDescription\",\"control_category\":\"controlCategory\",\"control_parent\":\"controlParent\",\"control_severity\":\"controlSeverity\",\"control_tags\":[\"controlTags\"],\"control_specifications\":[{\"id\":\"id\",\"responsibility\":\"responsibility\",\"component_id\":\"componentId\",\"component_name\":\"componentName\",\"component_type\":\"componentType\",\"environment\":\"environment\",\"description\":\"description\",\"assessments_count\":16,\"assessments\":[{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]}]}],\"control_docs\":{\"control_docs_id\":\"controlDocsId\",\"control_docs_type\":\"controlDocsType\"},\"status\":\"status\"}],\"id\":\"id\",\"account_id\":\"accountId\",\"version_group_label\":\"versionGroupLabel\",\"latest\":true,\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"hierarchy_enabled\":true,\"controls_count\":13,\"control_parents_count\":19}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"control_libraries\":[{\"control_library_name\":\"controlLibraryName\",\"control_library_description\":\"controlLibraryDescription\",\"control_library_type\":\"custom\",\"control_library_version\":\"controlLibraryVersion\",\"controls\":[{\"control_name\":\"controlName\",\"control_id\":\"controlId\",\"control_description\":\"controlDescription\",\"control_category\":\"controlCategory\",\"control_parent\":\"controlParent\",\"control_severity\":\"controlSeverity\",\"control_tags\":[\"controlTags\"],\"control_specifications\":[{\"id\":\"id\",\"responsibility\":\"responsibility\",\"component_id\":\"componentId\",\"component_name\":\"componentName\",\"component_type\":\"componentType\",\"environment\":\"environment\",\"description\":\"description\",\"assessments_count\":16,\"assessments\":[{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]}]}],\"control_docs\":{\"control_docs_id\":\"controlDocsId\",\"control_docs_type\":\"controlDocsType\"},\"status\":\"status\"}],\"id\":\"id\",\"account_id\":\"accountId\",\"version_group_label\":\"versionGroupLabel\",\"latest\":true,\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"hierarchy_enabled\":true,\"controls_count\":13,\"control_parents_count\":19}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListControlLibrariesOptions listControlLibrariesOptions = new ListControlLibrariesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .limit(Long.valueOf("10")) + .build(); + + ControlLibrariesPager pager = new ControlLibrariesPager(securityAndComplianceCenterApiService, listControlLibrariesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceCustomControlLibrary operation with a valid options model parameter + @Test + public void testReplaceCustomControlLibraryWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"custom\", \"control_library_version\": \"controlLibraryVersion\", \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"controlId\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_severity\": \"controlSeverity\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"status\": \"status\"}], \"id\": \"id\", \"account_id\": \"accountId\", \"version_group_label\": \"versionGroupLabel\", \"latest\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19}"; + String replaceCustomControlLibraryPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the AssessmentPrototype model + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e") + .assessmentDescription("This rule will check on regulation") + .build(); + + // Construct an instance of the ControlSpecificationPrototype model + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("apprapp") + .environment("ibm-cloud") + .controlSpecificationId("testString") + .controlSpecificationDescription("This field is used to describe a control specification") + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) + .build(); + + // Construct an instance of the ControlDoc model + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + + // Construct an instance of the ControlPrototype model + ControlPrototype controlPrototypeModel = new ControlPrototype.Builder() + .controlName("security") + .controlDescription("This is a description of a control") + .controlCategory("test-control") + .controlRequirement(true) + .controlParent("testString") + .controlSpecifications(java.util.Arrays.asList(controlSpecificationPrototypeModel)) + .controlDocs(controlDocModel) + .status("disabled") + .build(); + + // Construct an instance of the ReplaceCustomControlLibraryOptions model + ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptionsModel = new ReplaceCustomControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId("testString") + .controlLibraryName("custom control library from SDK") + .controlLibraryDescription("This is a custom control library made from the SDK test framework") + .controlLibraryType("custom") + .controlLibraryVersion("0.0.2") + .controls(java.util.Arrays.asList(controlPrototypeModel)) + .bssAccount("testString") + .build(); + + // Invoke replaceCustomControlLibrary() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.replaceCustomControlLibrary(replaceCustomControlLibraryOptionsModel).execute(); + assertNotNull(response); + ControlLibrary responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "PUT"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, replaceCustomControlLibraryPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("bss_account"), "testString"); + } + + // Test the replaceCustomControlLibrary operation with and without retries enabled + @Test + public void testReplaceCustomControlLibraryWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testReplaceCustomControlLibraryWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testReplaceCustomControlLibraryWOptions(); + } + + // Test the replaceCustomControlLibrary operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceCustomControlLibraryNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.replaceCustomControlLibrary(null).execute(); + } + + // Test the getControlLibrary operation with a valid options model parameter + @Test + public void testGetControlLibraryWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"custom\", \"control_library_version\": \"controlLibraryVersion\", \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"controlId\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_severity\": \"controlSeverity\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"status\": \"status\"}], \"id\": \"id\", \"account_id\": \"accountId\", \"version_group_label\": \"versionGroupLabel\", \"latest\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19}"; + String getControlLibraryPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetControlLibraryOptions model + GetControlLibraryOptions getControlLibraryOptionsModel = new GetControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId("testString") + .accountId("testString") + .build(); + + // Invoke getControlLibrary() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getControlLibrary(getControlLibraryOptionsModel).execute(); + assertNotNull(response); + ControlLibrary 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, getControlLibraryPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the getControlLibrary operation with and without retries enabled + @Test + public void testGetControlLibraryWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testGetControlLibraryWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testGetControlLibraryWOptions(); + } + + // Test the getControlLibrary operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetControlLibraryNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.getControlLibrary(null).execute(); + } + + // Test the deleteCustomControlLibrary operation with a valid options model parameter + @Test + public void testDeleteCustomControlLibraryWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"control_library_name\": \"controlLibraryName\", \"control_library_description\": \"controlLibraryDescription\", \"control_library_type\": \"custom\", \"control_library_version\": \"controlLibraryVersion\", \"controls\": [{\"control_name\": \"controlName\", \"control_id\": \"controlId\", \"control_description\": \"controlDescription\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_severity\": \"controlSeverity\", \"control_tags\": [\"controlTags\"], \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}], \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"status\": \"status\"}], \"id\": \"id\", \"account_id\": \"accountId\", \"version_group_label\": \"versionGroupLabel\", \"latest\": true, \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"hierarchy_enabled\": true, \"controls_count\": 13, \"control_parents_count\": 19}"; + String deleteCustomControlLibraryPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteCustomControlLibraryOptions model + DeleteCustomControlLibraryOptions deleteCustomControlLibraryOptionsModel = new DeleteCustomControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId("testString") + .accountId("testString") + .build(); + + // Invoke deleteCustomControlLibrary() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.deleteCustomControlLibrary(deleteCustomControlLibraryOptionsModel).execute(); + assertNotNull(response); + ControlLibrary responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "DELETE"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, deleteCustomControlLibraryPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the deleteCustomControlLibrary operation with and without retries enabled + @Test + public void testDeleteCustomControlLibraryWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testDeleteCustomControlLibraryWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testDeleteCustomControlLibraryWOptions(); + } + + // Test the deleteCustomControlLibrary operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteCustomControlLibraryNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.deleteCustomControlLibrary(null).execute(); + } + + // Test the createProfile operation with a valid options model parameter + @Test + public void testCreateProfileWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"instance_id\": \"instanceId\", \"hierarchy_enabled\": true, \"profile_description\": \"profileDescription\", \"profile_type\": \"custom\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"versionGroupLabel\", \"latest\": 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, \"attachments_count\": 16, \"controls\": [{\"control_requirement\": true, \"control_library_id\": \"controlLibraryId\", \"control_id\": \"controlId\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_severity\": \"controlSeverity\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"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\": \"parameterType\"}]}"; + String createProfilePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the ProfileControlsPrototype model + ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() + .controlLibraryId("a046fb6b-aba5-4646-b190-a2c76241e7af") + .controlId("60dae3b5-6104-4b3e-bac7-26cc7b741aca") + .build(); + + // Construct an instance of the DefaultParameters model + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("automated") + .assessmentId("rule-e16fcfea-fe21-4d30-a721-423611481fea") + .parameterName("tls_version") + .parameterDefaultValue("[\"1.2\",\"1.3\"]") + .parameterDisplayName("IBM Cloud Internet Services TLS version") + .parameterType("string_list") + .build(); + + // Construct an instance of the CreateProfileOptions model + CreateProfileOptions createProfileOptionsModel = new CreateProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileName("Example Profile") + .profileVersion("0.0.1") + .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .profileDescription("This profile is created as an example of the SDK gen") + .latest(true) + .versionGroupLabel("testString") + .accountId("testString") + .build(); + + // Invoke createProfile() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createProfile(createProfileOptionsModel).execute(); + assertNotNull(response); + Profile responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createProfilePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the createProfile operation with and without retries enabled + @Test + public void testCreateProfileWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testCreateProfileWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testCreateProfileWOptions(); + } + + // Test the createProfile operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateProfileNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.createProfile(null).execute(); + } + + // Test the listProfiles operation with a valid options model parameter + @Test + public void testListProfilesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"profiles\": [{\"id\": \"id\", \"profile_name\": \"profileName\", \"instance_id\": \"instanceId\", \"hierarchy_enabled\": true, \"profile_description\": \"profileDescription\", \"profile_type\": \"custom\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"versionGroupLabel\", \"latest\": 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, \"attachments_count\": 16, \"controls\": [{\"control_requirement\": true, \"control_library_id\": \"controlLibraryId\", \"control_id\": \"controlId\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_severity\": \"controlSeverity\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"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\": \"parameterType\"}]}]}"; + String listProfilesPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListProfilesOptions model + ListProfilesOptions listProfilesOptionsModel = new ListProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .limit(Long.valueOf("10")) + .start("testString") + .build(); + + // Invoke listProfiles() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listProfiles(listProfilesOptionsModel).execute(); + assertNotNull(response); + ProfileCollection 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, listProfilesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + } + + // Test the listProfiles operation with and without retries enabled + @Test + public void testListProfilesWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testListProfilesWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testListProfilesWOptions(); + } + + // Test the listProfiles operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListProfilesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listProfiles(null).execute(); + } + + // Test the listProfiles operation using the ProfilesPager.getNext() method + @Test + public void testListProfilesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"profiles\":[{\"id\":\"id\",\"profile_name\":\"profileName\",\"instance_id\":\"instanceId\",\"hierarchy_enabled\":true,\"profile_description\":\"profileDescription\",\"profile_type\":\"custom\",\"profile_version\":\"profileVersion\",\"version_group_label\":\"versionGroupLabel\",\"latest\":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,\"attachments_count\":16,\"controls\":[{\"control_requirement\":true,\"control_library_id\":\"controlLibraryId\",\"control_id\":\"controlId\",\"control_library_version\":\"controlLibraryVersion\",\"control_name\":\"controlName\",\"control_description\":\"controlDescription\",\"control_severity\":\"controlSeverity\",\"control_category\":\"controlCategory\",\"control_parent\":\"controlParent\",\"control_docs\":{\"control_docs_id\":\"controlDocsId\",\"control_docs_type\":\"controlDocsType\"},\"control_specifications\":[{\"id\":\"id\",\"responsibility\":\"responsibility\",\"component_id\":\"componentId\",\"component_name\":\"componentName\",\"component_type\":\"componentType\",\"environment\":\"environment\",\"description\":\"description\",\"assessments_count\":16,\"assessments\":[{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"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\":\"parameterType\"}]}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"profiles\":[{\"id\":\"id\",\"profile_name\":\"profileName\",\"instance_id\":\"instanceId\",\"hierarchy_enabled\":true,\"profile_description\":\"profileDescription\",\"profile_type\":\"custom\",\"profile_version\":\"profileVersion\",\"version_group_label\":\"versionGroupLabel\",\"latest\":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,\"attachments_count\":16,\"controls\":[{\"control_requirement\":true,\"control_library_id\":\"controlLibraryId\",\"control_id\":\"controlId\",\"control_library_version\":\"controlLibraryVersion\",\"control_name\":\"controlName\",\"control_description\":\"controlDescription\",\"control_severity\":\"controlSeverity\",\"control_category\":\"controlCategory\",\"control_parent\":\"controlParent\",\"control_docs\":{\"control_docs_id\":\"controlDocsId\",\"control_docs_type\":\"controlDocsType\"},\"control_specifications\":[{\"id\":\"id\",\"responsibility\":\"responsibility\",\"component_id\":\"componentId\",\"component_name\":\"componentName\",\"component_type\":\"componentType\",\"environment\":\"environment\",\"description\":\"description\",\"assessments_count\":16,\"assessments\":[{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"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\":\"parameterType\"}]}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListProfilesOptions listProfilesOptions = new ListProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .limit(Long.valueOf("10")) + .build(); + + List allResults = new ArrayList<>(); + ProfilesPager pager = new ProfilesPager(securityAndComplianceCenterApiService, listProfilesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listProfiles operation using the ProfilesPager.getAll() method + @Test + public void testListProfilesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"profiles\":[{\"id\":\"id\",\"profile_name\":\"profileName\",\"instance_id\":\"instanceId\",\"hierarchy_enabled\":true,\"profile_description\":\"profileDescription\",\"profile_type\":\"custom\",\"profile_version\":\"profileVersion\",\"version_group_label\":\"versionGroupLabel\",\"latest\":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,\"attachments_count\":16,\"controls\":[{\"control_requirement\":true,\"control_library_id\":\"controlLibraryId\",\"control_id\":\"controlId\",\"control_library_version\":\"controlLibraryVersion\",\"control_name\":\"controlName\",\"control_description\":\"controlDescription\",\"control_severity\":\"controlSeverity\",\"control_category\":\"controlCategory\",\"control_parent\":\"controlParent\",\"control_docs\":{\"control_docs_id\":\"controlDocsId\",\"control_docs_type\":\"controlDocsType\"},\"control_specifications\":[{\"id\":\"id\",\"responsibility\":\"responsibility\",\"component_id\":\"componentId\",\"component_name\":\"componentName\",\"component_type\":\"componentType\",\"environment\":\"environment\",\"description\":\"description\",\"assessments_count\":16,\"assessments\":[{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"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\":\"parameterType\"}]}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"profiles\":[{\"id\":\"id\",\"profile_name\":\"profileName\",\"instance_id\":\"instanceId\",\"hierarchy_enabled\":true,\"profile_description\":\"profileDescription\",\"profile_type\":\"custom\",\"profile_version\":\"profileVersion\",\"version_group_label\":\"versionGroupLabel\",\"latest\":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,\"attachments_count\":16,\"controls\":[{\"control_requirement\":true,\"control_library_id\":\"controlLibraryId\",\"control_id\":\"controlId\",\"control_library_version\":\"controlLibraryVersion\",\"control_name\":\"controlName\",\"control_description\":\"controlDescription\",\"control_severity\":\"controlSeverity\",\"control_category\":\"controlCategory\",\"control_parent\":\"controlParent\",\"control_docs\":{\"control_docs_id\":\"controlDocsId\",\"control_docs_type\":\"controlDocsType\"},\"control_specifications\":[{\"id\":\"id\",\"responsibility\":\"responsibility\",\"component_id\":\"componentId\",\"component_name\":\"componentName\",\"component_type\":\"componentType\",\"environment\":\"environment\",\"description\":\"description\",\"assessments_count\":16,\"assessments\":[{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"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\":\"parameterType\"}]}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListProfilesOptions listProfilesOptions = new ListProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .limit(Long.valueOf("10")) + .build(); + + ProfilesPager pager = new ProfilesPager(securityAndComplianceCenterApiService, listProfilesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the replaceProfile operation with a valid options model parameter + @Test + public void testReplaceProfileWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"instance_id\": \"instanceId\", \"hierarchy_enabled\": true, \"profile_description\": \"profileDescription\", \"profile_type\": \"custom\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"versionGroupLabel\", \"latest\": 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, \"attachments_count\": 16, \"controls\": [{\"control_requirement\": true, \"control_library_id\": \"controlLibraryId\", \"control_id\": \"controlId\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_severity\": \"controlSeverity\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"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\": \"parameterType\"}]}"; + String replaceProfilePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ControlDoc model + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + + // Construct an instance of the Parameter model + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + + // Construct an instance of the Assessment model + Assessment assessmentModel = new Assessment.Builder() + .assessmentId("382c2b06-e6b2-43ee-b189-c1c7743b67ee") + .assessmentType("ibm-cloud-rule") + .assessmentMethod("ibm-cloud-rule") + .assessmentDescription("Check whether Cloud Object Storage is accessible only by using private endpoints") + .parameterCount(Long.valueOf("1")) + .parameters(java.util.Arrays.asList(parameterModel)) + .build(); + + // Construct an instance of the ControlSpecification model + ControlSpecification controlSpecificationModel = new ControlSpecification.Builder() + .id("testString") + .responsibility("testString") + .componentId("testString") + .componentName("testString") + .componentType("testString") + .environment("testString") + .description("testString") + .assessmentsCount(Long.valueOf("26")) + .assessments(java.util.Arrays.asList(assessmentModel)) + .build(); + + // Construct an instance of the ProfileControls model + ProfileControls profileControlsModel = new ProfileControls.Builder() + .controlRequirement(true) + .controlLibraryId("a046fb6b-aba5-4646-b190-a2c76241e7af") + .controlId("60dae3b5-6104-4b3e-bac7-26cc7b741aca") + .controlLibraryVersion("testString") + .controlName("testString") + .controlDescription("testString") + .controlSeverity("testString") + .controlCategory("testString") + .controlParent("testString") + .controlDocs(controlDocModel) + .controlSpecifications(java.util.Arrays.asList(controlSpecificationModel)) + .build(); + + // Construct an instance of the DefaultParameters model + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("automated") + .assessmentId("rule-e16fcfea-fe21-4d30-a721-423611481fea") + .parameterName("tls_version") + .parameterDefaultValue("[\"1.2\",\"1.3\"]") + .parameterDisplayName("IBM Cloud Internet Services TLS version") + .parameterType("string_list") + .build(); + + // Construct an instance of the ReplaceProfileOptions model + ReplaceProfileOptions replaceProfileOptionsModel = new ReplaceProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("testString") + .newProfileType("custom") + .newControls(java.util.Arrays.asList(profileControlsModel)) + .newDefaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .newId("testString") + .newProfileName("Example Profile Updated") + .newInstanceId("testString") + .newHierarchyEnabled(true) + .newProfileDescription("This profile has been updated") + .newProfileVersion("0.0.2") + .newVersionGroupLabel("testString") + .newLatest(true) + .newCreatedBy("testString") + .newCreatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + .newUpdatedBy("testString") + .newUpdatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + .newControlsCount(Long.valueOf("26")) + .newAttachmentsCount(Long.valueOf("26")) + .accountId("testString") + .build(); + + // Invoke replaceProfile() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.replaceProfile(replaceProfileOptionsModel).execute(); + assertNotNull(response); + Profile responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "PUT"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, replaceProfilePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the replaceProfile operation with and without retries enabled + @Test + public void testReplaceProfileWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testReplaceProfileWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testReplaceProfileWOptions(); + } + + // Test the replaceProfile operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceProfileNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.replaceProfile(null).execute(); + } + + // Test the getProfile operation with a valid options model parameter + @Test + public void testGetProfileWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"instance_id\": \"instanceId\", \"hierarchy_enabled\": true, \"profile_description\": \"profileDescription\", \"profile_type\": \"custom\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"versionGroupLabel\", \"latest\": 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, \"attachments_count\": 16, \"controls\": [{\"control_requirement\": true, \"control_library_id\": \"controlLibraryId\", \"control_id\": \"controlId\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_severity\": \"controlSeverity\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"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\": \"parameterType\"}]}"; + String getProfilePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetProfileOptions model + GetProfileOptions getProfileOptionsModel = new GetProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("testString") + .accountId("testString") + .build(); + + // Invoke getProfile() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getProfile(getProfileOptionsModel).execute(); + assertNotNull(response); + Profile 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, getProfilePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the getProfile operation with and without retries enabled + @Test + public void testGetProfileWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testGetProfileWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testGetProfileWOptions(); + } + + // Test the getProfile operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetProfileNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.getProfile(null).execute(); + } + + // Test the deleteCustomProfile operation with a valid options model parameter + @Test + public void testDeleteCustomProfileWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"profile_name\": \"profileName\", \"instance_id\": \"instanceId\", \"hierarchy_enabled\": true, \"profile_description\": \"profileDescription\", \"profile_type\": \"custom\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"versionGroupLabel\", \"latest\": 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, \"attachments_count\": 16, \"controls\": [{\"control_requirement\": true, \"control_library_id\": \"controlLibraryId\", \"control_id\": \"controlId\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_severity\": \"controlSeverity\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"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\": \"parameterType\"}]}"; + String deleteCustomProfilePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteCustomProfileOptions model + DeleteCustomProfileOptions deleteCustomProfileOptionsModel = new DeleteCustomProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("testString") + .accountId("testString") + .build(); + + // Invoke deleteCustomProfile() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.deleteCustomProfile(deleteCustomProfileOptionsModel).execute(); + assertNotNull(response); + Profile responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "DELETE"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, deleteCustomProfilePath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the deleteCustomProfile operation with and without retries enabled + @Test + public void testDeleteCustomProfileWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testDeleteCustomProfileWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testDeleteCustomProfileWOptions(); + } + + // Test the deleteCustomProfile operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteCustomProfileNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.deleteCustomProfile(null).execute(); + } + + // Test the replaceProfileParameters operation with a valid options model parameter + @Test + public void testReplaceProfileParametersWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"parameterType\"}]}"; + String replaceProfileParametersPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/testString/parameters"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the DefaultParameters model + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("testString") + .parameterDefaultValue("testString") + .parameterDisplayName("testString") + .parameterType("testString") + .build(); + + // Construct an instance of the ReplaceProfileParametersOptions model + ReplaceProfileParametersOptions replaceProfileParametersOptionsModel = new ReplaceProfileParametersOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("testString") + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .id("testString") + .accountId("testString") + .build(); + + // Invoke replaceProfileParameters() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.replaceProfileParameters(replaceProfileParametersOptionsModel).execute(); + assertNotNull(response); + ProfileDefaultParametersResponse responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "PUT"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, replaceProfileParametersPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the replaceProfileParameters operation with and without retries enabled + @Test + public void testReplaceProfileParametersWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testReplaceProfileParametersWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testReplaceProfileParametersWOptions(); + } + + // Test the replaceProfileParameters operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceProfileParametersNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.replaceProfileParameters(null).execute(); + } + + // Test the listProfileParameters operation with a valid options model parameter + @Test + public void testListProfileParametersWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"default_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"parameterType\"}]}"; + String listProfileParametersPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/testString/parameters"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListProfileParametersOptions model + ListProfileParametersOptions listProfileParametersOptionsModel = new ListProfileParametersOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("testString") + .build(); + + // Invoke listProfileParameters() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listProfileParameters(listProfileParametersOptionsModel).execute(); + assertNotNull(response); + ProfileDefaultParametersResponse 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, listProfileParametersPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the listProfileParameters operation with and without retries enabled + @Test + public void testListProfileParametersWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testListProfileParametersWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testListProfileParametersWOptions(); + } + + // Test the listProfileParameters operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListProfileParametersNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listProfileParameters(null).execute(); + } + + // Test the compareProfiles operation with a valid options model parameter + @Test + public void testCompareProfilesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"current_predefined_version\": {\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"custom\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"versionGroupLabel\", \"latest\": 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}, \"latest_predefined_version\": {\"id\": \"id\", \"profile_name\": \"profileName\", \"profile_description\": \"profileDescription\", \"profile_type\": \"custom\", \"profile_version\": \"profileVersion\", \"version_group_label\": \"versionGroupLabel\", \"latest\": 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}, \"controls_changes\": {\"total_added\": 10, \"total_removed\": 12, \"total_updated\": 12, \"added\": [{\"control_requirement\": true, \"control_library_id\": \"controlLibraryId\", \"control_id\": \"controlId\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_severity\": \"controlSeverity\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"removed\": [{\"control_requirement\": true, \"control_library_id\": \"controlLibraryId\", \"control_id\": \"controlId\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_severity\": \"controlSeverity\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}], \"updated\": [{\"current\": {\"control_requirement\": true, \"control_library_id\": \"controlLibraryId\", \"control_id\": \"controlId\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_severity\": \"controlSeverity\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}, \"latest\": {\"control_requirement\": true, \"control_library_id\": \"controlLibraryId\", \"control_id\": \"controlId\", \"control_library_version\": \"controlLibraryVersion\", \"control_name\": \"controlName\", \"control_description\": \"controlDescription\", \"control_severity\": \"controlSeverity\", \"control_category\": \"controlCategory\", \"control_parent\": \"controlParent\", \"control_docs\": {\"control_docs_id\": \"controlDocsId\", \"control_docs_type\": \"controlDocsType\"}, \"control_specifications\": [{\"id\": \"id\", \"responsibility\": \"responsibility\", \"component_id\": \"componentId\", \"component_name\": \"componentName\", \"component_type\": \"componentType\", \"environment\": \"environment\", \"description\": \"description\", \"assessments_count\": 16, \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}]}]}}]}, \"default_parameters_changes\": {\"total_added\": 10, \"total_removed\": 12, \"total_updated\": 12, \"added\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"parameterType\"}], \"removed\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"parameterType\"}], \"updated\": [{\"current\": {\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"parameterType\"}, \"latest\": {\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_default_value\": \"parameterDefaultValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"parameterType\"}}]}}"; + String compareProfilesPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/2f598907-970d-4d52-9071-5cc95912f55e/compare"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the CompareProfilesOptions model + CompareProfilesOptions compareProfilesOptionsModel = new CompareProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("2f598907-970d-4d52-9071-5cc95912f55e") + .accountId("testString") + .build(); + + // Invoke compareProfiles() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.compareProfiles(compareProfilesOptionsModel).execute(); + assertNotNull(response); + ComparePredefinedProfilesResponse 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, compareProfilesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the compareProfiles operation with and without retries enabled + @Test + public void testCompareProfilesWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testCompareProfilesWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testCompareProfilesWOptions(); + } + + // Test the compareProfiles operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCompareProfilesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.compareProfiles(null).execute(); + } + + // Test the listProfileAttachments operation with a valid options model parameter + @Test + public void testListProfileAttachmentsWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"attachments\": [{\"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}], \"description\": \"description\", \"name\": \"name\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}, \"schedule\": \"daily\", \"scope\": [{\"id\": \"id\"}], \"status\": \"enabled\", \"data_selection_range\": {\"start_date\": \"2025-02-28T05:42:58.000Z\", \"end_date\": \"2025-02-28T05:42:58.000Z\"}, \"account_id\": \"accountId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"id\": \"id\", \"instance_id\": \"instanceId\", \"last_scan\": {\"id\": \"id\", \"status\": \"status\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"profile_id\": \"profileId\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\"}]}"; + String listProfileAttachmentsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/9c265b4a-4cdf-47f1-acd3-17b5808f7f3f/attachments"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListProfileAttachmentsOptions model + ListProfileAttachmentsOptions listProfileAttachmentsOptionsModel = new ListProfileAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .accountId("testString") + .build(); + + // Invoke listProfileAttachments() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listProfileAttachments(listProfileAttachmentsOptionsModel).execute(); + assertNotNull(response); + ProfileAttachmentCollection 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, listProfileAttachmentsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("account_id"), "testString"); + } + + // Test the listProfileAttachments operation with and without retries enabled + @Test + public void testListProfileAttachmentsWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testListProfileAttachmentsWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testListProfileAttachmentsWOptions(); + } + + // Test the listProfileAttachments operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListProfileAttachmentsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listProfileAttachments(null).execute(); + } + + // Test the createScope operation with a valid options model parameter + @Test + public void testCreateScopeWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}], \"account_id\": \"accountId\", \"instance_id\": \"instanceId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"attachment_count\": 15}"; + String createScopePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); + + // Construct an instance of the ScopePropertyScopeAny model + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("scope_id") + .value("ff88f007f9ff4622aac4fbc0eda36255") + .build(); + + // Construct an instance of the CreateScopeOptions model + CreateScopeOptions createScopeOptionsModel = new CreateScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .name("ibm scope") + .description("The scope that is defined for IBM resources.") + .environment("ibm-cloud") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) + .build(); + + // Invoke createScope() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createScope(createScopeOptionsModel).execute(); + assertNotNull(response); + Scope responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createScopePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the createScope operation with and without retries enabled + @Test + public void testCreateScopeWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testCreateScopeWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testCreateScopeWOptions(); + } + + // Test the createScope operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateScopeNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.createScope(null).execute(); + } + + // Test the listScopes operation with a valid options model parameter + @Test + public void testListScopesWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"scopes\": [{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}], \"account_id\": \"accountId\", \"instance_id\": \"instanceId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"attachment_count\": 15}]}"; + String listScopesPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListScopesOptions model + ListScopesOptions listScopesOptionsModel = new ListScopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .start("testString") + .name("testString") + .description("testString") + .environment("testString") + .build(); + + // Invoke listScopes() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listScopes(listScopesOptionsModel).execute(); + assertNotNull(response); + ScopeCollection 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, listScopesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("description"), "testString"); + assertEquals(query.get("environment"), "testString"); + } + + // Test the listScopes operation with and without retries enabled + @Test + public void testListScopesWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testListScopesWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testListScopesWOptions(); + } + + // Test the listScopes operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListScopesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listScopes(null).execute(); + } + + // Test the listScopes operation using the ScopesPager.getNext() method + @Test + public void testListScopesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}],\"account_id\":\"accountId\",\"instance_id\":\"instanceId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"attachment_count\":15}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}],\"account_id\":\"accountId\",\"instance_id\":\"instanceId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"attachment_count\":15}]}"; + server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponsePage1)); @@ -890,29 +2230,30 @@ public void testListProfilesWithPagerGetNext() throws Throwable { .setResponseCode(400) .setBody("{\"message\": \"No more results available!\"}")); - ListProfilesOptions listProfilesOptions = new ListProfilesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + ListScopesOptions listScopesOptions = new ListScopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .limit(Long.valueOf("10")) - .profileType("custom") + .name("testString") + .description("testString") + .environment("testString") .build(); - List allResults = new ArrayList<>(); - ProfilesPager pager = new ProfilesPager(securityAndComplianceCenterApiService, listProfilesOptions); + List allResults = new ArrayList<>(); + ScopesPager pager = new ScopesPager(securityAndComplianceCenterApiService, listScopesOptions); while (pager.hasNext()) { - List nextPage = pager.getNext(); + List nextPage = pager.getNext(); assertNotNull(nextPage); allResults.addAll(nextPage); } assertEquals(allResults.size(), 2); } - // Test the listProfiles operation using the ProfilesPager.getAll() method + // Test the listScopes operation using the ScopesPager.getAll() method @Test - public void testListProfilesWithPagerGetAll() throws Throwable { + public void testListScopesWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"profiles\":[{\"id\":\"id\",\"profile_name\":\"profileName\",\"profile_description\":\"profileDescription\",\"profile_type\":\"profileType\",\"profile_version\":\"profileVersion\",\"version_group_label\":\"versionGroupLabel\",\"latest\":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,\"attachments_count\":16}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"profiles\":[{\"id\":\"id\",\"profile_name\":\"profileName\",\"profile_description\":\"profileDescription\",\"profile_type\":\"profileType\",\"profile_version\":\"profileVersion\",\"version_group_label\":\"versionGroupLabel\",\"latest\":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,\"attachments_count\":16}]}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}],\"account_id\":\"accountId\",\"instance_id\":\"instanceId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"attachment_count\":15}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}],\"account_id\":\"accountId\",\"instance_id\":\"instanceId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"attachment_count\":15}]}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -926,391 +2267,604 @@ public void testListProfilesWithPagerGetAll() throws Throwable { .setResponseCode(400) .setBody("{\"message\": \"No more results available!\"}")); - ListProfilesOptions listProfilesOptions = new ListProfilesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + ListScopesOptions listScopesOptions = new ListScopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .limit(Long.valueOf("10")) - .profileType("custom") + .name("testString") + .description("testString") + .environment("testString") .build(); - ProfilesPager pager = new ProfilesPager(securityAndComplianceCenterApiService, listProfilesOptions); - List allResults = pager.getAll(); + ScopesPager pager = new ScopesPager(securityAndComplianceCenterApiService, listScopesOptions); + List allResults = pager.getAll(); assertNotNull(allResults); assertEquals(allResults.size(), 2); } - // Test the createProfile operation with a valid options model parameter + // Test the updateScope operation with a valid options model parameter @Test - public void testCreateProfileWOptions() throws Throwable { + public void testUpdateScopeWOptions() 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\", \"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"; + String mockResponseBody = "{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}], \"account_id\": \"accountId\", \"instance_id\": \"instanceId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"attachment_count\": 15}"; + String updateScopePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(201) + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ProfileControlsPrototype model - ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() - .controlLibraryId("e98a56ff-dc24-41d4-9875-1e188e2da6cd") - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") - .build(); - - // Construct an instance of the DefaultParametersPrototype model - 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(); - - // Construct an instance of the CreateProfileOptions model - CreateProfileOptions createProfileOptionsModel = new CreateProfileOptions.Builder() - .profileName("test_profile1") - .profileDescription("test_description1") - .profileType("custom") - .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) - .defaultParameters(java.util.Arrays.asList(defaultParametersPrototypeModel)) - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the UpdateScopeOptions model + UpdateScopeOptions updateScopeOptionsModel = new UpdateScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .name("updated name of scope") + .description("updated scope description") .build(); - // Invoke createProfile() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.createProfile(createProfileOptionsModel).execute(); + // Invoke updateScope() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.updateScope(updateScopeOptionsModel).execute(); assertNotNull(response); - Profile responseObj = response.getResult(); + Scope responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "PATCH"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createProfilePath); + assertEquals(parsedPath, updateScopePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createProfile operation with and without retries enabled + // Test the updateScope operation with and without retries enabled @Test - public void testCreateProfileWRetries() throws Throwable { + public void testUpdateScopeWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testCreateProfileWOptions(); + testUpdateScopeWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testCreateProfileWOptions(); + testUpdateScopeWOptions(); } - // Test the createProfile operation with a null options model (negative test) + // Test the updateScope operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateProfileNoOptions() throws Throwable { + public void testUpdateScopeNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.createProfile(null).execute(); + securityAndComplianceCenterApiService.updateScope(null).execute(); } - // Test the deleteCustomProfile operation with a valid options model parameter + // Test the getScope operation with a valid options model parameter @Test - public void testDeleteCustomProfileWOptions() throws Throwable { + public void testGetScopeWOptions() 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\", \"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"; + String mockResponseBody = "{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}], \"account_id\": \"accountId\", \"instance_id\": \"instanceId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"attachment_count\": 15}"; + String getScopePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the DeleteCustomProfileOptions model - DeleteCustomProfileOptions deleteCustomProfileOptionsModel = new DeleteCustomProfileOptions.Builder() - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the GetScopeOptions model + GetScopeOptions getScopeOptionsModel = new GetScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") .build(); - // Invoke deleteCustomProfile() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.deleteCustomProfile(deleteCustomProfileOptionsModel).execute(); + // Invoke getScope() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getScope(getScopeOptionsModel).execute(); assertNotNull(response); - Profile responseObj = response.getResult(); + Scope 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, getScopePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getScope operation with and without retries enabled + @Test + public void testGetScopeWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testGetScopeWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testGetScopeWOptions(); + } + + // Test the getScope operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetScopeNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.getScope(null).execute(); + } + + // Test the deleteScope operation with a valid options model parameter + @Test + public void testDeleteScopeWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteScopePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteScopeOptions model + DeleteScopeOptions deleteScopeOptionsModel = new DeleteScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .build(); + + // Invoke deleteScope() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.deleteScope(deleteScopeOptionsModel).execute(); + assertNotNull(response); + Void responseObj = response.getResult(); + assertNull(responseObj); + // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteCustomProfilePath); + assertEquals(parsedPath, deleteScopePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteCustomProfile operation with and without retries enabled + // Test the deleteScope operation with and without retries enabled @Test - public void testDeleteCustomProfileWRetries() throws Throwable { + public void testDeleteScopeWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testDeleteCustomProfileWOptions(); + testDeleteScopeWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testDeleteCustomProfileWOptions(); + testDeleteScopeWOptions(); } - // Test the deleteCustomProfile operation with a null options model (negative test) + // Test the deleteScope operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteCustomProfileNoOptions() throws Throwable { + public void testDeleteScopeNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.deleteCustomProfile(null).execute(); + securityAndComplianceCenterApiService.deleteScope(null).execute(); } - // Test the getProfile operation with a valid options model parameter + // Test the createSubscope operation with a valid options model parameter @Test - public void testGetProfileWOptions() throws Throwable { + public void testCreateSubscopeWOptions() 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\", \"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"; + String mockResponseBody = "{\"subscopes\": [{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}]}]}"; + String createSubscopePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the GetProfileOptions model - GetProfileOptions getProfileOptionsModel = new GetProfileOptions.Builder() - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the ScopePropertyScopeAny model + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("scope_id") + .value("1f689f08ec9b47b885c2659c17029581") .build(); - // Invoke getProfile() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.getProfile(getProfileOptionsModel).execute(); + // Construct an instance of the ScopePrototype model + ScopePrototype scopePrototypeModel = new ScopePrototype.Builder() + .name("ibm subscope update") + .description("The subscope that is defined for IBM resources.") + .environment("ibm-cloud") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) + .build(); + + // Construct an instance of the CreateSubscopeOptions model + CreateSubscopeOptions createSubscopeOptionsModel = new CreateSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopes(java.util.Arrays.asList(scopePrototypeModel)) + .build(); + + // Invoke createSubscope() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createSubscope(createSubscopeOptionsModel).execute(); assertNotNull(response); - Profile responseObj = response.getResult(); + SubScopeResponse 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"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProfilePath); + assertEquals(parsedPath, createSubscopePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getProfile operation with and without retries enabled + // Test the createSubscope operation with and without retries enabled @Test - public void testGetProfileWRetries() throws Throwable { + public void testCreateSubscopeWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testGetProfileWOptions(); + testCreateSubscopeWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testGetProfileWOptions(); + testCreateSubscopeWOptions(); } - // Test the getProfile operation with a null options model (negative test) + // Test the createSubscope operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetProfileNoOptions() throws Throwable { + public void testCreateSubscopeNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.getProfile(null).execute(); + securityAndComplianceCenterApiService.createSubscope(null).execute(); } - // Test the replaceProfile operation with a valid options model parameter + // Test the listSubscopes operation with a valid options model parameter @Test - public void testReplaceProfileWOptions() throws Throwable { + public void testListSubscopesWOptions() 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\", \"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"; + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"subscopes\": [{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}]}]}"; + String listSubscopesPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ProfileControlsPrototype model - ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() - .controlLibraryId("e98a56ff-dc24-41d4-9875-1e188e2da6cd") - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") + // Construct an instance of the ListSubscopesOptions model + ListSubscopesOptions listSubscopesOptionsModel = new ListSubscopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .limit(Long.valueOf("10")) + .start("testString") + .name("testString") + .description("testString") + .environment("testString") + .build(); + + // Invoke listSubscopes() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listSubscopes(listSubscopesOptionsModel).execute(); + assertNotNull(response); + SubScopeCollection 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, listSubscopesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + assertEquals(query.get("name"), "testString"); + assertEquals(query.get("description"), "testString"); + assertEquals(query.get("environment"), "testString"); + } + + // Test the listSubscopes operation with and without retries enabled + @Test + public void testListSubscopesWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testListSubscopesWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testListSubscopesWOptions(); + } + + // Test the listSubscopes operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListSubscopesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listSubscopes(null).execute(); + } + + // Test the listSubscopes operation using the SubscopesPager.getNext() method + @Test + public void testListSubscopesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"subscopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}]}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"subscopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}]}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListSubscopesOptions listSubscopesOptions = new ListSubscopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .limit(Long.valueOf("10")) + .name("testString") + .description("testString") + .environment("testString") .build(); - // Construct an instance of the DefaultParametersPrototype model - 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") + List allResults = new ArrayList<>(); + SubscopesPager pager = new SubscopesPager(securityAndComplianceCenterApiService, listSubscopesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listSubscopes operation using the SubscopesPager.getAll() method + @Test + public void testListSubscopesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"subscopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}]}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"subscopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}]}],\"total_count\":2,\"limit\":1}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListSubscopesOptions listSubscopesOptions = new ListSubscopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .limit(Long.valueOf("10")) + .name("testString") + .description("testString") + .environment("testString") .build(); - // Construct an instance of the ReplaceProfileOptions model - ReplaceProfileOptions replaceProfileOptionsModel = new ReplaceProfileOptions.Builder() - .profileId("testString") - .profileName("test_profile1") - .profileDescription("test_description1") - .profileType("custom") - .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) - .defaultParameters(java.util.Arrays.asList(defaultParametersPrototypeModel)) - .xCorrelationId("testString") - .xRequestId("testString") + SubscopesPager pager = new SubscopesPager(securityAndComplianceCenterApiService, listSubscopesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the getSubscope operation with a valid options model parameter + @Test + public void testGetSubscopeWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}]}"; + String getSubscopePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetSubscopeOptions model + GetSubscopeOptions getSubscopeOptionsModel = new GetSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopeId("testString") .build(); - // Invoke replaceProfile() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.replaceProfile(replaceProfileOptionsModel).execute(); + // Invoke getSubscope() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getSubscope(getSubscopeOptionsModel).execute(); assertNotNull(response); - Profile responseObj = response.getResult(); + SubScope responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, replaceProfilePath); + assertEquals(parsedPath, getSubscopePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the replaceProfile operation with and without retries enabled + // Test the getSubscope operation with and without retries enabled @Test - public void testReplaceProfileWRetries() throws Throwable { + public void testGetSubscopeWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testReplaceProfileWOptions(); + testGetSubscopeWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testReplaceProfileWOptions(); + testGetSubscopeWOptions(); } - // Test the replaceProfile operation with a null options model (negative test) + // Test the getSubscope operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceProfileNoOptions() throws Throwable { + public void testGetSubscopeNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.replaceProfile(null).execute(); + securityAndComplianceCenterApiService.getSubscope(null).execute(); } - // Test the listRules operation with a valid options model parameter + // Test the updateSubscope operation with a valid options model parameter @Test - public void testListRulesWOptions() throws Throwable { + public void testUpdateSubscopeWOptions() 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\", \"or\": [{\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}]}]}, \"labels\": [\"labels\"]}]}"; - String listRulesPath = "/rules"; + String mockResponseBody = "{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}]}"; + String updateSubscopePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListRulesOptions model - ListRulesOptions listRulesOptionsModel = new ListRulesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .type("system_defined") - .search("testString") - .serviceName("testString") + // Construct an instance of the UpdateSubscopeOptions model + UpdateSubscopeOptions updateSubscopeOptionsModel = new UpdateSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopeId("testString") + .name("updated name of scope") + .description("updated scope description") + .build(); + + // Invoke updateSubscope() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.updateSubscope(updateSubscopeOptionsModel).execute(); + assertNotNull(response); + SubScope 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(), "PATCH"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, updateSubscopePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the updateSubscope operation with and without retries enabled + @Test + public void testUpdateSubscopeWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testUpdateSubscopeWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testUpdateSubscopeWOptions(); + } + + // Test the updateSubscope operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSubscopeNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.updateSubscope(null).execute(); + } + + // Test the deleteSubscope operation with a valid options model parameter + @Test + public void testDeleteSubscopeWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = ""; + String deleteSubscopePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes/testString"; + server.enqueue(new MockResponse() + .setResponseCode(204) + .setBody(mockResponseBody)); + + // Construct an instance of the DeleteSubscopeOptions model + DeleteSubscopeOptions deleteSubscopeOptionsModel = new DeleteSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopeId("testString") .build(); - // Invoke listRules() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.listRules(listRulesOptionsModel).execute(); + // Invoke deleteSubscope() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.deleteSubscope(deleteSubscopeOptionsModel).execute(); assertNotNull(response); - RulesPageBase responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listRulesPath); - // Verify query params + assertEquals(parsedPath, deleteSubscopePath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("type"), "system_defined"); - assertEquals(query.get("search"), "testString"); - assertEquals(query.get("service_name"), "testString"); + assertNull(query); } - // Test the listRules operation with and without retries enabled + // Test the deleteSubscope operation with and without retries enabled @Test - public void testListRulesWRetries() throws Throwable { + public void testDeleteSubscopeWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testListRulesWOptions(); + testDeleteSubscopeWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testListRulesWOptions(); + testDeleteSubscopeWOptions(); } - // Test the createRule operation with a valid options model parameter + // Test the deleteSubscope operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteSubscopeNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.deleteSubscope(null).execute(); + } + + // Test the createTarget operation with a valid options model parameter @Test - public void testCreateRuleWOptions() throws Throwable { + public void testCreateTargetWOptions() 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\", \"or\": [{\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}]}]}, \"labels\": [\"labels\"]}"; - String createRulePath = "/rules"; + String mockResponseBody = "{\"id\": \"a2366444-ad87-40b1-81d0-476df1cc1f18\", \"account_id\": \"be200c80cabc456e91139e4152327823\", \"trusted_profile_id\": \"Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3\", \"name\": \"Target Account-A\", \"credentials\": [{\"type\": \"iam_credentials\", \"secret_crn\": \"secretCrn\", \"secret_name\": \"my secret\", \"resources\": [{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"home_account_id\": \"2411ffdc16844b07b42521c3443f456d\", \"id\": \"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\", \"resource_name\": \"jeff's key\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"component_id\": \"cloud-object_storage\", \"component_name\": \"cloud-object_storage\", \"environment\": \"ibm cloud\", \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135, \"service_name\": \"pm-20\", \"instance_crn\": \"instanceCrn\"}]}], \"created_by\": \"IBMid-270007EPPC\", \"created_on\": \"2024-02-07T05:42:58.000Z\", \"updated_by\": \"IBMid-270007EPPC\", \"updated_on\": \"2024-02-07T05:42:58.000Z\"}"; + String createTargetPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the AdditionalTargetAttribute model - AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() - .name("location") - .operator("string_equals") - .value("us-east") - .build(); - - // Construct an instance of the TargetPrototype model - TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() - .serviceName("cloud-object-storage") - .resourceKind("bucket") - .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) - .build(); - - // Construct an instance of the RequiredConfigItemsRequiredConfigBase model - RequiredConfigItemsRequiredConfigBase requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigBase.Builder() - .description("testString") - .property("hard_quota") - .operator("num_equals") - .value("${hard_quota}") + // Construct an instance of the Account model + Account accountModel = new Account.Builder() + .id("531fc3e28bfc43c5a2cea07786d93f5c") + .name("NIST") + .type("account_type") .build(); - // Construct an instance of the RequiredConfigAnd model - RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() - .description("The Cloud Object Storage rule.") - .and(java.util.Arrays.asList(requiredConfigItemsModel)) + // Construct an instance of the Tags model + Tags tagsModel = new Tags.Builder() + .user(java.util.Arrays.asList("testString")) + .access(java.util.Arrays.asList("testString")) + .service(java.util.Arrays.asList("testString")) .build(); - // Construct an instance of the Parameter model - 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") + // Construct an instance of the Resource model + Resource resourceModel = new Resource.Builder() + .reportId("30b434b3-cb08-4845-af10-7a8fc682b6a8") + .homeAccountId("2411ffdc16844b07b42521c3443f456d") + .id("crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::") + .resourceName("jeff's key") + .account(accountModel) + .componentId("cloud-object_storage") + .componentName("cloud-object_storage") + .environment("ibm cloud") + .tags(tagsModel) + .status("compliant") + .totalCount(Long.valueOf("140")) + .passCount(Long.valueOf("123")) + .failureCount(Long.valueOf("12")) + .errorCount(Long.valueOf("5")) + .skippedCount(Long.valueOf("7")) + .completedCount(Long.valueOf("135")) + .serviceName("pm-20") + .instanceCrn("testString") .build(); - // Construct an instance of the Import model - Import importModel = new Import.Builder() - .parameters(java.util.Arrays.asList(parameterModel)) + // Construct an instance of the Credential model + Credential credentialModel = new Credential.Builder() + .secretCrn("testString") + .resources(java.util.Arrays.asList(resourceModel)) .build(); - // Construct an instance of the CreateRuleOptions model - CreateRuleOptions createRuleOptionsModel = new CreateRuleOptions.Builder() - .description("Example rule") - .target(targetPrototypeModel) - .requiredConfig(requiredConfigModel) - .version("1.0.0") - .xImport(importModel) - .labels(java.util.Arrays.asList()) - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the CreateTargetOptions model + CreateTargetOptions createTargetOptionsModel = new CreateTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("62ecf99b240144dea9125666249edfcb") + .trustedProfileId("Profile-cb2c1829-9a8d-4218-b9cd-9f83fc814e54") + .name("Target for IBM account") + .credentials(java.util.Arrays.asList(credentialModel)) .build(); - // Invoke createRule() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.createRule(createRuleOptionsModel).execute(); + // Invoke createTarget() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createTarget(createTargetOptionsModel).execute(); assertNotNull(response); - Rule responseObj = response.getResult(); + Target responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -1319,103 +2873,101 @@ public void testCreateRuleWOptions() throws Throwable { assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createRulePath); + assertEquals(parsedPath, createTargetPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createRule operation with and without retries enabled + // Test the createTarget operation with and without retries enabled @Test - public void testCreateRuleWRetries() throws Throwable { + public void testCreateTargetWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testCreateRuleWOptions(); + testCreateTargetWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testCreateRuleWOptions(); + testCreateTargetWOptions(); } - // Test the createRule operation with a null options model (negative test) + // Test the createTarget operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateRuleNoOptions() throws Throwable { + public void testCreateTargetNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.createRule(null).execute(); + securityAndComplianceCenterApiService.createTarget(null).execute(); } - // Test the deleteRule operation with a valid options model parameter + // Test the listTargets operation with a valid options model parameter @Test - public void testDeleteRuleWOptions() throws Throwable { + public void testListTargetsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = ""; - String deleteRulePath = "/rules/testString"; + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"targets\": [{\"id\": \"a2366444-ad87-40b1-81d0-476df1cc1f18\", \"account_id\": \"be200c80cabc456e91139e4152327823\", \"trusted_profile_id\": \"Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3\", \"name\": \"Target Account-A\", \"credentials\": [{\"type\": \"iam_credentials\", \"secret_crn\": \"secretCrn\", \"secret_name\": \"my secret\", \"resources\": [{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"home_account_id\": \"2411ffdc16844b07b42521c3443f456d\", \"id\": \"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\", \"resource_name\": \"jeff's key\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"component_id\": \"cloud-object_storage\", \"component_name\": \"cloud-object_storage\", \"environment\": \"ibm cloud\", \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135, \"service_name\": \"pm-20\", \"instance_crn\": \"instanceCrn\"}]}], \"created_by\": \"IBMid-270007EPPC\", \"created_on\": \"2024-02-07T05:42:58.000Z\", \"updated_by\": \"IBMid-270007EPPC\", \"updated_on\": \"2024-02-07T05:42:58.000Z\"}]}"; + String listTargetsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets"; server.enqueue(new MockResponse() - .setResponseCode(204) + .setHeader("Content-type", "application/json") + .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the DeleteRuleOptions model - DeleteRuleOptions deleteRuleOptionsModel = new DeleteRuleOptions.Builder() - .ruleId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the ListTargetsOptions model + ListTargetsOptions listTargetsOptionsModel = new ListTargetsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .build(); - // Invoke deleteRule() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.deleteRule(deleteRuleOptionsModel).execute(); + // Invoke listTargets() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listTargets(listTargetsOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + TargetCollection responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteRulePath); + assertEquals(parsedPath, listTargetsPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteRule operation with and without retries enabled + // Test the listTargets operation with and without retries enabled @Test - public void testDeleteRuleWRetries() throws Throwable { + public void testListTargetsWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testDeleteRuleWOptions(); + testListTargetsWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testDeleteRuleWOptions(); + testListTargetsWOptions(); } - // Test the deleteRule operation with a null options model (negative test) + // Test the listTargets operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteRuleNoOptions() throws Throwable { + public void testListTargetsNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.deleteRule(null).execute(); + securityAndComplianceCenterApiService.listTargets(null).execute(); } - // Test the getRule operation with a valid options model parameter + // Test the getTarget operation with a valid options model parameter @Test - public void testGetRuleWOptions() throws Throwable { + public void testGetTargetWOptions() 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\", \"or\": [{\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}]}]}, \"labels\": [\"labels\"]}"; - String getRulePath = "/rules/testString"; + String mockResponseBody = "{\"id\": \"a2366444-ad87-40b1-81d0-476df1cc1f18\", \"account_id\": \"be200c80cabc456e91139e4152327823\", \"trusted_profile_id\": \"Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3\", \"name\": \"Target Account-A\", \"credentials\": [{\"type\": \"iam_credentials\", \"secret_crn\": \"secretCrn\", \"secret_name\": \"my secret\", \"resources\": [{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"home_account_id\": \"2411ffdc16844b07b42521c3443f456d\", \"id\": \"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\", \"resource_name\": \"jeff's key\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"component_id\": \"cloud-object_storage\", \"component_name\": \"cloud-object_storage\", \"environment\": \"ibm cloud\", \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135, \"service_name\": \"pm-20\", \"instance_crn\": \"instanceCrn\"}]}], \"created_by\": \"IBMid-270007EPPC\", \"created_on\": \"2024-02-07T05:42:58.000Z\", \"updated_by\": \"IBMid-270007EPPC\", \"updated_on\": \"2024-02-07T05:42:58.000Z\"}"; + String getTargetPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetRuleOptions model - GetRuleOptions getRuleOptionsModel = new GetRuleOptions.Builder() - .ruleId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the GetTargetOptions model + GetTargetOptions getTargetOptionsModel = new GetTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId("testString") .build(); - // Invoke getRule() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.getRule(getRuleOptionsModel).execute(); + // Invoke getTarget() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getTarget(getTargetOptionsModel).execute(); assertNotNull(response); - Rule responseObj = response.getResult(); + Target responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -1424,99 +2976,96 @@ public void testGetRuleWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getRulePath); + assertEquals(parsedPath, getTargetPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getRule operation with and without retries enabled + // Test the getTarget operation with and without retries enabled @Test - public void testGetRuleWRetries() throws Throwable { + public void testGetTargetWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testGetRuleWOptions(); + testGetTargetWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testGetRuleWOptions(); + testGetTargetWOptions(); } - // Test the getRule operation with a null options model (negative test) + // Test the getTarget operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetRuleNoOptions() throws Throwable { + public void testGetTargetNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.getRule(null).execute(); + securityAndComplianceCenterApiService.getTarget(null).execute(); } - // Test the replaceRule operation with a valid options model parameter + // Test the replaceTarget operation with a valid options model parameter @Test - public void testReplaceRuleWOptions() throws Throwable { + public void testReplaceTargetWOptions() 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\", \"or\": [{\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}]}]}, \"labels\": [\"labels\"]}"; - String replaceRulePath = "/rules/testString"; + String mockResponseBody = "{\"id\": \"a2366444-ad87-40b1-81d0-476df1cc1f18\", \"account_id\": \"be200c80cabc456e91139e4152327823\", \"trusted_profile_id\": \"Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3\", \"name\": \"Target Account-A\", \"credentials\": [{\"type\": \"iam_credentials\", \"secret_crn\": \"secretCrn\", \"secret_name\": \"my secret\", \"resources\": [{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"home_account_id\": \"2411ffdc16844b07b42521c3443f456d\", \"id\": \"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\", \"resource_name\": \"jeff's key\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"component_id\": \"cloud-object_storage\", \"component_name\": \"cloud-object_storage\", \"environment\": \"ibm cloud\", \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135, \"service_name\": \"pm-20\", \"instance_crn\": \"instanceCrn\"}]}], \"created_by\": \"IBMid-270007EPPC\", \"created_on\": \"2024-02-07T05:42:58.000Z\", \"updated_by\": \"IBMid-270007EPPC\", \"updated_on\": \"2024-02-07T05:42:58.000Z\"}"; + String replaceTargetPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the AdditionalTargetAttribute model - AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() - .name("location") - .operator("string_equals") - .value("us-south") - .build(); - - // Construct an instance of the TargetPrototype model - TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() - .serviceName("cloud-object-storage") - .resourceKind("bucket") - .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) - .build(); - - // Construct an instance of the RequiredConfigItemsRequiredConfigBase model - RequiredConfigItemsRequiredConfigBase requiredConfigItemsModel = new RequiredConfigItemsRequiredConfigBase.Builder() - .description("testString") - .property("hard_quota") - .operator("num_equals") - .value("${hard_quota}") + // Construct an instance of the Account model + Account accountModel = new Account.Builder() + .id("531fc3e28bfc43c5a2cea07786d93f5c") + .name("NIST") + .type("account_type") .build(); - // Construct an instance of the RequiredConfigAnd model - RequiredConfigAnd requiredConfigModel = new RequiredConfigAnd.Builder() - .description("The Cloud Object Storage rule.") - .and(java.util.Arrays.asList(requiredConfigItemsModel)) + // Construct an instance of the Tags model + Tags tagsModel = new Tags.Builder() + .user(java.util.Arrays.asList("testString")) + .access(java.util.Arrays.asList("testString")) + .service(java.util.Arrays.asList("testString")) .build(); - // Construct an instance of the Parameter model - 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") + // Construct an instance of the Resource model + Resource resourceModel = new Resource.Builder() + .reportId("30b434b3-cb08-4845-af10-7a8fc682b6a8") + .homeAccountId("2411ffdc16844b07b42521c3443f456d") + .id("crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::") + .resourceName("jeff's key") + .account(accountModel) + .componentId("cloud-object_storage") + .componentName("cloud-object_storage") + .environment("ibm cloud") + .tags(tagsModel) + .status("compliant") + .totalCount(Long.valueOf("140")) + .passCount(Long.valueOf("123")) + .failureCount(Long.valueOf("12")) + .errorCount(Long.valueOf("5")) + .skippedCount(Long.valueOf("7")) + .completedCount(Long.valueOf("135")) + .serviceName("pm-20") + .instanceCrn("testString") .build(); - // Construct an instance of the Import model - Import importModel = new Import.Builder() - .parameters(java.util.Arrays.asList(parameterModel)) + // Construct an instance of the Credential model + Credential credentialModel = new Credential.Builder() + .secretCrn("dummy") + .resources(java.util.Arrays.asList(resourceModel)) .build(); - // Construct an instance of the ReplaceRuleOptions model - ReplaceRuleOptions replaceRuleOptionsModel = new ReplaceRuleOptions.Builder() - .ruleId("testString") - .ifMatch("testString") - .description("Example rule") - .target(targetPrototypeModel) - .requiredConfig(requiredConfigModel) - .version("1.0.1") - .xImport(importModel) - .labels(java.util.Arrays.asList()) - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the ReplaceTargetOptions model + ReplaceTargetOptions replaceTargetOptionsModel = new ReplaceTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId("testString") + .accountId("be200c80cabc456e91139e4152327823") + .trustedProfileId("Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3") + .name("Sample Target Name") + .credentials(java.util.Arrays.asList(credentialModel)) .build(); - // Invoke replaceRule() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.replaceRule(replaceRuleOptionsModel).execute(); + // Invoke replaceTarget() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.replaceTarget(replaceTargetOptionsModel).execute(); assertNotNull(response); - Rule responseObj = response.getResult(); + Target responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -1525,226 +3074,103 @@ public void testReplaceRuleWOptions() throws Throwable { assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, replaceRulePath); - // Verify header parameters - assertEquals(request.getHeader("If-Match"), "testString"); + assertEquals(parsedPath, replaceTargetPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the replaceRule operation with and without retries enabled + // Test the replaceTarget operation with and without retries enabled @Test - public void testReplaceRuleWRetries() throws Throwable { + public void testReplaceTargetWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testReplaceRuleWOptions(); + testReplaceTargetWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testReplaceRuleWOptions(); + testReplaceTargetWOptions(); } - // Test the replaceRule operation with a null options model (negative test) + // Test the replaceTarget operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceRuleNoOptions() throws Throwable { + public void testReplaceTargetNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.replaceRule(null).execute(); + securityAndComplianceCenterApiService.replaceTarget(null).execute(); } - // Test the listAttachments operation with a valid options model parameter + // Test the deleteTarget operation with a valid options model parameter @Test - public void testListAttachmentsWOptions() throws Throwable { + public void testDeleteTargetWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"total_count\": 1, \"limit\": 20, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"attachments\": [{\"id\": \"130003ea8bfa43c5aacea07a86da3000\", \"profile_id\": \"7ec45986-54fc-4b66-a303-d9577b078c65\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"instance_id\": \"edf9524f-406c-412c-acbb-ee371a5cabda\", \"scope\": [{\"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"status\": \"enabled\", \"schedule\": \"daily\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 14, \"failed_control_ids\": [\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}}, \"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_value\": \"parameterValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}], \"last_scan\": {\"id\": \"e8a39d25-0051-4328-8462-988ad321f49a\", \"status\": \"in_progress\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"name\": \"account-130003ea8bfa43c5aacea07a86da3000\", \"description\": \"Test description\"}]}"; - String listAttachmentsPath = "/profiles/testString/attachments"; + String mockResponseBody = ""; + String deleteTargetPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the ListAttachmentsOptions model - ListAttachmentsOptions listAttachmentsOptionsModel = new ListAttachmentsOptions.Builder() - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) - .start("testString") + // Construct an instance of the DeleteTargetOptions model + DeleteTargetOptions deleteTargetOptionsModel = new DeleteTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId("testString") .build(); - // Invoke listAttachments() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.listAttachments(listAttachmentsOptionsModel).execute(); + // Invoke deleteTarget() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.deleteTarget(deleteTargetOptionsModel).execute(); assertNotNull(response); - AttachmentCollection responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listAttachmentsPath); - // Verify query params + assertEquals(parsedPath, deleteTargetPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); + assertNull(query); } - // Test the listAttachments operation with and without retries enabled + // Test the deleteTarget operation with and without retries enabled @Test - public void testListAttachmentsWRetries() throws Throwable { + public void testDeleteTargetWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testListAttachmentsWOptions(); + testDeleteTargetWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testListAttachmentsWOptions(); + testDeleteTargetWOptions(); } - // Test the listAttachments operation with a null options model (negative test) + // Test the deleteTarget operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testListAttachmentsNoOptions() throws Throwable { + public void testDeleteTargetNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.listAttachments(null).execute(); - } - - // Test the listAttachments operation using the AttachmentsPager.getNext() method - @Test - public void testListAttachmentsWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"attachments\":[{\"id\":\"130003ea8bfa43c5aacea07a86da3000\",\"profile_id\":\"7ec45986-54fc-4b66-a303-d9577b078c65\",\"account_id\":\"130003ea8bfa43c5aacea07a86da3000\",\"instance_id\":\"edf9524f-406c-412c-acbb-ee371a5cabda\",\"scope\":[{\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"status\":\"enabled\",\"schedule\":\"daily\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":14,\"failed_control_ids\":[\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}},\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"parameterName\",\"parameter_value\":\"parameterValue\",\"parameter_display_name\":\"parameterDisplayName\",\"parameter_type\":\"string\"}],\"last_scan\":{\"id\":\"e8a39d25-0051-4328-8462-988ad321f49a\",\"status\":\"in_progress\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"name\":\"account-130003ea8bfa43c5aacea07a86da3000\",\"description\":\"Test description\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"attachments\":[{\"id\":\"130003ea8bfa43c5aacea07a86da3000\",\"profile_id\":\"7ec45986-54fc-4b66-a303-d9577b078c65\",\"account_id\":\"130003ea8bfa43c5aacea07a86da3000\",\"instance_id\":\"edf9524f-406c-412c-acbb-ee371a5cabda\",\"scope\":[{\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"status\":\"enabled\",\"schedule\":\"daily\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":14,\"failed_control_ids\":[\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}},\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"parameterName\",\"parameter_value\":\"parameterValue\",\"parameter_display_name\":\"parameterDisplayName\",\"parameter_type\":\"string\"}],\"last_scan\":{\"id\":\"e8a39d25-0051-4328-8462-988ad321f49a\",\"status\":\"in_progress\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"name\":\"account-130003ea8bfa43c5aacea07a86da3000\",\"description\":\"Test description\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListAttachmentsOptions listAttachmentsOptions = new ListAttachmentsOptions.Builder() - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) - .build(); - - List allResults = new ArrayList<>(); - AttachmentsPager pager = new AttachmentsPager(securityAndComplianceCenterApiService, listAttachmentsOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); - } - - // Test the listAttachments operation using the AttachmentsPager.getAll() method - @Test - public void testListAttachmentsWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"attachments\":[{\"id\":\"130003ea8bfa43c5aacea07a86da3000\",\"profile_id\":\"7ec45986-54fc-4b66-a303-d9577b078c65\",\"account_id\":\"130003ea8bfa43c5aacea07a86da3000\",\"instance_id\":\"edf9524f-406c-412c-acbb-ee371a5cabda\",\"scope\":[{\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"status\":\"enabled\",\"schedule\":\"daily\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":14,\"failed_control_ids\":[\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}},\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"parameterName\",\"parameter_value\":\"parameterValue\",\"parameter_display_name\":\"parameterDisplayName\",\"parameter_type\":\"string\"}],\"last_scan\":{\"id\":\"e8a39d25-0051-4328-8462-988ad321f49a\",\"status\":\"in_progress\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"name\":\"account-130003ea8bfa43c5aacea07a86da3000\",\"description\":\"Test description\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"attachments\":[{\"id\":\"130003ea8bfa43c5aacea07a86da3000\",\"profile_id\":\"7ec45986-54fc-4b66-a303-d9577b078c65\",\"account_id\":\"130003ea8bfa43c5aacea07a86da3000\",\"instance_id\":\"edf9524f-406c-412c-acbb-ee371a5cabda\",\"scope\":[{\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"status\":\"enabled\",\"schedule\":\"daily\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":14,\"failed_control_ids\":[\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}},\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"parameterName\",\"parameter_value\":\"parameterValue\",\"parameter_display_name\":\"parameterDisplayName\",\"parameter_type\":\"string\"}],\"last_scan\":{\"id\":\"e8a39d25-0051-4328-8462-988ad321f49a\",\"status\":\"in_progress\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"name\":\"account-130003ea8bfa43c5aacea07a86da3000\",\"description\":\"Test description\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); - - ListAttachmentsOptions listAttachmentsOptions = new ListAttachmentsOptions.Builder() - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) - .build(); - - AttachmentsPager pager = new AttachmentsPager(securityAndComplianceCenterApiService, listAttachmentsOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); + securityAndComplianceCenterApiService.deleteTarget(null).execute(); } - - // Test the createAttachment operation with a valid options model parameter - @Test - public void testCreateAttachmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"profile_id\": \"profileId\", \"attachments\": [{\"id\": \"130003ea8bfa43c5aacea07a86da3000\", \"name\": \"account-130003ea8bfa43c5aacea07a86da3000\", \"description\": \"Test description\", \"scope\": [{\"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"status\": \"enabled\", \"schedule\": \"daily\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 14, \"failed_control_ids\": [\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}}, \"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_value\": \"parameterValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}]}]}"; - String createAttachmentPath = "/profiles/testString/attachments"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - // Construct an instance of the PropertyItem model - PropertyItem propertyItemModel = new PropertyItem.Builder() - .name("scope_id") - .value("cg3335893hh1428692d6747cf300yeb5") - .build(); - - // Construct an instance of the MultiCloudScope model - MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() - .environment("ibm-cloud") - .xProperties(java.util.Arrays.asList(propertyItemModel)) - .build(); - - // Construct an instance of the FailedControls model - FailedControls failedControlsModel = new FailedControls.Builder() - .thresholdLimit(Long.valueOf("15")) - .failedControlIds(java.util.Arrays.asList()) - .build(); - - // Construct an instance of the AttachmentsNotificationsPrototype model - AttachmentsNotificationsPrototype attachmentsNotificationsPrototypeModel = new AttachmentsNotificationsPrototype.Builder() - .enabled(false) - .controls(failedControlsModel) - .build(); - - // Construct an instance of the AttachmentParameterPrototype model - 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(); - - // Construct an instance of the AttachmentsPrototype model - AttachmentsPrototype attachmentsPrototypeModel = new AttachmentsPrototype.Builder() - .id("130003ea8bfa43c5aacea07a86da3000") - .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(); + // Test the createProviderTypeInstance operation with a valid options model parameter + @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 createProviderTypeInstancePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/3e25966275dccfa2c3a34786919c5af7/provider_type_instances"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(201) + .setBody(mockResponseBody)); - // Construct an instance of the CreateAttachmentOptions model - CreateAttachmentOptions createAttachmentOptionsModel = new CreateAttachmentOptions.Builder() - .profileId("testString") - .attachments(java.util.Arrays.asList(attachmentsPrototypeModel)) - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the CreateProviderTypeInstanceOptions model + CreateProviderTypeInstanceOptions createProviderTypeInstanceOptionsModel = new CreateProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .name("workload-protection-instance-1") + .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) .build(); - // Invoke createAttachment() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.createAttachment(createAttachmentOptionsModel).execute(); + // Invoke createProviderTypeInstance() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createProviderTypeInstance(createProviderTypeInstanceOptionsModel).execute(); assertNotNull(response); - AttachmentPrototype responseObj = response.getResult(); + ProviderTypeInstance responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -1753,106 +3179,103 @@ public void testCreateAttachmentWOptions() throws Throwable { assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createAttachmentPath); + assertEquals(parsedPath, createProviderTypeInstancePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createAttachment operation with and without retries enabled + // Test the createProviderTypeInstance operation with and without retries enabled @Test - public void testCreateAttachmentWRetries() throws Throwable { + public void testCreateProviderTypeInstanceWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testCreateAttachmentWOptions(); + testCreateProviderTypeInstanceWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testCreateAttachmentWOptions(); + testCreateProviderTypeInstanceWOptions(); } - // Test the createAttachment operation with a null options model (negative test) + // Test the createProviderTypeInstance operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateAttachmentNoOptions() throws Throwable { + public void testCreateProviderTypeInstanceNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.createAttachment(null).execute(); + securityAndComplianceCenterApiService.createProviderTypeInstance(null).execute(); } - // Test the deleteProfileAttachment operation with a valid options model parameter + // Test the listProviderTypeInstances operation with a valid options model parameter @Test - public void testDeleteProfileAttachmentWOptions() throws Throwable { + public void testListProviderTypeInstancesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"130003ea8bfa43c5aacea07a86da3000\", \"profile_id\": \"7ec45986-54fc-4b66-a303-d9577b078c65\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"instance_id\": \"edf9524f-406c-412c-acbb-ee371a5cabda\", \"scope\": [{\"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"status\": \"enabled\", \"schedule\": \"daily\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 14, \"failed_control_ids\": [\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}}, \"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_value\": \"parameterValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}], \"last_scan\": {\"id\": \"e8a39d25-0051-4328-8462-988ad321f49a\", \"status\": \"in_progress\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"name\": \"account-130003ea8bfa43c5aacea07a86da3000\", \"description\": \"Test description\"}"; - String deleteProfileAttachmentPath = "/profiles/testString/attachments/testString"; + 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 listProviderTypeInstancesPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/3e25966275dccfa2c3a34786919c5af7/provider_type_instances"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the DeleteProfileAttachmentOptions model - DeleteProfileAttachmentOptions deleteProfileAttachmentOptionsModel = new DeleteProfileAttachmentOptions.Builder() - .attachmentId("testString") - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the ListProviderTypeInstancesOptions model + ListProviderTypeInstancesOptions listProviderTypeInstancesOptionsModel = new ListProviderTypeInstancesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .build(); - // Invoke deleteProfileAttachment() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.deleteProfileAttachment(deleteProfileAttachmentOptionsModel).execute(); + // Invoke listProviderTypeInstances() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listProviderTypeInstances(listProviderTypeInstancesOptionsModel).execute(); assertNotNull(response); - AttachmentItem responseObj = response.getResult(); + ProviderTypeInstanceCollection responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteProfileAttachmentPath); + assertEquals(parsedPath, listProviderTypeInstancesPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteProfileAttachment operation with and without retries enabled + // Test the listProviderTypeInstances operation with and without retries enabled @Test - public void testDeleteProfileAttachmentWRetries() throws Throwable { + public void testListProviderTypeInstancesWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testDeleteProfileAttachmentWOptions(); + testListProviderTypeInstancesWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testDeleteProfileAttachmentWOptions(); + testListProviderTypeInstancesWOptions(); } - // Test the deleteProfileAttachment operation with a null options model (negative test) + // Test the listProviderTypeInstances operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteProfileAttachmentNoOptions() throws Throwable { + public void testListProviderTypeInstancesNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.deleteProfileAttachment(null).execute(); + securityAndComplianceCenterApiService.listProviderTypeInstances(null).execute(); } - // Test the getProfileAttachment operation with a valid options model parameter + // Test the getProviderTypeInstance operation with a valid options model parameter @Test - public void testGetProfileAttachmentWOptions() throws Throwable { + public void testGetProviderTypeInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"130003ea8bfa43c5aacea07a86da3000\", \"profile_id\": \"7ec45986-54fc-4b66-a303-d9577b078c65\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"instance_id\": \"edf9524f-406c-412c-acbb-ee371a5cabda\", \"scope\": [{\"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"status\": \"enabled\", \"schedule\": \"daily\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 14, \"failed_control_ids\": [\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}}, \"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_value\": \"parameterValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}], \"last_scan\": {\"id\": \"e8a39d25-0051-4328-8462-988ad321f49a\", \"status\": \"in_progress\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"name\": \"account-130003ea8bfa43c5aacea07a86da3000\", \"description\": \"Test description\"}"; - String getProfileAttachmentPath = "/profiles/testString/attachments/testString"; + 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 getProviderTypeInstancePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/3e25966275dccfa2c3a34786919c5af7/provider_type_instances/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetProfileAttachmentOptions model - GetProfileAttachmentOptions getProfileAttachmentOptionsModel = new GetProfileAttachmentOptions.Builder() - .attachmentId("testString") - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the GetProviderTypeInstanceOptions model + GetProviderTypeInstanceOptions getProviderTypeInstanceOptionsModel = new GetProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .providerTypeInstanceId("testString") .build(); - // Invoke getProfileAttachment() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.getProfileAttachment(getProfileAttachmentOptionsModel).execute(); + // Invoke getProviderTypeInstance() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getProviderTypeInstance(getProviderTypeInstanceOptionsModel).execute(); assertNotNull(response); - AttachmentItem responseObj = response.getResult(); + ProviderTypeInstance responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -1861,217 +3284,156 @@ public void testGetProfileAttachmentWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProfileAttachmentPath); + assertEquals(parsedPath, getProviderTypeInstancePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getProfileAttachment operation with and without retries enabled + // Test the getProviderTypeInstance operation with and without retries enabled @Test - public void testGetProfileAttachmentWRetries() throws Throwable { + public void testGetProviderTypeInstanceWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testGetProfileAttachmentWOptions(); + testGetProviderTypeInstanceWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testGetProfileAttachmentWOptions(); + testGetProviderTypeInstanceWOptions(); } - // Test the getProfileAttachment operation with a null options model (negative test) + // Test the getProviderTypeInstance operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetProfileAttachmentNoOptions() throws Throwable { + public void testGetProviderTypeInstanceNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.getProfileAttachment(null).execute(); + securityAndComplianceCenterApiService.getProviderTypeInstance(null).execute(); } - // Test the replaceProfileAttachment operation with a valid options model parameter + // Test the updateProviderTypeInstance operation with a valid options model parameter @Test - public void testReplaceProfileAttachmentWOptions() throws Throwable { + public void testUpdateProviderTypeInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"130003ea8bfa43c5aacea07a86da3000\", \"profile_id\": \"7ec45986-54fc-4b66-a303-d9577b078c65\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"instance_id\": \"edf9524f-406c-412c-acbb-ee371a5cabda\", \"scope\": [{\"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"status\": \"enabled\", \"schedule\": \"daily\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 14, \"failed_control_ids\": [\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}}, \"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_value\": \"parameterValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}], \"last_scan\": {\"id\": \"e8a39d25-0051-4328-8462-988ad321f49a\", \"status\": \"in_progress\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"name\": \"account-130003ea8bfa43c5aacea07a86da3000\", \"description\": \"Test description\"}"; - String replaceProfileAttachmentPath = "/profiles/testString/attachments/testString"; + 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 updateProviderTypeInstancePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/3e25966275dccfa2c3a34786919c5af7/provider_type_instances/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the PropertyItem model - PropertyItem propertyItemModel = new PropertyItem.Builder() - .name("scope_id") - .value("cg3335893hh1428692d6747cf300yeb5") - .build(); - - // Construct an instance of the MultiCloudScope model - MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() - .environment("ibm-cloud") - .xProperties(java.util.Arrays.asList(propertyItemModel)) - .build(); - - // Construct an instance of the FailedControls model - FailedControls failedControlsModel = new FailedControls.Builder() - .thresholdLimit(Long.valueOf("15")) - .failedControlIds(java.util.Arrays.asList()) - .build(); - - // Construct an instance of the AttachmentsNotificationsPrototype model - AttachmentsNotificationsPrototype attachmentsNotificationsPrototypeModel = new AttachmentsNotificationsPrototype.Builder() - .enabled(false) - .controls(failedControlsModel) - .build(); - - // Construct an instance of the AttachmentParameterPrototype model - 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(); - - // Construct an instance of the LastScan model - LastScan lastScanModel = new LastScan.Builder() - .id("e8a39d25-0051-4328-8462-988ad321f49a") - .status("in_progress") - .time(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .build(); - - // Construct an instance of the ReplaceProfileAttachmentOptions model - ReplaceProfileAttachmentOptions replaceProfileAttachmentOptionsModel = new ReplaceProfileAttachmentOptions.Builder() - .attachmentId("testString") - .profileId("testString") - .id("testString") - .profileId("testString") - .accountId("testString") - .instanceId("testString") - .scope(java.util.Arrays.asList(multiCloudScopeModel)) - .createdOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .createdBy("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .updatedBy("testString") - .status("enabled") - .schedule("every_30_days") - .notifications(attachmentsNotificationsPrototypeModel) - .attachmentParameters(java.util.Arrays.asList(attachmentParameterPrototypeModel)) - .lastScan(lastScanModel) - .nextScanTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .name("account-0d8c3805dfea40aa8ad02265a18eb12b") - .description("Test description") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the UpdateProviderTypeInstanceOptions model + UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptionsModel = new UpdateProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .providerTypeInstanceId("testString") + .name("workload-protection-instance-1") + .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) .build(); - // Invoke replaceProfileAttachment() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.replaceProfileAttachment(replaceProfileAttachmentOptionsModel).execute(); + // Invoke updateProviderTypeInstance() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.updateProviderTypeInstance(updateProviderTypeInstanceOptionsModel).execute(); assertNotNull(response); - AttachmentItem responseObj = response.getResult(); + ProviderTypeInstance responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); + assertEquals(request.getMethod(), "PATCH"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, replaceProfileAttachmentPath); + assertEquals(parsedPath, updateProviderTypeInstancePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the replaceProfileAttachment operation with and without retries enabled + // Test the updateProviderTypeInstance operation with and without retries enabled @Test - public void testReplaceProfileAttachmentWRetries() throws Throwable { + public void testUpdateProviderTypeInstanceWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testReplaceProfileAttachmentWOptions(); + testUpdateProviderTypeInstanceWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testReplaceProfileAttachmentWOptions(); + testUpdateProviderTypeInstanceWOptions(); } - // Test the replaceProfileAttachment operation with a null options model (negative test) + // Test the updateProviderTypeInstance operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testReplaceProfileAttachmentNoOptions() throws Throwable { + public void testUpdateProviderTypeInstanceNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.replaceProfileAttachment(null).execute(); + securityAndComplianceCenterApiService.updateProviderTypeInstance(null).execute(); } - // Test the createScan operation with a valid options model parameter + // Test the deleteProviderTypeInstance operation with a valid options model parameter @Test - public void testCreateScanWOptions() throws Throwable { + public void testDeleteProviderTypeInstanceWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"id\", \"account_id\": \"accountId\", \"attachment_id\": \"attachmentId\", \"report_id\": \"reportId\", \"status\": \"completed\", \"last_scan_time\": \"lastScanTime\", \"next_scan_time\": \"nextScanTime\", \"scan_type\": \"ondemand\", \"occurence\": 9}"; - String createScanPath = "/scans"; + String mockResponseBody = ""; + String deleteProviderTypeInstancePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/3e25966275dccfa2c3a34786919c5af7/provider_type_instances/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the CreateScanOptions model - CreateScanOptions createScanOptionsModel = new CreateScanOptions.Builder() - .attachmentId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the DeleteProviderTypeInstanceOptions model + DeleteProviderTypeInstanceOptions deleteProviderTypeInstanceOptionsModel = new DeleteProviderTypeInstanceOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") + .providerTypeInstanceId("testString") .build(); - // Invoke createScan() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.createScan(createScanOptionsModel).execute(); + // Invoke deleteProviderTypeInstance() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.deleteProviderTypeInstance(deleteProviderTypeInstanceOptionsModel).execute(); assertNotNull(response); - Scan responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "POST"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createScanPath); + assertEquals(parsedPath, deleteProviderTypeInstancePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the createScan operation with and without retries enabled + // Test the deleteProviderTypeInstance operation with and without retries enabled @Test - public void testCreateScanWRetries() throws Throwable { + public void testDeleteProviderTypeInstanceWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testCreateScanWOptions(); + testDeleteProviderTypeInstanceWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testCreateScanWOptions(); + testDeleteProviderTypeInstanceWOptions(); } - // Test the createScan operation with a null options model (negative test) + // Test the deleteProviderTypeInstance operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateScanNoOptions() throws Throwable { + public void testDeleteProviderTypeInstanceNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.createScan(null).execute(); + securityAndComplianceCenterApiService.deleteProviderTypeInstance(null).execute(); } - // Test the listAttachmentsAccount operation with a valid options model parameter + // Test the listProviderTypes operation with a valid options model parameter @Test - public void testListAttachmentsAccountWOptions() throws Throwable { + public void testListProviderTypesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"total_count\": 1, \"limit\": 20, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"attachments\": [{\"id\": \"130003ea8bfa43c5aacea07a86da3000\", \"profile_id\": \"7ec45986-54fc-4b66-a303-d9577b078c65\", \"account_id\": \"130003ea8bfa43c5aacea07a86da3000\", \"instance_id\": \"edf9524f-406c-412c-acbb-ee371a5cabda\", \"scope\": [{\"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"value\"}]}], \"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"status\": \"enabled\", \"schedule\": \"daily\", \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 14, \"failed_control_ids\": [\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}}, \"attachment_parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"parameterName\", \"parameter_value\": \"parameterValue\", \"parameter_display_name\": \"parameterDisplayName\", \"parameter_type\": \"string\"}], \"last_scan\": {\"id\": \"e8a39d25-0051-4328-8462-988ad321f49a\", \"status\": \"in_progress\", \"time\": \"2019-01-01T12:00:00.000Z\"}, \"next_scan_time\": \"2019-01-01T12:00:00.000Z\", \"name\": \"account-130003ea8bfa43c5aacea07a86da3000\", \"description\": \"Test description\"}]}"; - String listAttachmentsAccountPath = "/attachments"; + 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 = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListAttachmentsAccountOptions model - ListAttachmentsAccountOptions listAttachmentsAccountOptionsModel = new ListAttachmentsAccountOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) - .start("testString") + // Construct an instance of the ListProviderTypesOptions model + ListProviderTypesOptions listProviderTypesOptionsModel = new ListProviderTypesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .build(); - // Invoke listAttachmentsAccount() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.listAttachmentsAccount(listAttachmentsAccountOptionsModel).execute(); + // Invoke listProviderTypes() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listProviderTypes(listProviderTypesOptionsModel).execute(); assertNotNull(response); - AttachmentCollection responseObj = response.getResult(); + ProviderTypeCollection responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -2080,96 +3442,87 @@ public void testListAttachmentsAccountWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listAttachmentsAccountPath); - // Verify query params + assertEquals(parsedPath, listProviderTypesPath); + // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); - assertEquals(query.get("start"), "testString"); + assertNull(query); } - // Test the listAttachmentsAccount operation with and without retries enabled + // Test the listProviderTypes operation with and without retries enabled @Test - public void testListAttachmentsAccountWRetries() throws Throwable { + public void testListProviderTypesWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testListAttachmentsAccountWOptions(); + testListProviderTypesWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testListAttachmentsAccountWOptions(); + testListProviderTypesWOptions(); } - // Test the listAttachmentsAccount operation using the AttachmentsAccountPager.getNext() method + // Test the listProviderTypes operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListProviderTypesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listProviderTypes(null).execute(); + } + + // Test the getProviderTypeById operation with a valid options model parameter @Test - public void testListAttachmentsAccountWithPagerGetNext() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"attachments\":[{\"id\":\"130003ea8bfa43c5aacea07a86da3000\",\"profile_id\":\"7ec45986-54fc-4b66-a303-d9577b078c65\",\"account_id\":\"130003ea8bfa43c5aacea07a86da3000\",\"instance_id\":\"edf9524f-406c-412c-acbb-ee371a5cabda\",\"scope\":[{\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"status\":\"enabled\",\"schedule\":\"daily\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":14,\"failed_control_ids\":[\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}},\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"parameterName\",\"parameter_value\":\"parameterValue\",\"parameter_display_name\":\"parameterDisplayName\",\"parameter_type\":\"string\"}],\"last_scan\":{\"id\":\"e8a39d25-0051-4328-8462-988ad321f49a\",\"status\":\"in_progress\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"name\":\"account-130003ea8bfa43c5aacea07a86da3000\",\"description\":\"Test description\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"attachments\":[{\"id\":\"130003ea8bfa43c5aacea07a86da3000\",\"profile_id\":\"7ec45986-54fc-4b66-a303-d9577b078c65\",\"account_id\":\"130003ea8bfa43c5aacea07a86da3000\",\"instance_id\":\"edf9524f-406c-412c-acbb-ee371a5cabda\",\"scope\":[{\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"status\":\"enabled\",\"schedule\":\"daily\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":14,\"failed_control_ids\":[\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}},\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"parameterName\",\"parameter_value\":\"parameterValue\",\"parameter_display_name\":\"parameterDisplayName\",\"parameter_type\":\"string\"}],\"last_scan\":{\"id\":\"e8a39d25-0051-4328-8462-988ad321f49a\",\"status\":\"in_progress\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"name\":\"account-130003ea8bfa43c5aacea07a86da3000\",\"description\":\"Test description\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); + 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 = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/3e25966275dccfa2c3a34786919c5af7"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); + .setBody(mockResponseBody)); - ListAttachmentsAccountOptions listAttachmentsAccountOptions = new ListAttachmentsAccountOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) + // Construct an instance of the GetProviderTypeByIdOptions model + GetProviderTypeByIdOptions getProviderTypeByIdOptionsModel = new GetProviderTypeByIdOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .build(); - List allResults = new ArrayList<>(); - AttachmentsAccountPager pager = new AttachmentsAccountPager(securityAndComplianceCenterApiService, listAttachmentsAccountOptions); - while (pager.hasNext()) { - List nextPage = pager.getNext(); - assertNotNull(nextPage); - allResults.addAll(nextPage); - } - assertEquals(allResults.size(), 2); + // Invoke getProviderTypeById() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getProviderTypeById(getProviderTypeByIdOptionsModel).execute(); + assertNotNull(response); + ProviderType 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 listAttachmentsAccount operation using the AttachmentsAccountPager.getAll() method + + // Test the getProviderTypeById operation with and without retries enabled @Test - public void testListAttachmentsAccountWithPagerGetAll() throws Throwable { - // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"attachments\":[{\"id\":\"130003ea8bfa43c5aacea07a86da3000\",\"profile_id\":\"7ec45986-54fc-4b66-a303-d9577b078c65\",\"account_id\":\"130003ea8bfa43c5aacea07a86da3000\",\"instance_id\":\"edf9524f-406c-412c-acbb-ee371a5cabda\",\"scope\":[{\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"status\":\"enabled\",\"schedule\":\"daily\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":14,\"failed_control_ids\":[\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}},\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"parameterName\",\"parameter_value\":\"parameterValue\",\"parameter_display_name\":\"parameterDisplayName\",\"parameter_type\":\"string\"}],\"last_scan\":{\"id\":\"e8a39d25-0051-4328-8462-988ad321f49a\",\"status\":\"in_progress\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"name\":\"account-130003ea8bfa43c5aacea07a86da3000\",\"description\":\"Test description\"}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"attachments\":[{\"id\":\"130003ea8bfa43c5aacea07a86da3000\",\"profile_id\":\"7ec45986-54fc-4b66-a303-d9577b078c65\",\"account_id\":\"130003ea8bfa43c5aacea07a86da3000\",\"instance_id\":\"edf9524f-406c-412c-acbb-ee371a5cabda\",\"scope\":[{\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"value\"}]}],\"created_on\":\"2019-01-01T12:00:00.000Z\",\"created_by\":\"createdBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"status\":\"enabled\",\"schedule\":\"daily\",\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":14,\"failed_control_ids\":[\"5C453578-E9A1-421E-AD0F-C6AFCDD67CCF\"]}},\"attachment_parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"parameterName\",\"parameter_value\":\"parameterValue\",\"parameter_display_name\":\"parameterDisplayName\",\"parameter_type\":\"string\"}],\"last_scan\":{\"id\":\"e8a39d25-0051-4328-8462-988ad321f49a\",\"status\":\"in_progress\",\"time\":\"2019-01-01T12:00:00.000Z\"},\"next_scan_time\":\"2019-01-01T12:00:00.000Z\",\"name\":\"account-130003ea8bfa43c5aacea07a86da3000\",\"description\":\"Test description\"}],\"total_count\":2,\"limit\":1}"; - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage1)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponsePage2)); - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(400) - .setBody("{\"message\": \"No more results available!\"}")); + public void testGetProviderTypeByIdWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testGetProviderTypeByIdWOptions(); - ListAttachmentsAccountOptions listAttachmentsAccountOptions = new ListAttachmentsAccountOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .limit(Long.valueOf("10")) - .build(); + securityAndComplianceCenterApiService.disableRetries(); + testGetProviderTypeByIdWOptions(); + } - AttachmentsAccountPager pager = new AttachmentsAccountPager(securityAndComplianceCenterApiService, listAttachmentsAccountOptions); - List allResults = pager.getAll(); - assertNotNull(allResults); - assertEquals(allResults.size(), 2); + // 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 getLatestReports operation with a valid options model parameter @Test public void testGetLatestReportsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"home_account_id\": \"homeAccountId\", \"controls_summary\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10}, \"evaluations_summary\": {\"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"completed_count\": 135}, \"score\": {\"passed\": 1, \"total_count\": 4, \"percent\": 25}, \"reports\": [{\"id\": \"44a5-a292-32114fa73558\", \"group_id\": \"55b6-b3A4-432250b84669\", \"created_on\": \"2022-08-15T12:30:01Z\", \"scan_time\": \"2022-08-15T12:30:01Z\", \"type\": \"scheduled\", \"cos_object\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\", \"instance_id\": \"84644a08-31b6-4988-b504-49a46ca69ccd\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"profile\": {\"id\": \"44a5-a292-32114fa73558\", \"name\": \"IBM FS Cloud\", \"version\": \"0.1\"}, \"attachment\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"resource group - Default\", \"description\": \"Scoped to the Default resource group\", \"schedule\": \"daily\", \"scope\": [{\"id\": \"ca0941aa-b7e2-43a3-9794-1b3d322474d9\", \"environment\": \"ibm-cloud\", \"properties\": [{\"name\": \"scope_id\", \"value\": \"18d32a4430e54c81a6668952609763b2\"}]}]}}]}"; - String getLatestReportsPath = "/reports/latest"; + String mockResponseBody = "{\"home_account_id\": \"homeAccountId\", \"controls_summary\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"not_applicable_count\": 7}, \"evaluations_summary\": {\"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135}, \"score\": {\"passed\": 1, \"total_count\": 4, \"percent\": 25}, \"reports\": [{\"id\": \"44a5-a292-32114fa73558\", \"type\": \"scheduled\", \"group_id\": \"55b6-b3A4-432250b84669\", \"created_on\": \"2022-08-15T12:30:01Z\", \"scan_time\": \"2022-08-15T12:30:01Z\", \"cos_object\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\", \"instance_id\": \"instanceId\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"profile\": {\"id\": \"44a5-a292-32114fa73558\", \"name\": \"IBM FS Cloud\", \"version\": \"0.1\"}, \"scope\": {\"id\": \"2411ffdc16844b07b42521c3443f456d\", \"type\": \"account\"}, \"attachment\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"resource group - Default\", \"description\": \"Scoped to the Default resource group\", \"schedule\": \"daily\", \"scope\": \"anyValue\", \"scopes\": [{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}], \"account_id\": \"accountId\", \"instance_id\": \"instanceId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"attachment_count\": 15}], \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}}, \"controls_summary\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"not_applicable_count\": 7, \"not_compliant_controls\": [{\"id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"control_name\": \"ibm-cloud-rule\", \"control_description\": \"Ensure security questions are registered by the account owner\"}]}, \"evaluations_summary\": {\"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135}, \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"scopes\": [{\"id\": \"id\", \"name\": \"name\", \"href\": \"href\", \"environment\": \"environment\"}], \"additional_details\": {\"created_by\": \"Security and Compliance Center\", \"labels\": [\"labels\"], \"links\": [{\"description\": \"description\", \"href\": \"href\"}]}}]}"; + String getLatestReportsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/latest"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2177,8 +3530,7 @@ public void testGetLatestReportsWOptions() throws Throwable { // Construct an instance of the GetLatestReportsOptions model GetLatestReportsOptions getLatestReportsOptionsModel = new GetLatestReportsOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .sort("profile_name") .build(); @@ -2211,12 +3563,19 @@ public void testGetLatestReportsWRetries() throws Throwable { testGetLatestReportsWOptions(); } + // Test the getLatestReports operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetLatestReportsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.getLatestReports(null).execute(); + } + // Test the listReports operation with a valid options model parameter @Test public void testListReportsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"total_count\": 230, \"limit\": 50, \"start\": \"start\", \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\"}, \"home_account_id\": \"homeAccountId\", \"reports\": [{\"id\": \"44a5-a292-32114fa73558\", \"group_id\": \"55b6-b3A4-432250b84669\", \"created_on\": \"2022-08-15T12:30:01Z\", \"scan_time\": \"2022-08-15T12:30:01Z\", \"type\": \"scheduled\", \"cos_object\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\", \"instance_id\": \"84644a08-31b6-4988-b504-49a46ca69ccd\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"profile\": {\"id\": \"44a5-a292-32114fa73558\", \"name\": \"IBM FS Cloud\", \"version\": \"0.1\"}, \"attachment\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"resource group - Default\", \"description\": \"Scoped to the Default resource group\", \"schedule\": \"daily\", \"scope\": [{\"id\": \"ca0941aa-b7e2-43a3-9794-1b3d322474d9\", \"environment\": \"ibm-cloud\", \"properties\": [{\"name\": \"scope_id\", \"value\": \"18d32a4430e54c81a6668952609763b2\"}]}]}}]}"; - String listReportsPath = "/reports"; + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"home_account_id\": \"homeAccountId\", \"reports\": [{\"id\": \"44a5-a292-32114fa73558\", \"type\": \"scheduled\", \"group_id\": \"55b6-b3A4-432250b84669\", \"created_on\": \"2022-08-15T12:30:01Z\", \"scan_time\": \"2022-08-15T12:30:01Z\", \"cos_object\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\", \"instance_id\": \"instanceId\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"profile\": {\"id\": \"44a5-a292-32114fa73558\", \"name\": \"IBM FS Cloud\", \"version\": \"0.1\"}, \"scope\": {\"id\": \"2411ffdc16844b07b42521c3443f456d\", \"type\": \"account\"}, \"attachment\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"resource group - Default\", \"description\": \"Scoped to the Default resource group\", \"schedule\": \"daily\", \"scope\": \"anyValue\", \"scopes\": [{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}], \"account_id\": \"accountId\", \"instance_id\": \"instanceId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"attachment_count\": 15}], \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}}, \"controls_summary\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"not_applicable_count\": 7, \"not_compliant_controls\": [{\"id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"control_name\": \"ibm-cloud-rule\", \"control_description\": \"Ensure security questions are registered by the account owner\"}]}, \"evaluations_summary\": {\"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135}, \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"scopes\": [{\"id\": \"id\", \"name\": \"name\", \"href\": \"href\", \"environment\": \"environment\"}], \"additional_details\": {\"created_by\": \"Security and Compliance Center\", \"labels\": [\"labels\"], \"links\": [{\"description\": \"description\", \"href\": \"href\"}]}}]}"; + String listReportsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2224,11 +3583,10 @@ public void testListReportsWOptions() throws Throwable { // Construct an instance of the ListReportsOptions model ListReportsOptions listReportsOptionsModel = new ListReportsOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .attachmentId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportAttachmentId("testString") .groupId("testString") - .profileId("testString") + .reportProfileId("testString") .type("scheduled") .start("testString") .limit(Long.valueOf("10")) @@ -2236,9 +3594,9 @@ public void testListReportsWOptions() throws Throwable { .build(); // Invoke listReports() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.listReports(listReportsOptionsModel).execute(); + Response response = securityAndComplianceCenterApiService.listReports(listReportsOptionsModel).execute(); assertNotNull(response); - ReportPage responseObj = response.getResult(); + ReportCollection responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -2251,9 +3609,9 @@ public void testListReportsWOptions() throws Throwable { // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); - assertEquals(query.get("attachment_id"), "testString"); + assertEquals(query.get("report_attachment_id"), "testString"); assertEquals(query.get("group_id"), "testString"); - assertEquals(query.get("profile_id"), "testString"); + assertEquals(query.get("report_profile_id"), "testString"); assertEquals(query.get("type"), "scheduled"); assertEquals(query.get("start"), "testString"); assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); @@ -2270,12 +3628,19 @@ public void testListReportsWRetries() throws Throwable { testListReportsWOptions(); } + // Test the listReports operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListReportsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listReports(null).execute(); + } + // Test the listReports operation using the ReportsPager.getNext() method @Test public void testListReportsWithPagerGetNext() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"href\":\"https://myhost.com/somePath?start=1\"},\"reports\":[{\"id\":\"44a5-a292-32114fa73558\",\"group_id\":\"55b6-b3A4-432250b84669\",\"created_on\":\"2022-08-15T12:30:01Z\",\"scan_time\":\"2022-08-15T12:30:01Z\",\"type\":\"scheduled\",\"cos_object\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\",\"instance_id\":\"84644a08-31b6-4988-b504-49a46ca69ccd\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"profile\":{\"id\":\"44a5-a292-32114fa73558\",\"name\":\"IBM FS Cloud\",\"version\":\"0.1\"},\"attachment\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"resource group - Default\",\"description\":\"Scoped to the Default resource group\",\"schedule\":\"daily\",\"scope\":[{\"id\":\"ca0941aa-b7e2-43a3-9794-1b3d322474d9\",\"environment\":\"ibm-cloud\",\"properties\":[{\"name\":\"scope_id\",\"value\":\"18d32a4430e54c81a6668952609763b2\"}]}]}}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"reports\":[{\"id\":\"44a5-a292-32114fa73558\",\"group_id\":\"55b6-b3A4-432250b84669\",\"created_on\":\"2022-08-15T12:30:01Z\",\"scan_time\":\"2022-08-15T12:30:01Z\",\"type\":\"scheduled\",\"cos_object\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\",\"instance_id\":\"84644a08-31b6-4988-b504-49a46ca69ccd\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"profile\":{\"id\":\"44a5-a292-32114fa73558\",\"name\":\"IBM FS Cloud\",\"version\":\"0.1\"},\"attachment\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"resource group - Default\",\"description\":\"Scoped to the Default resource group\",\"schedule\":\"daily\",\"scope\":[{\"id\":\"ca0941aa-b7e2-43a3-9794-1b3d322474d9\",\"environment\":\"ibm-cloud\",\"properties\":[{\"name\":\"scope_id\",\"value\":\"18d32a4430e54c81a6668952609763b2\"}]}]}}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"reports\":[{\"id\":\"44a5-a292-32114fa73558\",\"type\":\"scheduled\",\"group_id\":\"55b6-b3A4-432250b84669\",\"created_on\":\"2022-08-15T12:30:01Z\",\"scan_time\":\"2022-08-15T12:30:01Z\",\"cos_object\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\",\"instance_id\":\"instanceId\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"profile\":{\"id\":\"44a5-a292-32114fa73558\",\"name\":\"IBM FS Cloud\",\"version\":\"0.1\"},\"scope\":{\"id\":\"2411ffdc16844b07b42521c3443f456d\",\"type\":\"account\"},\"attachment\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"resource group - Default\",\"description\":\"Scoped to the Default resource group\",\"schedule\":\"daily\",\"scope\":\"anyValue\",\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}],\"account_id\":\"accountId\",\"instance_id\":\"instanceId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"attachment_count\":15}],\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":15,\"failed_control_ids\":[\"failedControlIds\"]}}},\"controls_summary\":{\"status\":\"compliant\",\"total_count\":150,\"compliant_count\":130,\"not_compliant_count\":5,\"unable_to_perform_count\":5,\"user_evaluation_required_count\":10,\"not_applicable_count\":7,\"not_compliant_controls\":[{\"id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"control_name\":\"ibm-cloud-rule\",\"control_description\":\"Ensure security questions are registered by the account owner\"}]},\"evaluations_summary\":{\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"skipped_count\":7,\"completed_count\":135},\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]},\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"href\":\"href\",\"environment\":\"environment\"}],\"additional_details\":{\"created_by\":\"Security and Compliance Center\",\"labels\":[\"labels\"],\"links\":[{\"description\":\"description\",\"href\":\"href\"}]}}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"reports\":[{\"id\":\"44a5-a292-32114fa73558\",\"type\":\"scheduled\",\"group_id\":\"55b6-b3A4-432250b84669\",\"created_on\":\"2022-08-15T12:30:01Z\",\"scan_time\":\"2022-08-15T12:30:01Z\",\"cos_object\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\",\"instance_id\":\"instanceId\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"profile\":{\"id\":\"44a5-a292-32114fa73558\",\"name\":\"IBM FS Cloud\",\"version\":\"0.1\"},\"scope\":{\"id\":\"2411ffdc16844b07b42521c3443f456d\",\"type\":\"account\"},\"attachment\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"resource group - Default\",\"description\":\"Scoped to the Default resource group\",\"schedule\":\"daily\",\"scope\":\"anyValue\",\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}],\"account_id\":\"accountId\",\"instance_id\":\"instanceId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"attachment_count\":15}],\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":15,\"failed_control_ids\":[\"failedControlIds\"]}}},\"controls_summary\":{\"status\":\"compliant\",\"total_count\":150,\"compliant_count\":130,\"not_compliant_count\":5,\"unable_to_perform_count\":5,\"user_evaluation_required_count\":10,\"not_applicable_count\":7,\"not_compliant_controls\":[{\"id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"control_name\":\"ibm-cloud-rule\",\"control_description\":\"Ensure security questions are registered by the account owner\"}]},\"evaluations_summary\":{\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"skipped_count\":7,\"completed_count\":135},\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]},\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"href\":\"href\",\"environment\":\"environment\"}],\"additional_details\":{\"created_by\":\"Security and Compliance Center\",\"labels\":[\"labels\"],\"links\":[{\"description\":\"description\",\"href\":\"href\"}]}}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2290,11 +3655,10 @@ public void testListReportsWithPagerGetNext() throws Throwable { .setBody("{\"message\": \"No more results available!\"}")); ListReportsOptions listReportsOptions = new ListReportsOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .attachmentId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportAttachmentId("testString") .groupId("testString") - .profileId("testString") + .reportProfileId("testString") .type("scheduled") .limit(Long.valueOf("10")) .sort("profile_name") @@ -2314,8 +3678,8 @@ public void testListReportsWithPagerGetNext() throws Throwable { @Test public void testListReportsWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"href\":\"https://myhost.com/somePath?start=1\"},\"reports\":[{\"id\":\"44a5-a292-32114fa73558\",\"group_id\":\"55b6-b3A4-432250b84669\",\"created_on\":\"2022-08-15T12:30:01Z\",\"scan_time\":\"2022-08-15T12:30:01Z\",\"type\":\"scheduled\",\"cos_object\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\",\"instance_id\":\"84644a08-31b6-4988-b504-49a46ca69ccd\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"profile\":{\"id\":\"44a5-a292-32114fa73558\",\"name\":\"IBM FS Cloud\",\"version\":\"0.1\"},\"attachment\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"resource group - Default\",\"description\":\"Scoped to the Default resource group\",\"schedule\":\"daily\",\"scope\":[{\"id\":\"ca0941aa-b7e2-43a3-9794-1b3d322474d9\",\"environment\":\"ibm-cloud\",\"properties\":[{\"name\":\"scope_id\",\"value\":\"18d32a4430e54c81a6668952609763b2\"}]}]}}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"reports\":[{\"id\":\"44a5-a292-32114fa73558\",\"group_id\":\"55b6-b3A4-432250b84669\",\"created_on\":\"2022-08-15T12:30:01Z\",\"scan_time\":\"2022-08-15T12:30:01Z\",\"type\":\"scheduled\",\"cos_object\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\",\"instance_id\":\"84644a08-31b6-4988-b504-49a46ca69ccd\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"profile\":{\"id\":\"44a5-a292-32114fa73558\",\"name\":\"IBM FS Cloud\",\"version\":\"0.1\"},\"attachment\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"resource group - Default\",\"description\":\"Scoped to the Default resource group\",\"schedule\":\"daily\",\"scope\":[{\"id\":\"ca0941aa-b7e2-43a3-9794-1b3d322474d9\",\"environment\":\"ibm-cloud\",\"properties\":[{\"name\":\"scope_id\",\"value\":\"18d32a4430e54c81a6668952609763b2\"}]}]}}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"reports\":[{\"id\":\"44a5-a292-32114fa73558\",\"type\":\"scheduled\",\"group_id\":\"55b6-b3A4-432250b84669\",\"created_on\":\"2022-08-15T12:30:01Z\",\"scan_time\":\"2022-08-15T12:30:01Z\",\"cos_object\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\",\"instance_id\":\"instanceId\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"profile\":{\"id\":\"44a5-a292-32114fa73558\",\"name\":\"IBM FS Cloud\",\"version\":\"0.1\"},\"scope\":{\"id\":\"2411ffdc16844b07b42521c3443f456d\",\"type\":\"account\"},\"attachment\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"resource group - Default\",\"description\":\"Scoped to the Default resource group\",\"schedule\":\"daily\",\"scope\":\"anyValue\",\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}],\"account_id\":\"accountId\",\"instance_id\":\"instanceId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"attachment_count\":15}],\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":15,\"failed_control_ids\":[\"failedControlIds\"]}}},\"controls_summary\":{\"status\":\"compliant\",\"total_count\":150,\"compliant_count\":130,\"not_compliant_count\":5,\"unable_to_perform_count\":5,\"user_evaluation_required_count\":10,\"not_applicable_count\":7,\"not_compliant_controls\":[{\"id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"control_name\":\"ibm-cloud-rule\",\"control_description\":\"Ensure security questions are registered by the account owner\"}]},\"evaluations_summary\":{\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"skipped_count\":7,\"completed_count\":135},\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]},\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"href\":\"href\",\"environment\":\"environment\"}],\"additional_details\":{\"created_by\":\"Security and Compliance Center\",\"labels\":[\"labels\"],\"links\":[{\"description\":\"description\",\"href\":\"href\"}]}}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"reports\":[{\"id\":\"44a5-a292-32114fa73558\",\"type\":\"scheduled\",\"group_id\":\"55b6-b3A4-432250b84669\",\"created_on\":\"2022-08-15T12:30:01Z\",\"scan_time\":\"2022-08-15T12:30:01Z\",\"cos_object\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\",\"instance_id\":\"instanceId\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"profile\":{\"id\":\"44a5-a292-32114fa73558\",\"name\":\"IBM FS Cloud\",\"version\":\"0.1\"},\"scope\":{\"id\":\"2411ffdc16844b07b42521c3443f456d\",\"type\":\"account\"},\"attachment\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"resource group - Default\",\"description\":\"Scoped to the Default resource group\",\"schedule\":\"daily\",\"scope\":\"anyValue\",\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"description\":\"description\",\"environment\":\"environment\",\"properties\":[{\"name\":\"name\",\"value\":\"anyValue\"}],\"account_id\":\"accountId\",\"instance_id\":\"instanceId\",\"created_by\":\"createdBy\",\"created_on\":\"2019-01-01T12:00:00.000Z\",\"updated_by\":\"updatedBy\",\"updated_on\":\"2019-01-01T12:00:00.000Z\",\"attachment_count\":15}],\"notifications\":{\"enabled\":false,\"controls\":{\"threshold_limit\":15,\"failed_control_ids\":[\"failedControlIds\"]}}},\"controls_summary\":{\"status\":\"compliant\",\"total_count\":150,\"compliant_count\":130,\"not_compliant_count\":5,\"unable_to_perform_count\":5,\"user_evaluation_required_count\":10,\"not_applicable_count\":7,\"not_compliant_controls\":[{\"id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"control_name\":\"ibm-cloud-rule\",\"control_description\":\"Ensure security questions are registered by the account owner\"}]},\"evaluations_summary\":{\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"skipped_count\":7,\"completed_count\":135},\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]},\"scopes\":[{\"id\":\"id\",\"name\":\"name\",\"href\":\"href\",\"environment\":\"environment\"}],\"additional_details\":{\"created_by\":\"Security and Compliance Center\",\"labels\":[\"labels\"],\"links\":[{\"description\":\"description\",\"href\":\"href\"}]}}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2330,11 +3694,10 @@ public void testListReportsWithPagerGetAll() throws Throwable { .setBody("{\"message\": \"No more results available!\"}")); ListReportsOptions listReportsOptions = new ListReportsOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .attachmentId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportAttachmentId("testString") .groupId("testString") - .profileId("testString") + .reportProfileId("testString") .type("scheduled") .limit(Long.valueOf("10")) .sort("profile_name") @@ -2350,8 +3713,8 @@ public void testListReportsWithPagerGetAll() throws Throwable { @Test public void testGetReportWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"44a5-a292-32114fa73558\", \"group_id\": \"55b6-b3A4-432250b84669\", \"created_on\": \"2022-08-15T12:30:01Z\", \"scan_time\": \"2022-08-15T12:30:01Z\", \"type\": \"scheduled\", \"cos_object\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\", \"instance_id\": \"84644a08-31b6-4988-b504-49a46ca69ccd\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"profile\": {\"id\": \"44a5-a292-32114fa73558\", \"name\": \"IBM FS Cloud\", \"version\": \"0.1\"}, \"attachment\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"resource group - Default\", \"description\": \"Scoped to the Default resource group\", \"schedule\": \"daily\", \"scope\": [{\"id\": \"ca0941aa-b7e2-43a3-9794-1b3d322474d9\", \"environment\": \"ibm-cloud\", \"properties\": [{\"name\": \"scope_id\", \"value\": \"18d32a4430e54c81a6668952609763b2\"}]}]}}"; - String getReportPath = "/reports/testString"; + String mockResponseBody = "{\"id\": \"44a5-a292-32114fa73558\", \"type\": \"scheduled\", \"group_id\": \"55b6-b3A4-432250b84669\", \"created_on\": \"2022-08-15T12:30:01Z\", \"scan_time\": \"2022-08-15T12:30:01Z\", \"cos_object\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7\", \"instance_id\": \"instanceId\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"profile\": {\"id\": \"44a5-a292-32114fa73558\", \"name\": \"IBM FS Cloud\", \"version\": \"0.1\"}, \"scope\": {\"id\": \"2411ffdc16844b07b42521c3443f456d\", \"type\": \"account\"}, \"attachment\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"resource group - Default\", \"description\": \"Scoped to the Default resource group\", \"schedule\": \"daily\", \"scope\": \"anyValue\", \"scopes\": [{\"id\": \"id\", \"name\": \"name\", \"description\": \"description\", \"environment\": \"environment\", \"properties\": [{\"name\": \"name\", \"value\": \"anyValue\"}], \"account_id\": \"accountId\", \"instance_id\": \"instanceId\", \"created_by\": \"createdBy\", \"created_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"attachment_count\": 15}], \"notifications\": {\"enabled\": false, \"controls\": {\"threshold_limit\": 15, \"failed_control_ids\": [\"failedControlIds\"]}}}, \"controls_summary\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"not_applicable_count\": 7, \"not_compliant_controls\": [{\"id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"control_name\": \"ibm-cloud-rule\", \"control_description\": \"Ensure security questions are registered by the account owner\"}]}, \"evaluations_summary\": {\"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135}, \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"scopes\": [{\"id\": \"id\", \"name\": \"name\", \"href\": \"href\", \"environment\": \"environment\"}], \"additional_details\": {\"created_by\": \"Security and Compliance Center\", \"labels\": [\"labels\"], \"links\": [{\"description\": \"description\", \"href\": \"href\"}]}}"; + String getReportPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2360,8 +3723,9 @@ public void testGetReportWOptions() throws Throwable { // Construct an instance of the GetReportOptions model GetReportOptions getReportOptionsModel = new GetReportOptions.Builder() .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopeId("testString") .build(); // Invoke getReport() with a valid options model and verify the result @@ -2377,9 +3741,11 @@ public void testGetReportWOptions() throws Throwable { // Verify request path String parsedPath = TestUtilities.parseReqPath(request); assertEquals(parsedPath, getReportPath); - // Verify that there is no query string + // Verify query params Map query = TestUtilities.parseQueryString(request); - assertNull(query); + assertNotNull(query); + assertEquals(query.get("scope_id"), "testString"); + assertEquals(query.get("subscope_id"), "testString"); } // Test the getReport operation with and without retries enabled @@ -2403,8 +3769,8 @@ public void testGetReportNoOptions() throws Throwable { @Test public void testGetReportSummaryWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"isntance_id\": \"84644a08-31b6-4988-b504-49a46ca69ccd\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"score\": {\"passed\": 1, \"total_count\": 4, \"percent\": 25}, \"controls\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10}, \"evaluations\": {\"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"completed_count\": 135}, \"resources\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"top_failed\": [{\"name\": \"my-bucket\", \"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"service\": \"cloud-object-storage\", \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"account\": \"59bcbfa6ea2f006b4ed7094c1a08dcdd\", \"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"completed_count\": 135}]}}"; - String getReportSummaryPath = "/reports/testString/summary"; + String mockResponseBody = "{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"instance_id\": \"84644a08-31b6-4988-b504-49a46ca69ccd\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"score\": {\"passed\": 1, \"total_count\": 4, \"percent\": 25}, \"evaluations\": {\"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135}, \"controls\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"not_applicable_count\": 7}, \"resources\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"not_applicable_count\": 7, \"top_failed\": [{\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"my-bucket\", \"account\": \"59bcbfa6ea2f006b4ed7094c1a08dcdd\", \"service\": \"cloud-object-storage\", \"service_display_name\": \"cloud-object-storage\", \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135}]}}"; + String getReportSummaryPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/summary"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2412,9 +3778,8 @@ public void testGetReportSummaryWOptions() throws Throwable { // Construct an instance of the GetReportSummaryOptions model GetReportSummaryOptions getReportSummaryOptionsModel = new GetReportSummaryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .build(); // Invoke getReportSummary() with a valid options model and verify the result @@ -2452,31 +3817,31 @@ public void testGetReportSummaryNoOptions() throws Throwable { securityAndComplianceCenterApiService.getReportSummary(null).execute(); } - // Test the getReportEvaluation operation with a valid options model parameter + // Test the getReportDownloadFile operation with a valid options model parameter @Test - public void testGetReportEvaluationWOptions() throws Throwable { + public void testGetReportDownloadFileWOptions() throws Throwable { // Register a mock response String mockResponseBody = "This is a mock binary response."; - String getReportEvaluationPath = "/reports/testString/download"; + String getReportDownloadFilePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/download"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/csv") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetReportEvaluationOptions model - GetReportEvaluationOptions getReportEvaluationOptionsModel = new GetReportEvaluationOptions.Builder() + // Construct an instance of the GetReportDownloadFileOptions model + GetReportDownloadFileOptions getReportDownloadFileOptionsModel = new GetReportDownloadFileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .accept("application/csv") .excludeSummary(true) .build(); - // Invoke getReportEvaluation() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.getReportEvaluation(getReportEvaluationOptionsModel).execute(); + // Invoke getReportDownloadFile() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getReportDownloadFile(getReportDownloadFileOptionsModel).execute(); assertNotNull(response); - InputStream responseObj = response.getResult(); - assertNotNull(responseObj); - responseObj.close(); + try (InputStream responseObj = response.getResult();) { + assertNotNull(responseObj); + } // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); @@ -2484,36 +3849,36 @@ public void testGetReportEvaluationWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getReportEvaluationPath); + assertEquals(parsedPath, getReportDownloadFilePath); // Verify query params Map query = TestUtilities.parseQueryString(request); assertNotNull(query); assertEquals(Boolean.valueOf(query.get("exclude_summary")), Boolean.valueOf(true)); } - // Test the getReportEvaluation operation with and without retries enabled + // Test the getReportDownloadFile operation with and without retries enabled @Test - public void testGetReportEvaluationWRetries() throws Throwable { + public void testGetReportDownloadFileWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testGetReportEvaluationWOptions(); + testGetReportDownloadFileWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testGetReportEvaluationWOptions(); + testGetReportDownloadFileWOptions(); } - // Test the getReportEvaluation operation with a null options model (negative test) + // Test the getReportDownloadFile operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetReportEvaluationNoOptions() throws Throwable { + public void testGetReportDownloadFileNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.getReportEvaluation(null).execute(); + securityAndComplianceCenterApiService.getReportDownloadFile(null).execute(); } // Test the getReportControls operation with a valid options model parameter @Test public void testGetReportControlsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"home_account_id\": \"homeAccountId\", \"report_id\": \"reportId\", \"controls\": [{\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"control_library_id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"control_library_version\": \"v1.2.3\", \"control_name\": \"Password Management\", \"control_description\": \"Password Management\", \"control_category\": \"Access Control\", \"control_path\": \"AC-2(a)\", \"control_specifications\": [{\"control_specification_id\": \"18d32a4430e54c81a6668952609763b2\", \"component_id\": \"cloud-object_storage\", \"control_specification_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"environment\": \"ibm cloud\", \"responsibility\": \"user\", \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}], \"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10}], \"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10}]}"; - String getReportControlsPath = "/reports/testString/controls"; + String mockResponseBody = "{\"report_id\": \"reportId\", \"home_account_id\": \"homeAccountId\", \"controls\": [{\"report_id\": \"6f1fdb98-c08b-41a8-a2f9-df10b51ff34a\", \"home_account_id\": \"2411ffdc16844b07b42521c3443f456d\", \"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"control_library_id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"control_library_version\": \"v1.2.3\", \"control_name\": \"Password Management\", \"control_description\": \"Password Management\", \"control_category\": \"Access Control\", \"control_specifications\": [{\"control_specification_id\": \"18d32a4430e54c81a6668952609763b2\", \"control_specification_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"component_id\": \"cloud-object_storage\", \"component_name\": \"cloud-object_storage\", \"environment\": \"ibm cloud\", \"responsibility\": \"user\", \"assessments\": [{\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}], \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"completed_count\": 135}], \"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"not_applicable_count\": 7}], \"resource_tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"not_applicable_count\": 7}]}"; + String getReportControlsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/controls"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2521,15 +3886,16 @@ public void testGetReportControlsWOptions() throws Throwable { // Construct an instance of the GetReportControlsOptions model GetReportControlsOptions getReportControlsOptionsModel = new GetReportControlsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .controlId("testString") .controlName("testString") .controlDescription("testString") .controlCategory("testString") .status("compliant") .sort("control_name") + .scopeId("testString") + .subscopeId("testString") .build(); // Invoke getReportControls() with a valid options model and verify the result @@ -2554,6 +3920,8 @@ public void testGetReportControlsWOptions() throws Throwable { assertEquals(query.get("control_category"), "testString"); assertEquals(query.get("status"), "compliant"); assertEquals(query.get("sort"), "control_name"); + assertEquals(query.get("scope_id"), "testString"); + assertEquals(query.get("subscope_id"), "testString"); } // Test the getReportControls operation with and without retries enabled @@ -2577,8 +3945,8 @@ public void testGetReportControlsNoOptions() throws Throwable { @Test public void testGetReportRuleWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"id\": \"rule-7b0560a4-df94-4629-bb76-680f3155ddda\", \"type\": \"user_defined/system_defined\", \"description\": \"rule\", \"version\": \"1.2.3\", \"account_id\": \"59bcbfa6ea2f006b4ed7094c1a08dcdd\", \"created_on\": \"2022-08-15T12:30:01Z\", \"created_by\": \"IBMid-12345\", \"updated_on\": \"2022-08-15T12:30:01Z\", \"updated_by\": \"IBMid-12345\", \"labels\": [\"labels\"]}"; - String getReportRulePath = "/reports/testString/rules/rule-8d444f8c-fd1d-48de-bcaa-f43732568761"; + String mockResponseBody = "{\"id\": \"rule-7b0560a4-df94-4629-bb76-680f3155ddda\", \"type\": \"user_defined/system_defined\", \"description\": \"rule\", \"version\": \"1.2.3\", \"account_id\": \"59bcbfa6ea2f006b4ed7094c1a08dcdd\", \"created_on\": \"2022-08-15T12:30:01.000Z\", \"created_by\": \"IBMid-12345\", \"updated_on\": \"2022-08-15T12:30:01.000Z\", \"updated_by\": \"IBMid-12345\", \"labels\": [\"labels\"]}"; + String getReportRulePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/rules/rule-61fa114a-2bb9-43fd-8068-b873b48bdf79"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2586,10 +3954,9 @@ public void testGetReportRuleWOptions() throws Throwable { // Construct an instance of the GetReportRuleOptions model GetReportRuleOptions getReportRuleOptionsModel = new GetReportRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .ruleId("rule-8d444f8c-fd1d-48de-bcaa-f43732568761") - .xCorrelationId("testString") - .xRequestId("testString") + .ruleId("rule-61fa114a-2bb9-43fd-8068-b873b48bdf79") .build(); // Invoke getReportRule() with a valid options model and verify the result @@ -2631,8 +3998,8 @@ public void testGetReportRuleNoOptions() throws Throwable { @Test public void testListReportEvaluationsWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"total_count\": 230, \"limit\": 50, \"start\": \"start\", \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\"}, \"home_account_id\": \"homeAccountId\", \"report_id\": \"reportId\", \"evaluations\": [{\"home_account_id\": \"be200c80cabc456e91139e4152327456\", \"report_id\": \"44a5-a292-32114fa73558\", \"control_id\": \"28016c95-b389-447f-8a05-eabe1ad7fd24\", \"component_id\": \"cloud-object_storage\", \"assessment\": {\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}, \"evaluate_time\": \"2022-06-30T11:03:44.630150782Z\", \"target\": {\"id\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\", \"account_id\": \"59bcbfa6ea2f006b4ed7094c1a08dcdd\", \"resource_crn\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\", \"resource_name\": \"mybucket\", \"service_name\": \"cloud-object-storage\"}, \"status\": \"failure\", \"reason\": \"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\", \"details\": {\"properties\": [{\"property\": \"allowed_network\", \"property_description\": \"A description for this property\", \"operator\": \"string_equals\", \"expected_value\": \"anyValue\", \"found_value\": \"anyValue\"}]}}]}"; - String listReportEvaluationsPath = "/reports/testString/evaluations"; + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"report_id\": \"reportId\", \"home_account_id\": \"homeAccountId\", \"evaluations\": [{\"report_id\": \"reportId\", \"home_account_id\": \"be200c80cabc456e91139e4152327456\", \"component_id\": \"cloud-object_storage\", \"component_name\": \"cloud-object_storage\", \"assessment\": {\"assessment_id\": \"382c2b06-e6b2-43ee-b189-c1c7743b67ee\", \"assessment_type\": \"ibm-cloud-rule\", \"assessment_method\": \"ibm-cloud-rule\", \"assessment_description\": \"Check whether Cloud Object Storage is accessible only by using private endpoints\", \"parameter_count\": 1, \"parameters\": [{\"assessment_type\": \"assessmentType\", \"assessment_id\": \"assessmentId\", \"parameter_name\": \"location\", \"parameter_display_name\": \"Location\", \"parameter_type\": \"string\", \"parameter_value\": \"anyValue\"}]}, \"evaluate_time\": \"2022-06-30T11:03:44.630150782Z\", \"target\": {\"id\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\", \"account_id\": \"59bcbfa6ea2f006b4ed7094c1a08dcdd\", \"service_name\": \"cloud-object-storage\", \"service_display_name\": \"cloud-object-storage\", \"resource_crn\": \"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\", \"resource_name\": \"mybucket\", \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}}, \"status\": \"failure\", \"reason\": \"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\", \"details\": {\"properties\": [{\"property\": \"property\", \"property_description\": \"propertyDescription\", \"operator\": \"string_equals\", \"expected_value\": \"anyValue\", \"found_value\": \"anyValue\"}], \"provider_info\": {\"provider_type\": \"providerType\"}}, \"evaluated_by\": \"abc@ibm.com\"}]}"; + String listReportEvaluationsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/evaluations"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2640,9 +4007,8 @@ public void testListReportEvaluationsWOptions() throws Throwable { // Construct an instance of the ListReportEvaluationsOptions model ListReportEvaluationsOptions listReportEvaluationsOptionsModel = new ListReportEvaluationsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .assessmentId("testString") .assessmentMethod("testString") .componentId("testString") @@ -2652,6 +4018,9 @@ public void testListReportEvaluationsWOptions() throws Throwable { .status("failure") .start("testString") .limit(Long.valueOf("10")) + .sort("assessment_id") + .scopeId("testString") + .subscopeId("testString") .build(); // Invoke listReportEvaluations() with a valid options model and verify the result @@ -2679,6 +4048,9 @@ public void testListReportEvaluationsWOptions() throws Throwable { assertEquals(query.get("status"), "failure"); assertEquals(query.get("start"), "testString"); assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("sort"), "assessment_id"); + assertEquals(query.get("scope_id"), "testString"); + assertEquals(query.get("subscope_id"), "testString"); } // Test the listReportEvaluations operation with and without retries enabled @@ -2702,8 +4074,8 @@ public void testListReportEvaluationsNoOptions() throws Throwable { @Test public void testListReportEvaluationsWithPagerGetNext() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"href\":\"https://myhost.com/somePath?start=1\"},\"evaluations\":[{\"home_account_id\":\"be200c80cabc456e91139e4152327456\",\"report_id\":\"44a5-a292-32114fa73558\",\"control_id\":\"28016c95-b389-447f-8a05-eabe1ad7fd24\",\"component_id\":\"cloud-object_storage\",\"assessment\":{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]},\"evaluate_time\":\"2022-06-30T11:03:44.630150782Z\",\"target\":{\"id\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"account_id\":\"59bcbfa6ea2f006b4ed7094c1a08dcdd\",\"resource_crn\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"resource_name\":\"mybucket\",\"service_name\":\"cloud-object-storage\"},\"status\":\"failure\",\"reason\":\"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\",\"details\":{\"properties\":[{\"property\":\"allowed_network\",\"property_description\":\"A description for this property\",\"operator\":\"string_equals\",\"expected_value\":\"anyValue\",\"found_value\":\"anyValue\"}]}}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"evaluations\":[{\"home_account_id\":\"be200c80cabc456e91139e4152327456\",\"report_id\":\"44a5-a292-32114fa73558\",\"control_id\":\"28016c95-b389-447f-8a05-eabe1ad7fd24\",\"component_id\":\"cloud-object_storage\",\"assessment\":{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]},\"evaluate_time\":\"2022-06-30T11:03:44.630150782Z\",\"target\":{\"id\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"account_id\":\"59bcbfa6ea2f006b4ed7094c1a08dcdd\",\"resource_crn\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"resource_name\":\"mybucket\",\"service_name\":\"cloud-object-storage\"},\"status\":\"failure\",\"reason\":\"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\",\"details\":{\"properties\":[{\"property\":\"allowed_network\",\"property_description\":\"A description for this property\",\"operator\":\"string_equals\",\"expected_value\":\"anyValue\",\"found_value\":\"anyValue\"}]}}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"evaluations\":[{\"report_id\":\"reportId\",\"home_account_id\":\"be200c80cabc456e91139e4152327456\",\"component_id\":\"cloud-object_storage\",\"component_name\":\"cloud-object_storage\",\"assessment\":{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]},\"evaluate_time\":\"2022-06-30T11:03:44.630150782Z\",\"target\":{\"id\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"account_id\":\"59bcbfa6ea2f006b4ed7094c1a08dcdd\",\"service_name\":\"cloud-object-storage\",\"service_display_name\":\"cloud-object-storage\",\"resource_crn\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"resource_name\":\"mybucket\",\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]}},\"status\":\"failure\",\"reason\":\"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\",\"details\":{\"properties\":[{\"property\":\"property\",\"property_description\":\"propertyDescription\",\"operator\":\"string_equals\",\"expected_value\":\"anyValue\",\"found_value\":\"anyValue\"}],\"provider_info\":{\"provider_type\":\"providerType\"}},\"evaluated_by\":\"abc@ibm.com\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"evaluations\":[{\"report_id\":\"reportId\",\"home_account_id\":\"be200c80cabc456e91139e4152327456\",\"component_id\":\"cloud-object_storage\",\"component_name\":\"cloud-object_storage\",\"assessment\":{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]},\"evaluate_time\":\"2022-06-30T11:03:44.630150782Z\",\"target\":{\"id\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"account_id\":\"59bcbfa6ea2f006b4ed7094c1a08dcdd\",\"service_name\":\"cloud-object-storage\",\"service_display_name\":\"cloud-object-storage\",\"resource_crn\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"resource_name\":\"mybucket\",\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]}},\"status\":\"failure\",\"reason\":\"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\",\"details\":{\"properties\":[{\"property\":\"property\",\"property_description\":\"propertyDescription\",\"operator\":\"string_equals\",\"expected_value\":\"anyValue\",\"found_value\":\"anyValue\"}],\"provider_info\":{\"provider_type\":\"providerType\"}},\"evaluated_by\":\"abc@ibm.com\"}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2718,9 +4090,8 @@ public void testListReportEvaluationsWithPagerGetNext() throws Throwable { .setBody("{\"message\": \"No more results available!\"}")); ListReportEvaluationsOptions listReportEvaluationsOptions = new ListReportEvaluationsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .assessmentId("testString") .assessmentMethod("testString") .componentId("testString") @@ -2729,6 +4100,9 @@ public void testListReportEvaluationsWithPagerGetNext() throws Throwable { .targetName("testString") .status("failure") .limit(Long.valueOf("10")) + .sort("assessment_id") + .scopeId("testString") + .subscopeId("testString") .build(); List allResults = new ArrayList<>(); @@ -2745,8 +4119,8 @@ public void testListReportEvaluationsWithPagerGetNext() throws Throwable { @Test public void testListReportEvaluationsWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"href\":\"https://myhost.com/somePath?start=1\"},\"evaluations\":[{\"home_account_id\":\"be200c80cabc456e91139e4152327456\",\"report_id\":\"44a5-a292-32114fa73558\",\"control_id\":\"28016c95-b389-447f-8a05-eabe1ad7fd24\",\"component_id\":\"cloud-object_storage\",\"assessment\":{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]},\"evaluate_time\":\"2022-06-30T11:03:44.630150782Z\",\"target\":{\"id\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"account_id\":\"59bcbfa6ea2f006b4ed7094c1a08dcdd\",\"resource_crn\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"resource_name\":\"mybucket\",\"service_name\":\"cloud-object-storage\"},\"status\":\"failure\",\"reason\":\"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\",\"details\":{\"properties\":[{\"property\":\"allowed_network\",\"property_description\":\"A description for this property\",\"operator\":\"string_equals\",\"expected_value\":\"anyValue\",\"found_value\":\"anyValue\"}]}}],\"total_count\":2,\"limit\":1}"; - String mockResponsePage2 = "{\"evaluations\":[{\"home_account_id\":\"be200c80cabc456e91139e4152327456\",\"report_id\":\"44a5-a292-32114fa73558\",\"control_id\":\"28016c95-b389-447f-8a05-eabe1ad7fd24\",\"component_id\":\"cloud-object_storage\",\"assessment\":{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]},\"evaluate_time\":\"2022-06-30T11:03:44.630150782Z\",\"target\":{\"id\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"account_id\":\"59bcbfa6ea2f006b4ed7094c1a08dcdd\",\"resource_crn\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"resource_name\":\"mybucket\",\"service_name\":\"cloud-object-storage\"},\"status\":\"failure\",\"reason\":\"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\",\"details\":{\"properties\":[{\"property\":\"allowed_network\",\"property_description\":\"A description for this property\",\"operator\":\"string_equals\",\"expected_value\":\"anyValue\",\"found_value\":\"anyValue\"}]}}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"evaluations\":[{\"report_id\":\"reportId\",\"home_account_id\":\"be200c80cabc456e91139e4152327456\",\"component_id\":\"cloud-object_storage\",\"component_name\":\"cloud-object_storage\",\"assessment\":{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]},\"evaluate_time\":\"2022-06-30T11:03:44.630150782Z\",\"target\":{\"id\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"account_id\":\"59bcbfa6ea2f006b4ed7094c1a08dcdd\",\"service_name\":\"cloud-object-storage\",\"service_display_name\":\"cloud-object-storage\",\"resource_crn\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"resource_name\":\"mybucket\",\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]}},\"status\":\"failure\",\"reason\":\"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\",\"details\":{\"properties\":[{\"property\":\"property\",\"property_description\":\"propertyDescription\",\"operator\":\"string_equals\",\"expected_value\":\"anyValue\",\"found_value\":\"anyValue\"}],\"provider_info\":{\"provider_type\":\"providerType\"}},\"evaluated_by\":\"abc@ibm.com\"}],\"total_count\":2,\"limit\":1}"; + String mockResponsePage2 = "{\"evaluations\":[{\"report_id\":\"reportId\",\"home_account_id\":\"be200c80cabc456e91139e4152327456\",\"component_id\":\"cloud-object_storage\",\"component_name\":\"cloud-object_storage\",\"assessment\":{\"assessment_id\":\"382c2b06-e6b2-43ee-b189-c1c7743b67ee\",\"assessment_type\":\"ibm-cloud-rule\",\"assessment_method\":\"ibm-cloud-rule\",\"assessment_description\":\"Check whether Cloud Object Storage is accessible only by using private endpoints\",\"parameter_count\":1,\"parameters\":[{\"assessment_type\":\"assessmentType\",\"assessment_id\":\"assessmentId\",\"parameter_name\":\"location\",\"parameter_display_name\":\"Location\",\"parameter_type\":\"string\",\"parameter_value\":\"anyValue\"}]},\"evaluate_time\":\"2022-06-30T11:03:44.630150782Z\",\"target\":{\"id\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"account_id\":\"59bcbfa6ea2f006b4ed7094c1a08dcdd\",\"service_name\":\"cloud-object-storage\",\"service_display_name\":\"cloud-object-storage\",\"resource_crn\":\"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket\",\"resource_name\":\"mybucket\",\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]}},\"status\":\"failure\",\"reason\":\"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met\",\"details\":{\"properties\":[{\"property\":\"property\",\"property_description\":\"propertyDescription\",\"operator\":\"string_equals\",\"expected_value\":\"anyValue\",\"found_value\":\"anyValue\"}],\"provider_info\":{\"provider_type\":\"providerType\"}},\"evaluated_by\":\"abc@ibm.com\"}],\"total_count\":2,\"limit\":1}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2761,9 +4135,8 @@ public void testListReportEvaluationsWithPagerGetAll() throws Throwable { .setBody("{\"message\": \"No more results available!\"}")); ListReportEvaluationsOptions listReportEvaluationsOptions = new ListReportEvaluationsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .assessmentId("testString") .assessmentMethod("testString") .componentId("testString") @@ -2772,6 +4145,9 @@ public void testListReportEvaluationsWithPagerGetAll() throws Throwable { .targetName("testString") .status("failure") .limit(Long.valueOf("10")) + .sort("assessment_id") + .scopeId("testString") + .subscopeId("testString") .build(); ReportEvaluationsPager pager = new ReportEvaluationsPager(securityAndComplianceCenterApiService, listReportEvaluationsOptions); @@ -2784,8 +4160,8 @@ public void testListReportEvaluationsWithPagerGetAll() throws Throwable { @Test public void testListReportResourcesWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"total_count\": 230, \"limit\": 50, \"start\": \"start\", \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\"}, \"home_account_id\": \"homeAccountId\", \"report_id\": \"reportId\", \"resources\": [{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"id\": \"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\", \"resource_name\": \"jeff's key\", \"component_id\": \"cloud-object_storage\", \"environment\": \"ibm cloud\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"completed_count\": 135}]}"; - String listReportResourcesPath = "/reports/testString/resources"; + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"report_id\": \"reportId\", \"home_account_id\": \"homeAccountId\", \"resources\": [{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"home_account_id\": \"2411ffdc16844b07b42521c3443f456d\", \"id\": \"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\", \"resource_name\": \"jeff's key\", \"account\": {\"id\": \"531fc3e28bfc43c5a2cea07786d93f5c\", \"name\": \"NIST\", \"type\": \"account_type\"}, \"component_id\": \"cloud-object_storage\", \"component_name\": \"cloud-object_storage\", \"environment\": \"ibm cloud\", \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}, \"status\": \"compliant\", \"total_count\": 140, \"pass_count\": 123, \"failure_count\": 12, \"error_count\": 5, \"skipped_count\": 7, \"completed_count\": 135, \"service_name\": \"pm-20\", \"instance_crn\": \"instanceCrn\"}]}"; + String listReportResourcesPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/resources"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2793,9 +4169,8 @@ public void testListReportResourcesWOptions() throws Throwable { // Construct an instance of the ListReportResourcesOptions model ListReportResourcesOptions listReportResourcesOptionsModel = new ListReportResourcesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .id("testString") .resourceName("testString") .accountId("testString") @@ -2804,6 +4179,8 @@ public void testListReportResourcesWOptions() throws Throwable { .sort("account_id") .start("testString") .limit(Long.valueOf("10")) + .scopeId("testString") + .subscopeId("testString") .build(); // Invoke listReportResources() with a valid options model and verify the result @@ -2830,6 +4207,8 @@ public void testListReportResourcesWOptions() throws Throwable { assertEquals(query.get("sort"), "account_id"); assertEquals(query.get("start"), "testString"); assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("scope_id"), "testString"); + assertEquals(query.get("subscope_id"), "testString"); } // Test the listReportResources operation with and without retries enabled @@ -2853,8 +4232,8 @@ public void testListReportResourcesNoOptions() throws Throwable { @Test public void testListReportResourcesWithPagerGetNext() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"href\":\"https://myhost.com/somePath?start=1\"},\"total_count\":2,\"limit\":1,\"resources\":[{\"report_id\":\"30b434b3-cb08-4845-af10-7a8fc682b6a8\",\"id\":\"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\",\"resource_name\":\"jeff's key\",\"component_id\":\"cloud-object_storage\",\"environment\":\"ibm cloud\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"completed_count\":135}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"report_id\":\"30b434b3-cb08-4845-af10-7a8fc682b6a8\",\"id\":\"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\",\"resource_name\":\"jeff's key\",\"component_id\":\"cloud-object_storage\",\"environment\":\"ibm cloud\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"completed_count\":135}]}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"resources\":[{\"report_id\":\"30b434b3-cb08-4845-af10-7a8fc682b6a8\",\"home_account_id\":\"2411ffdc16844b07b42521c3443f456d\",\"id\":\"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\",\"resource_name\":\"jeff's key\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"component_id\":\"cloud-object_storage\",\"component_name\":\"cloud-object_storage\",\"environment\":\"ibm cloud\",\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]},\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"skipped_count\":7,\"completed_count\":135,\"service_name\":\"pm-20\",\"instance_crn\":\"instanceCrn\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"report_id\":\"30b434b3-cb08-4845-af10-7a8fc682b6a8\",\"home_account_id\":\"2411ffdc16844b07b42521c3443f456d\",\"id\":\"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\",\"resource_name\":\"jeff's key\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"component_id\":\"cloud-object_storage\",\"component_name\":\"cloud-object_storage\",\"environment\":\"ibm cloud\",\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]},\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"skipped_count\":7,\"completed_count\":135,\"service_name\":\"pm-20\",\"instance_crn\":\"instanceCrn\"}]}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2869,9 +4248,8 @@ public void testListReportResourcesWithPagerGetNext() throws Throwable { .setBody("{\"message\": \"No more results available!\"}")); ListReportResourcesOptions listReportResourcesOptions = new ListReportResourcesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .id("testString") .resourceName("testString") .accountId("testString") @@ -2879,6 +4257,8 @@ public void testListReportResourcesWithPagerGetNext() throws Throwable { .status("compliant") .sort("account_id") .limit(Long.valueOf("10")) + .scopeId("testString") + .subscopeId("testString") .build(); List allResults = new ArrayList<>(); @@ -2895,8 +4275,8 @@ public void testListReportResourcesWithPagerGetNext() throws Throwable { @Test public void testListReportResourcesWithPagerGetAll() throws Throwable { // Set up the two-page mock response. - String mockResponsePage1 = "{\"next\":{\"href\":\"https://myhost.com/somePath?start=1\"},\"total_count\":2,\"limit\":1,\"resources\":[{\"report_id\":\"30b434b3-cb08-4845-af10-7a8fc682b6a8\",\"id\":\"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\",\"resource_name\":\"jeff's key\",\"component_id\":\"cloud-object_storage\",\"environment\":\"ibm cloud\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"completed_count\":135}]}"; - String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"report_id\":\"30b434b3-cb08-4845-af10-7a8fc682b6a8\",\"id\":\"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\",\"resource_name\":\"jeff's key\",\"component_id\":\"cloud-object_storage\",\"environment\":\"ibm cloud\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"completed_count\":135}]}"; + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"resources\":[{\"report_id\":\"30b434b3-cb08-4845-af10-7a8fc682b6a8\",\"home_account_id\":\"2411ffdc16844b07b42521c3443f456d\",\"id\":\"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\",\"resource_name\":\"jeff's key\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"component_id\":\"cloud-object_storage\",\"component_name\":\"cloud-object_storage\",\"environment\":\"ibm cloud\",\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]},\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"skipped_count\":7,\"completed_count\":135,\"service_name\":\"pm-20\",\"instance_crn\":\"instanceCrn\"}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"resources\":[{\"report_id\":\"30b434b3-cb08-4845-af10-7a8fc682b6a8\",\"home_account_id\":\"2411ffdc16844b07b42521c3443f456d\",\"id\":\"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::\",\"resource_name\":\"jeff's key\",\"account\":{\"id\":\"531fc3e28bfc43c5a2cea07786d93f5c\",\"name\":\"NIST\",\"type\":\"account_type\"},\"component_id\":\"cloud-object_storage\",\"component_name\":\"cloud-object_storage\",\"environment\":\"ibm cloud\",\"tags\":{\"user\":[\"user\"],\"access\":[\"access\"],\"service\":[\"service\"]},\"status\":\"compliant\",\"total_count\":140,\"pass_count\":123,\"failure_count\":12,\"error_count\":5,\"skipped_count\":7,\"completed_count\":135,\"service_name\":\"pm-20\",\"instance_crn\":\"instanceCrn\"}]}"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2911,9 +4291,8 @@ public void testListReportResourcesWithPagerGetAll() throws Throwable { .setBody("{\"message\": \"No more results available!\"}")); ListReportResourcesOptions listReportResourcesOptions = new ListReportResourcesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .id("testString") .resourceName("testString") .accountId("testString") @@ -2921,6 +4300,8 @@ public void testListReportResourcesWithPagerGetAll() throws Throwable { .status("compliant") .sort("account_id") .limit(Long.valueOf("10")) + .scopeId("testString") + .subscopeId("testString") .build(); ReportResourcesPager pager = new ReportResourcesPager(securityAndComplianceCenterApiService, listReportResourcesOptions); @@ -2934,7 +4315,7 @@ public void testListReportResourcesWithPagerGetAll() throws Throwable { public void testGetReportTagsWOptions() throws Throwable { // Register a mock response String mockResponseBody = "{\"report_id\": \"reportId\", \"tags\": {\"user\": [\"user\"], \"access\": [\"access\"], \"service\": [\"service\"]}}"; - String getReportTagsPath = "/reports/testString/tags"; + String getReportTagsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/tags"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2942,9 +4323,8 @@ public void testGetReportTagsWOptions() throws Throwable { // Construct an instance of the GetReportTagsOptions model GetReportTagsOptions getReportTagsOptionsModel = new GetReportTagsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .build(); // Invoke getReportTags() with a valid options model and verify the result @@ -2986,8 +4366,8 @@ public void testGetReportTagsNoOptions() throws Throwable { @Test public void testGetReportViolationsDriftWOptions() throws Throwable { // Register a mock response - String mockResponseBody = "{\"home_account_id\": \"homeAccountId\", \"report_id\": \"reportId\", \"data_points\": [{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"report_group_id\": \"55b6-b3A4-432250b84669\", \"scan_time\": \"2022-08-15T12:30:01Z\", \"controls\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10}}]}"; - String getReportViolationsDriftPath = "/reports/testString/violations_drift"; + String mockResponseBody = "{\"home_account_id\": \"homeAccountId\", \"report_group_id\": \"reportGroupId\", \"data_points\": [{\"report_id\": \"30b434b3-cb08-4845-af10-7a8fc682b6a8\", \"report_group_id\": \"55b6-b3A4-432250b84669\", \"scan_time\": \"2022-08-15T12:30:01Z\", \"controls_summary\": {\"status\": \"compliant\", \"total_count\": 150, \"compliant_count\": 130, \"not_compliant_count\": 5, \"unable_to_perform_count\": 5, \"user_evaluation_required_count\": 10, \"not_applicable_count\": 7}}]}"; + String getReportViolationsDriftPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/violations_drift"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) @@ -2995,10 +4375,11 @@ public void testGetReportViolationsDriftWOptions() throws Throwable { // Construct an instance of the GetReportViolationsDriftOptions model GetReportViolationsDriftOptions getReportViolationsDriftOptionsModel = new GetReportViolationsDriftOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .scanTimeDuration(Long.valueOf("0")) + .scopeId("testString") + .subscopeId("testString") .build(); // Invoke getReportViolationsDrift() with a valid options model and verify the result @@ -3018,6 +4399,8 @@ public void testGetReportViolationsDriftWOptions() throws Throwable { Map query = TestUtilities.parseQueryString(request); assertNotNull(query); assertEquals(Long.valueOf(query.get("scan_time_duration")), Long.valueOf("0")); + assertEquals(query.get("scope_id"), "testString"); + assertEquals(query.get("subscope_id"), "testString"); } // Test the getReportViolationsDrift operation with and without retries enabled @@ -3037,28 +4420,30 @@ public void testGetReportViolationsDriftNoOptions() throws Throwable { securityAndComplianceCenterApiService.getReportViolationsDrift(null).execute(); } - // Test the listProviderTypeInstances operation with a valid options model parameter + // Test the listScanReports operation with a valid options model parameter @Test - public void testListProviderTypeInstancesWOptions() throws Throwable { + public void testListScanReportsWOptions() throws Throwable { // Register a mock response - 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"; + String mockResponseBody = "{\"limit\": 50, \"total_count\": 230, \"first\": {\"href\": \"href\"}, \"next\": {\"href\": \"href\", \"start\": \"start\"}, \"scope_id\": \"44a5-a292-32114fa73558\", \"subscope_id\": \"44a5-a292-32114fa73555\", \"scan_reports\": [{\"id\": \"e44316e3-53bc-449b-a808-c16df680d462\", \"scan_id\": \"44a5-a292-32114fa73553\", \"instance_id\": \"instanceId\", \"scope_id\": \"44a5-a292-32114fa73558\", \"subscope_id\": \"44a5-a292-32114fa73555\", \"status\": \"completed\", \"created_on\": \"2024-05-08T12:30:01.000Z\", \"format\": \"pdf\", \"href\": \"href\"}]}"; + String listScanReportsPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the ListProviderTypeInstancesOptions model - ListProviderTypeInstancesOptions listProviderTypeInstancesOptionsModel = new ListProviderTypeInstancesOptions.Builder() - .providerTypeId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the ListScanReportsOptions model + ListScanReportsOptions listScanReportsOptionsModel = new ListScanReportsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId("testString") + .scopeId("testString") + .subscopeId("testString") + .sort("status") .build(); - // Invoke listProviderTypeInstances() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.listProviderTypeInstances(listProviderTypeInstancesOptionsModel).execute(); + // Invoke listScanReports() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listScanReports(listScanReportsOptionsModel).execute(); assertNotNull(response); - ProviderTypeInstancesResponse responseObj = response.getResult(); + ScanReportCollection responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -3067,160 +4452,449 @@ public void testListProviderTypeInstancesWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listProviderTypeInstancesPath); + assertEquals(parsedPath, listScanReportsPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(query.get("scope_id"), "testString"); + assertEquals(query.get("subscope_id"), "testString"); + assertEquals(query.get("sort"), "status"); + } + + // Test the listScanReports operation with and without retries enabled + @Test + public void testListScanReportsWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testListScanReportsWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testListScanReportsWOptions(); + } + + // Test the listScanReports operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListScanReportsNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listScanReports(null).execute(); + } + + // Test the createScanReport operation with a valid options model parameter + @Test + public void testCreateScanReportWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"id\"}"; + String createScanReportPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(202) + .setBody(mockResponseBody)); + + // Construct an instance of the CreateScanReportOptions model + CreateScanReportOptions createScanReportOptionsModel = new CreateScanReportOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId("testString") + .format("csv") + .scopeId("132009ff-b982-412e-a110-ad8797e10f84") + .subscopeId("c7ddcbcc-6a43-4ab3-b6a7-b2d8f65cd54a") + .build(); + + // Invoke createScanReport() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createScanReport(createScanReportOptionsModel).execute(); + assertNotNull(response); + CreateScanReport responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request sent to the mock server + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "POST"); + // Verify request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, createScanReportPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the listProviderTypeInstances operation with and without retries enabled + // Test the createScanReport operation with and without retries enabled @Test - public void testListProviderTypeInstancesWRetries() throws Throwable { + public void testCreateScanReportWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testListProviderTypeInstancesWOptions(); + testCreateScanReportWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testListProviderTypeInstancesWOptions(); + testCreateScanReportWOptions(); } - // Test the listProviderTypeInstances operation with a null options model (negative test) + // Test the createScanReport operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testListProviderTypeInstancesNoOptions() throws Throwable { + public void testCreateScanReportNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.listProviderTypeInstances(null).execute(); + securityAndComplianceCenterApiService.createScanReport(null).execute(); } - // Test the createProviderTypeInstance operation with a valid options model parameter + // Test the getScanReport operation with a valid options model parameter @Test - public void testCreateProviderTypeInstanceWOptions() throws Throwable { + public void testGetScanReportWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "{\"id\": \"e44316e3-53bc-449b-a808-c16df680d462\", \"scan_id\": \"44a5-a292-32114fa73553\", \"instance_id\": \"instanceId\", \"scope_id\": \"44a5-a292-32114fa73558\", \"subscope_id\": \"44a5-a292-32114fa73555\", \"status\": \"completed\", \"created_on\": \"2024-05-08T12:30:01.000Z\", \"format\": \"pdf\", \"href\": \"href\"}"; + String getScanReportPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports/testString"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetScanReportOptions model + GetScanReportOptions getScanReportOptionsModel = new GetScanReportOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId("testString") + .jobId("testString") + .build(); + + // Invoke getScanReport() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getScanReport(getScanReportOptionsModel).execute(); + assertNotNull(response); + ScanReport 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, getScanReportPath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getScanReport operation with and without retries enabled + @Test + public void testGetScanReportWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testGetScanReportWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testGetScanReportWOptions(); + } + + // Test the getScanReport operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetScanReportNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.getScanReport(null).execute(); + } + + // Test the getScanReportDownloadFile operation with a valid options model parameter + @Test + public void testGetScanReportDownloadFileWOptions() throws Throwable { + // Register a mock response + String mockResponseBody = "This is a mock binary response."; + String getScanReportDownloadFilePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports/testString/download"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/csv") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the GetScanReportDownloadFileOptions model + GetScanReportDownloadFileOptions getScanReportDownloadFileOptionsModel = new GetScanReportDownloadFileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId("testString") + .jobId("testString") + .accept("application/csv") + .build(); + + // Invoke getScanReportDownloadFile() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getScanReportDownloadFile(getScanReportDownloadFileOptionsModel).execute(); + assertNotNull(response); + try (InputStream 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, getScanReportDownloadFilePath); + // Verify that there is no query string + Map query = TestUtilities.parseQueryString(request); + assertNull(query); + } + + // Test the getScanReportDownloadFile operation with and without retries enabled + @Test + public void testGetScanReportDownloadFileWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testGetScanReportDownloadFileWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testGetScanReportDownloadFileWOptions(); + } + + // Test the getScanReportDownloadFile operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetScanReportDownloadFileNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.getScanReportDownloadFile(null).execute(); + } + + // Test the listRules operation with a valid options model parameter + @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\": \"anyValue\"}], \"ref\": \"ref\"}, \"required_config\": {\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}, \"labels\": [\"labels\"]}]}"; + String listRulesPath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + // Construct an instance of the ListRulesOptions model + ListRulesOptions listRulesOptionsModel = new ListRulesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .start("testString") + .type("system_defined") + .search("testString") + .serviceName("testString") + .sort("updated_on") + .build(); + + // Invoke listRules() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listRules(listRulesOptionsModel).execute(); + assertNotNull(response); + RuleCollection 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, listRulesPath); + // Verify query params + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("10")); + assertEquals(query.get("start"), "testString"); + assertEquals(query.get("type"), "system_defined"); + assertEquals(query.get("search"), "testString"); + assertEquals(query.get("service_name"), "testString"); + assertEquals(query.get("sort"), "updated_on"); + } + + // Test the listRules operation with and without retries enabled + @Test + public void testListRulesWRetries() throws Throwable { + securityAndComplianceCenterApiService.enableRetries(4, 30); + testListRulesWOptions(); + + securityAndComplianceCenterApiService.disableRetries(); + testListRulesWOptions(); + } + + // Test the listRules operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRulesNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.listRules(null).execute(); + } + + // Test the listRules operation using the RulesPager.getNext() method + @Test + public void testListRulesWithPagerGetNext() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"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\":\"anyValue\"}],\"ref\":\"ref\"},\"required_config\":{\"description\":\"description\",\"property\":\"property\",\"operator\":\"string_equals\",\"value\":\"anyValue\"},\"labels\":[\"labels\"]}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"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\":\"anyValue\"}],\"ref\":\"ref\"},\"required_config\":{\"description\":\"description\",\"property\":\"property\",\"operator\":\"string_equals\",\"value\":\"anyValue\"},\"labels\":[\"labels\"]}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRulesOptions listRulesOptions = new ListRulesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .type("system_defined") + .search("testString") + .serviceName("testString") + .sort("updated_on") + .build(); + + List allResults = new ArrayList<>(); + RulesPager pager = new RulesPager(securityAndComplianceCenterApiService, listRulesOptions); + while (pager.hasNext()) { + List nextPage = pager.getNext(); + assertNotNull(nextPage); + allResults.addAll(nextPage); + } + assertEquals(allResults.size(), 2); + } + + // Test the listRules operation using the RulesPager.getAll() method + @Test + public void testListRulesWithPagerGetAll() throws Throwable { + // Set up the two-page mock response. + String mockResponsePage1 = "{\"next\":{\"start\":\"1\"},\"total_count\":2,\"limit\":1,\"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\":\"anyValue\"}],\"ref\":\"ref\"},\"required_config\":{\"description\":\"description\",\"property\":\"property\",\"operator\":\"string_equals\",\"value\":\"anyValue\"},\"labels\":[\"labels\"]}]}"; + String mockResponsePage2 = "{\"total_count\":2,\"limit\":1,\"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\":\"anyValue\"}],\"ref\":\"ref\"},\"required_config\":{\"description\":\"description\",\"property\":\"property\",\"operator\":\"string_equals\",\"value\":\"anyValue\"},\"labels\":[\"labels\"]}]}"; + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage1)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponsePage2)); + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(400) + .setBody("{\"message\": \"No more results available!\"}")); + + ListRulesOptions listRulesOptions = new ListRulesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("10")) + .type("system_defined") + .search("testString") + .serviceName("testString") + .sort("updated_on") + .build(); + + RulesPager pager = new RulesPager(securityAndComplianceCenterApiService, listRulesOptions); + List allResults = pager.getAll(); + assertNotNull(allResults); + assertEquals(allResults.size(), 2); + } + + // Test the createRule operation with a valid options model parameter + @Test + public void testCreateRuleWOptions() throws Throwable { // Register a mock response - 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"; + 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\": \"anyValue\"}], \"ref\": \"ref\"}, \"required_config\": {\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}, \"labels\": [\"labels\"]}"; + String createRulePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(201) .setBody(mockResponseBody)); - // Construct an instance of the CreateProviderTypeInstanceOptions model - CreateProviderTypeInstanceOptions createProviderTypeInstanceOptionsModel = new CreateProviderTypeInstanceOptions.Builder() - .providerTypeId("testString") - .name("workload-protection-instance-1") - .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the AdditionalTargetAttribute model + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("location") + .operator("string_equals") + .value("us-east") .build(); - // Invoke createProviderTypeInstance() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.createProviderTypeInstance(createProviderTypeInstanceOptionsModel).execute(); - assertNotNull(response); - ProviderTypeInstanceItem responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createProviderTypeInstancePath); - // Verify that there is no query string - Map query = TestUtilities.parseQueryString(request); - assertNull(query); - } + // Construct an instance of the RuleTargetPrototype model + RuleTargetPrototype ruleTargetPrototypeModel = new RuleTargetPrototype.Builder() + .serviceName("cloud-object-storage") + .resourceKind("bucket") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .build(); - // Test the createProviderTypeInstance operation with and without retries enabled - @Test - public void testCreateProviderTypeInstanceWRetries() throws Throwable { - securityAndComplianceCenterApiService.enableRetries(4, 30); - testCreateProviderTypeInstanceWOptions(); + // Construct an instance of the ConditionItemConditionBase model + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .description("testString") + .property("hard_quota") + .operator("num_equals") + .value("${hard_quota}") + .build(); - securityAndComplianceCenterApiService.disableRetries(); - testCreateProviderTypeInstanceWOptions(); - } + // Construct an instance of the RequiredConfigConditionListConditionListConditionAnd model + RequiredConfigConditionListConditionListConditionAnd requiredConfigModel = new RequiredConfigConditionListConditionListConditionAnd.Builder() + .description("The Cloud Object Storage rule.") + .and(java.util.Arrays.asList(conditionItemModel)) + .build(); - // Test the createProviderTypeInstance operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateProviderTypeInstanceNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.createProviderTypeInstance(null).execute(); - } + // Construct an instance of the RuleParameter model + RuleParameter ruleParameterModel = new RuleParameter.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(); - // Test the deleteProviderTypeInstance operation with a valid options model parameter - @Test - public void testDeleteProviderTypeInstanceWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteProviderTypeInstancePath = "/provider_types/testString/provider_type_instances/testString"; - server.enqueue(new MockResponse() - .setResponseCode(204) - .setBody(mockResponseBody)); + // Construct an instance of the Import model + Import importModel = new Import.Builder() + .parameters(java.util.Arrays.asList(ruleParameterModel)) + .build(); - // Construct an instance of the DeleteProviderTypeInstanceOptions model - DeleteProviderTypeInstanceOptions deleteProviderTypeInstanceOptionsModel = new DeleteProviderTypeInstanceOptions.Builder() - .providerTypeId("testString") - .providerTypeInstanceId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the CreateRuleOptions model + CreateRuleOptions createRuleOptionsModel = new CreateRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .description("Example rule") + .target(ruleTargetPrototypeModel) + .requiredConfig(requiredConfigModel) + .version("1.0.0") + .xImport(importModel) + .labels(java.util.Arrays.asList()) .build(); - // Invoke deleteProviderTypeInstance() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.deleteProviderTypeInstance(deleteProviderTypeInstanceOptionsModel).execute(); + // Invoke createRule() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.createRule(createRuleOptionsModel).execute(); assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); + Rule responseObj = response.getResult(); + assertNotNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); + assertEquals(request.getMethod(), "POST"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteProviderTypeInstancePath); + assertEquals(parsedPath, createRulePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the deleteProviderTypeInstance operation with and without retries enabled + // Test the createRule operation with and without retries enabled @Test - public void testDeleteProviderTypeInstanceWRetries() throws Throwable { + public void testCreateRuleWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testDeleteProviderTypeInstanceWOptions(); + testCreateRuleWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testDeleteProviderTypeInstanceWOptions(); + testCreateRuleWOptions(); } - // Test the deleteProviderTypeInstance operation with a null options model (negative test) + // Test the createRule operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteProviderTypeInstanceNoOptions() throws Throwable { + public void testCreateRuleNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.deleteProviderTypeInstance(null).execute(); + securityAndComplianceCenterApiService.createRule(null).execute(); } - // Test the getProviderTypeInstance operation with a valid options model parameter + // Test the getRule operation with a valid options model parameter @Test - public void testGetProviderTypeInstanceWOptions() throws Throwable { + public void testGetRuleWOptions() throws Throwable { // Register a mock response - 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"; + 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\": \"anyValue\"}], \"ref\": \"ref\"}, \"required_config\": {\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}, \"labels\": [\"labels\"]}"; + String getRulePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules/testString"; server.enqueue(new MockResponse() .setHeader("Content-type", "application/json") .setResponseCode(200) .setBody(mockResponseBody)); - // Construct an instance of the GetProviderTypeInstanceOptions model - GetProviderTypeInstanceOptions getProviderTypeInstanceOptionsModel = new GetProviderTypeInstanceOptions.Builder() - .providerTypeId("testString") - .providerTypeInstanceId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the GetRuleOptions model + GetRuleOptions getRuleOptionsModel = new GetRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .ruleId("testString") .build(); - // Invoke getProviderTypeInstance() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.getProviderTypeInstance(getProviderTypeInstanceOptionsModel).execute(); + // Invoke getRule() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getRule(getRuleOptionsModel).execute(); assertNotNull(response); - ProviderTypeInstanceItem responseObj = response.getResult(); + Rule responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -3229,155 +4903,200 @@ public void testGetProviderTypeInstanceWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProviderTypeInstancePath); + assertEquals(parsedPath, getRulePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getProviderTypeInstance operation with and without retries enabled + // Test the getRule operation with and without retries enabled @Test - public void testGetProviderTypeInstanceWRetries() throws Throwable { + public void testGetRuleWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testGetProviderTypeInstanceWOptions(); + testGetRuleWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testGetProviderTypeInstanceWOptions(); + testGetRuleWOptions(); } - // Test the getProviderTypeInstance operation with a null options model (negative test) + // Test the getRule operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetProviderTypeInstanceNoOptions() throws Throwable { + public void testGetRuleNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.getProviderTypeInstance(null).execute(); + securityAndComplianceCenterApiService.getRule(null).execute(); } - // Test the updateProviderTypeInstance operation with a valid options model parameter + // Test the replaceRule operation with a valid options model parameter @Test - public void testUpdateProviderTypeInstanceWOptions() throws Throwable { + public void testReplaceRuleWOptions() throws Throwable { // Register a mock response - 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"; + 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\": \"anyValue\"}], \"ref\": \"ref\"}, \"required_config\": {\"description\": \"description\", \"property\": \"property\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}, \"labels\": [\"labels\"]}"; + String replaceRulePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules/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") + // Construct an instance of the AdditionalTargetAttribute model + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("location") + .operator("string_equals") + .value("us-south") .build(); - // Construct an instance of the UpdateProviderTypeInstanceOptions model - UpdateProviderTypeInstanceOptions updateProviderTypeInstanceOptionsModel = new UpdateProviderTypeInstanceOptions.Builder() - .providerTypeId("testString") - .providerTypeInstanceId("testString") - .updateProviderTypeInstanceRequest(updateProviderTypeInstanceRequestModel) - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the RuleTargetPrototype model + RuleTargetPrototype ruleTargetPrototypeModel = new RuleTargetPrototype.Builder() + .serviceName("cloud-object-storage") + .resourceKind("bucket") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) .build(); - // Invoke updateProviderTypeInstance() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.updateProviderTypeInstance(updateProviderTypeInstanceOptionsModel).execute(); + // Construct an instance of the ConditionItemConditionBase model + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .description("testString") + .property("hard_quota") + .operator("num_equals") + .value("${hard_quota}") + .build(); + + // Construct an instance of the RequiredConfigConditionListConditionListConditionAnd model + RequiredConfigConditionListConditionListConditionAnd requiredConfigModel = new RequiredConfigConditionListConditionListConditionAnd.Builder() + .description("The Cloud Object Storage rule.") + .and(java.util.Arrays.asList(conditionItemModel)) + .build(); + + // Construct an instance of the RuleParameter model + RuleParameter ruleParameterModel = new RuleParameter.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(); + + // Construct an instance of the Import model + Import importModel = new Import.Builder() + .parameters(java.util.Arrays.asList(ruleParameterModel)) + .build(); + + // Construct an instance of the ReplaceRuleOptions model + ReplaceRuleOptions replaceRuleOptionsModel = new ReplaceRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .ruleId("testString") + .ifMatch("testString") + .description("Example rule") + .target(ruleTargetPrototypeModel) + .requiredConfig(requiredConfigModel) + .version("1.0.1") + .xImport(importModel) + .labels(java.util.Arrays.asList()) + .build(); + + // Invoke replaceRule() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.replaceRule(replaceRuleOptionsModel).execute(); assertNotNull(response); - ProviderTypeInstanceItem responseObj = response.getResult(); + Rule 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(), "PATCH"); + assertEquals(request.getMethod(), "PUT"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateProviderTypeInstancePath); + assertEquals(parsedPath, replaceRulePath); + // Verify header parameters + assertEquals(request.getHeader("If-Match"), "testString"); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the updateProviderTypeInstance operation with and without retries enabled + // Test the replaceRule operation with and without retries enabled @Test - public void testUpdateProviderTypeInstanceWRetries() throws Throwable { + public void testReplaceRuleWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testUpdateProviderTypeInstanceWOptions(); + testReplaceRuleWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testUpdateProviderTypeInstanceWOptions(); + testReplaceRuleWOptions(); } - // Test the updateProviderTypeInstance operation with a null options model (negative test) + // Test the replaceRule operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateProviderTypeInstanceNoOptions() throws Throwable { + public void testReplaceRuleNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.updateProviderTypeInstance(null).execute(); + securityAndComplianceCenterApiService.replaceRule(null).execute(); } - // Test the getProviderTypesInstances operation with a valid options model parameter + // Test the deleteRule operation with a valid options model parameter @Test - public void testGetProviderTypesInstancesWOptions() throws Throwable { + public void testDeleteRuleWOptions() throws Throwable { // Register a mock response - 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"; + String mockResponseBody = ""; + String deleteRulePath = "/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules/testString"; server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) + .setResponseCode(204) .setBody(mockResponseBody)); - // Construct an instance of the GetProviderTypesInstancesOptions model - GetProviderTypesInstancesOptions getProviderTypesInstancesOptionsModel = new GetProviderTypesInstancesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + // Construct an instance of the DeleteRuleOptions model + DeleteRuleOptions deleteRuleOptionsModel = new DeleteRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .ruleId("testString") .build(); - // Invoke getProviderTypesInstances() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.getProviderTypesInstances(getProviderTypesInstancesOptionsModel).execute(); + // Invoke deleteRule() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.deleteRule(deleteRuleOptionsModel).execute(); assertNotNull(response); - ProviderTypesInstancesResponse responseObj = response.getResult(); - assertNotNull(responseObj); + Void responseObj = response.getResult(); + assertNull(responseObj); // Verify the contents of the request sent to the mock server RecordedRequest request = server.takeRequest(); assertNotNull(request); - assertEquals(request.getMethod(), "GET"); + assertEquals(request.getMethod(), "DELETE"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProviderTypesInstancesPath); + assertEquals(parsedPath, deleteRulePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getProviderTypesInstances operation with and without retries enabled + // Test the deleteRule operation with and without retries enabled @Test - public void testGetProviderTypesInstancesWRetries() throws Throwable { + public void testDeleteRuleWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testGetProviderTypesInstancesWOptions(); + testDeleteRuleWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testGetProviderTypesInstancesWOptions(); + testDeleteRuleWOptions(); } - // Test the listProviderTypes operation with a valid options model parameter + // Test the deleteRule operation with a null options model (negative test) + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteRuleNoOptions() throws Throwable { + server.enqueue(new MockResponse()); + securityAndComplianceCenterApiService.deleteRule(null).execute(); + } + + // Test the listServices operation with a valid options model parameter @Test - public void testListProviderTypesWOptions() throws Throwable { + public void testListServicesWOptions() 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"; + String mockResponseBody = "{\"services\": [{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"description\": \"description\", \"monitoring_enabled\": false, \"enforcement_enabled\": true, \"service_listing_enabled\": false, \"config_information_point\": {\"type\": \"type\", \"endpoints\": [{\"host\": \"host\", \"path\": \"path\", \"region\": \"region\", \"advisory_call_limit\": 17}]}, \"supported_configs\": [{\"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}], \"properties\": [{\"name\": \"name\", \"description\": \"description\", \"type\": \"string\"}], \"description\": \"description\", \"cip_requires_service_instance\": true, \"resource_group_support\": true, \"tagging_support\": true, \"inherit_tags\": false}]}]}"; + String listServicesPath = "/v3/services"; 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(); + // Construct an instance of the ListServicesOptions model + ListServicesOptions listServicesOptionsModel = new ListServicesOptions(); - // Invoke listProviderTypes() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.listProviderTypes(listProviderTypesOptionsModel).execute(); + // Invoke listServices() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.listServices(listServicesOptionsModel).execute(); assertNotNull(response); - ProviderTypesCollection responseObj = response.getResult(); + ServiceCollection responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -3386,44 +5105,42 @@ public void testListProviderTypesWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listProviderTypesPath); + assertEquals(parsedPath, listServicesPath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the listProviderTypes operation with and without retries enabled + // Test the listServices operation with and without retries enabled @Test - public void testListProviderTypesWRetries() throws Throwable { + public void testListServicesWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testListProviderTypesWOptions(); + testListServicesWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testListProviderTypesWOptions(); + testListServicesWOptions(); } - // Test the getProviderTypeById operation with a valid options model parameter + // Test the getService operation with a valid options model parameter @Test - public void testGetProviderTypeByIdWOptions() throws Throwable { + public void testGetServiceWOptions() 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"; + String mockResponseBody = "{\"created_on\": \"2019-01-01T12:00:00.000Z\", \"created_by\": \"createdBy\", \"updated_on\": \"2019-01-01T12:00:00.000Z\", \"updated_by\": \"updatedBy\", \"service_name\": \"serviceName\", \"service_display_name\": \"serviceDisplayName\", \"description\": \"description\", \"monitoring_enabled\": false, \"enforcement_enabled\": true, \"service_listing_enabled\": false, \"config_information_point\": {\"type\": \"type\", \"endpoints\": [{\"host\": \"host\", \"path\": \"path\", \"region\": \"region\", \"advisory_call_limit\": 17}]}, \"supported_configs\": [{\"resource_kind\": \"resourceKind\", \"additional_target_attributes\": [{\"name\": \"name\", \"operator\": \"string_equals\", \"value\": \"anyValue\"}], \"properties\": [{\"name\": \"name\", \"description\": \"description\", \"type\": \"string\"}], \"description\": \"description\", \"cip_requires_service_instance\": true, \"resource_group_support\": true, \"tagging_support\": true, \"inherit_tags\": false}]}"; + String getServicePath = "/v3/services/cloud-object-storage"; 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") + // Construct an instance of the GetServiceOptions model + GetServiceOptions getServiceOptionsModel = new GetServiceOptions.Builder() + .servicesName("cloud-object-storage") .build(); - // Invoke getProviderTypeById() with a valid options model and verify the result - Response response = securityAndComplianceCenterApiService.getProviderTypeById(getProviderTypeByIdOptionsModel).execute(); + // Invoke getService() with a valid options model and verify the result + Response response = securityAndComplianceCenterApiService.getService(getServiceOptionsModel).execute(); assertNotNull(response); - ProviderTypeItem responseObj = response.getResult(); + Service responseObj = response.getResult(); assertNotNull(responseObj); // Verify the contents of the request sent to the mock server @@ -3432,27 +5149,27 @@ public void testGetProviderTypeByIdWOptions() throws Throwable { assertEquals(request.getMethod(), "GET"); // Verify request path String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getProviderTypeByIdPath); + assertEquals(parsedPath, getServicePath); // Verify that there is no query string Map query = TestUtilities.parseQueryString(request); assertNull(query); } - // Test the getProviderTypeById operation with and without retries enabled + // Test the getService operation with and without retries enabled @Test - public void testGetProviderTypeByIdWRetries() throws Throwable { + public void testGetServiceWRetries() throws Throwable { securityAndComplianceCenterApiService.enableRetries(4, 30); - testGetProviderTypeByIdWOptions(); + testGetServiceWOptions(); securityAndComplianceCenterApiService.disableRetries(); - testGetProviderTypeByIdWOptions(); + testGetServiceWOptions(); } - // Test the getProviderTypeById operation with a null options model (negative test) + // Test the getService operation with a null options model (negative test) @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetProviderTypeByIdNoOptions() throws Throwable { + public void testGetServiceNoOptions() throws Throwable { server.enqueue(new MockResponse()); - securityAndComplianceCenterApiService.getProviderTypeById(null).execute(); + securityAndComplianceCenterApiService.getService(null).execute(); } // Perform setup needed before each test method diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AccountTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AccountTest.java index ffcb9cda..3fb9818b 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AccountTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AccountTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -31,9 +31,21 @@ public class AccountTest { @Test public void testAccount() throws Throwable { - Account accountModel = new Account(); - assertNull(accountModel.getId()); - assertNull(accountModel.getName()); - assertNull(accountModel.getType()); + Account accountModel = new Account.Builder() + .id("531fc3e28bfc43c5a2cea07786d93f5c") + .name("NIST") + .type("account_type") + .build(); + assertEquals(accountModel.id(), "531fc3e28bfc43c5a2cea07786d93f5c"); + assertEquals(accountModel.name(), "NIST"); + assertEquals(accountModel.type(), "account_type"); + + String json = TestUtilities.serialize(accountModel); + + Account accountModelNew = TestUtilities.deserialize(json, Account.class); + assertTrue(accountModelNew instanceof Account); + assertEquals(accountModelNew.id(), "531fc3e28bfc43c5a2cea07786d93f5c"); + assertEquals(accountModelNew.name(), "NIST"); + assertEquals(accountModelNew.type(), "account_type"); } } \ 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/AdditionalDetailsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalDetailsTest.java new file mode 100644 index 00000000..39a4351a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalDetailsTest.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.AdditionalDetails; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Link; +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 AdditionalDetails model. + */ +public class AdditionalDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAdditionalDetails() throws Throwable { + AdditionalDetails additionalDetailsModel = new AdditionalDetails(); + assertNull(additionalDetailsModel.getCreatedBy()); + assertNull(additionalDetailsModel.getLabels()); + assertNull(additionalDetailsModel.getLinks()); + } +} \ 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/AdditionalPropertyTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalPropertyTest.java index e0c573c3..68ea9096 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalPropertyTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalPropertyTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalTargetAttributeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalTargetAttributeTest.java index 675434a8..17a21d4b 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalTargetAttributeTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AdditionalTargetAttributeTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -48,4 +48,10 @@ public void testAdditionalTargetAttribute() throws Throwable { assertEquals(additionalTargetAttributeModelNew.operator(), "string_equals"); assertEquals(additionalTargetAttributeModelNew.value(), "testString"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAdditionalTargetAttributeError() throws Throwable { + new AdditionalTargetAttribute.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/AssessmentPrototypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentPrototypeTest.java new file mode 100644 index 00000000..3ed25581 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentPrototypeTest.java @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.AssessmentPrototype; +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 AssessmentPrototype model. + */ +public class AssessmentPrototypeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssessmentPrototype() throws Throwable { + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("testString") + .assessmentDescription("testString") + .build(); + assertEquals(assessmentPrototypeModel.assessmentId(), "testString"); + assertEquals(assessmentPrototypeModel.assessmentDescription(), "testString"); + + String json = TestUtilities.serialize(assessmentPrototypeModel); + + AssessmentPrototype assessmentPrototypeModelNew = TestUtilities.deserialize(json, AssessmentPrototype.class); + assertTrue(assessmentPrototypeModelNew instanceof AssessmentPrototype); + assertEquals(assessmentPrototypeModelNew.assessmentId(), "testString"); + assertEquals(assessmentPrototypeModelNew.assessmentDescription(), "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/AssessmentTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentTest.java index 517c0a46..dfac5b5d 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,7 +15,7 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -32,12 +32,50 @@ public class AssessmentTest { @Test public void testAssessment() throws Throwable { - Assessment assessmentModel = new Assessment(); - assertNull(assessmentModel.getAssessmentId()); - assertNull(assessmentModel.getAssessmentType()); - assertNull(assessmentModel.getAssessmentMethod()); - assertNull(assessmentModel.getAssessmentDescription()); - assertNull(assessmentModel.getParameterCount()); - assertNull(assessmentModel.getParameters()); + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); + + Assessment assessmentModel = new Assessment.Builder() + .assessmentId("382c2b06-e6b2-43ee-b189-c1c7743b67ee") + .assessmentType("ibm-cloud-rule") + .assessmentMethod("ibm-cloud-rule") + .assessmentDescription("Check whether Cloud Object Storage is accessible only by using private endpoints") + .parameterCount(Long.valueOf("1")) + .parameters(java.util.Arrays.asList(parameterModel)) + .build(); + assertEquals(assessmentModel.assessmentId(), "382c2b06-e6b2-43ee-b189-c1c7743b67ee"); + assertEquals(assessmentModel.assessmentType(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentMethod(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentDescription(), "Check whether Cloud Object Storage is accessible only by using private endpoints"); + assertEquals(assessmentModel.parameterCount(), Long.valueOf("1")); + assertEquals(assessmentModel.parameters(), java.util.Arrays.asList(parameterModel)); + + String json = TestUtilities.serialize(assessmentModel); + + Assessment assessmentModelNew = TestUtilities.deserialize(json, Assessment.class); + assertTrue(assessmentModelNew instanceof Assessment); + assertEquals(assessmentModelNew.assessmentId(), "382c2b06-e6b2-43ee-b189-c1c7743b67ee"); + assertEquals(assessmentModelNew.assessmentType(), "ibm-cloud-rule"); + assertEquals(assessmentModelNew.assessmentMethod(), "ibm-cloud-rule"); + assertEquals(assessmentModelNew.assessmentDescription(), "Check whether Cloud Object Storage is accessible only by using private endpoints"); + assertEquals(assessmentModelNew.parameterCount(), Long.valueOf("1")); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAssessmentError() throws Throwable { + new Assessment.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/AssessmentWithStatsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentWithStatsTest.java new file mode 100644 index 00000000..a13545ec --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AssessmentWithStatsTest.java @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.AssessmentWithStats; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +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 AssessmentWithStats model. + */ +public class AssessmentWithStatsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAssessmentWithStats() throws Throwable { + AssessmentWithStats assessmentWithStatsModel = new AssessmentWithStats(); + assertNull(assessmentWithStatsModel.getAssessmentId()); + assertNull(assessmentWithStatsModel.getAssessmentType()); + assertNull(assessmentWithStatsModel.getAssessmentMethod()); + assertNull(assessmentWithStatsModel.getAssessmentDescription()); + assertNull(assessmentWithStatsModel.getParameterCount()); + assertNull(assessmentWithStatsModel.getParameters()); + assertNull(assessmentWithStatsModel.getTotalCount()); + assertNull(assessmentWithStatsModel.getPassCount()); + assertNull(assessmentWithStatsModel.getFailureCount()); + assertNull(assessmentWithStatsModel.getErrorCount()); + assertNull(assessmentWithStatsModel.getCompletedCount()); + } +} \ 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/AttachmentNotificationsControlsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsControlsTest.java new file mode 100644 index 00000000..d73b5bf7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsControlsTest.java @@ -0,0 +1,53 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.AttachmentNotificationsControls; +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 AttachmentNotificationsControls model. + */ +public class AttachmentNotificationsControlsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAttachmentNotificationsControls() throws Throwable { + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList("testString")) + .build(); + assertEquals(attachmentNotificationsControlsModel.thresholdLimit(), Long.valueOf("15")); + assertEquals(attachmentNotificationsControlsModel.failedControlIds(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(attachmentNotificationsControlsModel); + + AttachmentNotificationsControls attachmentNotificationsControlsModelNew = TestUtilities.deserialize(json, AttachmentNotificationsControls.class); + assertTrue(attachmentNotificationsControlsModelNew instanceof AttachmentNotificationsControls); + assertEquals(attachmentNotificationsControlsModelNew.thresholdLimit(), Long.valueOf("15")); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testAttachmentNotificationsControlsError() throws Throwable { + new AttachmentNotificationsControls.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/AttachmentNotificationsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsTest.java new file mode 100644 index 00000000..5277443b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentNotificationsTest.java @@ -0,0 +1,56 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +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 AttachmentNotifications model. + */ +public class AttachmentNotificationsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testAttachmentNotifications() throws Throwable { + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList("testString")) + .build(); + assertEquals(attachmentNotificationsControlsModel.thresholdLimit(), Long.valueOf("15")); + assertEquals(attachmentNotificationsControlsModel.failedControlIds(), java.util.Arrays.asList("testString")); + + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() + .enabled(true) + .controls(attachmentNotificationsControlsModel) + .build(); + assertEquals(attachmentNotificationsModel.enabled(), Boolean.valueOf(true)); + assertEquals(attachmentNotificationsModel.controls(), attachmentNotificationsControlsModel); + + String json = TestUtilities.serialize(attachmentNotificationsModel); + + AttachmentNotifications attachmentNotificationsModelNew = TestUtilities.deserialize(json, AttachmentNotifications.class); + assertTrue(attachmentNotificationsModelNew instanceof AttachmentNotifications); + assertEquals(attachmentNotificationsModelNew.enabled(), Boolean.valueOf(true)); + assertEquals(attachmentNotificationsModelNew.controls().toString(), attachmentNotificationsControlsModel.toString()); + } +} \ 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/AttachmentTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentTest.java index 24e00b96..ea50fc6c 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,9 +14,12 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; 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.Attachment; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentScope; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -39,5 +42,7 @@ public void testAttachment() throws Throwable { assertNull(attachmentModel.getDescription()); assertNull(attachmentModel.getSchedule()); assertNull(attachmentModel.getScope()); + assertNull(attachmentModel.getScopes()); + assertNull(attachmentModel.getNotifications()); } } \ 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/ComparePredefinedProfilesResponseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComparePredefinedProfilesResponseTest.java new file mode 100644 index 00000000..ad5e5375 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComparePredefinedProfilesResponseTest.java @@ -0,0 +1,52 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComparePredefinedProfilesResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CompareProfileResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlChanges; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlChangesUpdated; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersChanges; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersDifference; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; +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 ComparePredefinedProfilesResponse model. + */ +public class ComparePredefinedProfilesResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testComparePredefinedProfilesResponse() throws Throwable { + ComparePredefinedProfilesResponse comparePredefinedProfilesResponseModel = new ComparePredefinedProfilesResponse(); + assertNull(comparePredefinedProfilesResponseModel.getCurrentPredefinedVersion()); + assertNull(comparePredefinedProfilesResponseModel.getLatestPredefinedVersion()); + assertNull(comparePredefinedProfilesResponseModel.getControlsChanges()); + assertNull(comparePredefinedProfilesResponseModel.getDefaultParametersChanges()); + } +} \ 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/CompareProfileResponseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfileResponseTest.java new file mode 100644 index 00000000..f7b15c36 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfileResponseTest.java @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.CompareProfileResponse; +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 CompareProfileResponse model. + */ +public class CompareProfileResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCompareProfileResponse() throws Throwable { + CompareProfileResponse compareProfileResponseModel = new CompareProfileResponse(); + assertNull(compareProfileResponseModel.getId()); + assertNull(compareProfileResponseModel.getProfileName()); + assertNull(compareProfileResponseModel.getProfileDescription()); + assertNull(compareProfileResponseModel.getProfileType()); + assertNull(compareProfileResponseModel.getProfileVersion()); + assertNull(compareProfileResponseModel.getVersionGroupLabel()); + assertNull(compareProfileResponseModel.isLatest()); + assertNull(compareProfileResponseModel.getCreatedBy()); + assertNull(compareProfileResponseModel.getCreatedOn()); + assertNull(compareProfileResponseModel.getUpdatedBy()); + assertNull(compareProfileResponseModel.getUpdatedOn()); + assertNull(compareProfileResponseModel.getControlsCount()); + } +} \ 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/CompareProfilesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfilesOptionsTest.java new file mode 100644 index 00000000..deee65be --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CompareProfilesOptionsTest.java @@ -0,0 +1,49 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.CompareProfilesOptions; +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 CompareProfilesOptions model. + */ +public class CompareProfilesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCompareProfilesOptions() throws Throwable { + CompareProfilesOptions compareProfilesOptionsModel = new CompareProfilesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("2f598907-970d-4d52-9071-5cc95912f55e") + .accountId("testString") + .build(); + assertEquals(compareProfilesOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(compareProfilesOptionsModel.profileId(), "2f598907-970d-4d52-9071-5cc95912f55e"); + assertEquals(compareProfilesOptionsModel.accountId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCompareProfilesOptionsError() throws Throwable { + new CompareProfilesOptions.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/ComplianceScoreTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceScoreTest.java index 6df8669c..b4a58d01 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceScoreTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceScoreTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsTest.java index c6ba84da..b6cc7fb6 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -38,5 +38,6 @@ public void testComplianceStats() throws Throwable { assertNull(complianceStatsModel.getNotCompliantCount()); assertNull(complianceStatsModel.getUnableToPerformCount()); assertNull(complianceStatsModel.getUserEvaluationRequiredCount()); + assertNull(complianceStatsModel.getNotApplicableCount()); } } \ 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/ComplianceStatsWithNonCompliantTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsWithNonCompliantTest.java new file mode 100644 index 00000000..93efe01b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ComplianceStatsWithNonCompliantTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ComplianceStatsWithNonCompliant; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSummary; +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 ComplianceStatsWithNonCompliant model. + */ +public class ComplianceStatsWithNonCompliantTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testComplianceStatsWithNonCompliant() throws Throwable { + ComplianceStatsWithNonCompliant complianceStatsWithNonCompliantModel = new ComplianceStatsWithNonCompliant(); + assertNull(complianceStatsWithNonCompliantModel.getStatus()); + assertNull(complianceStatsWithNonCompliantModel.getTotalCount()); + assertNull(complianceStatsWithNonCompliantModel.getCompliantCount()); + assertNull(complianceStatsWithNonCompliantModel.getNotCompliantCount()); + assertNull(complianceStatsWithNonCompliantModel.getUnableToPerformCount()); + assertNull(complianceStatsWithNonCompliantModel.getUserEvaluationRequiredCount()); + assertNull(complianceStatsWithNonCompliantModel.getNotApplicableCount()); + assertNull(complianceStatsWithNonCompliantModel.getNotCompliantControls()); + } +} \ 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/ConditionItemConditionBaseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionBaseTest.java new file mode 100644 index 00000000..80be5210 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionBaseTest.java @@ -0,0 +1,60 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionBase; +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 ConditionItemConditionBase model. + */ +public class ConditionItemConditionBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConditionItemConditionBase() throws Throwable { + ConditionItemConditionBase conditionItemConditionBaseModel = new ConditionItemConditionBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(conditionItemConditionBaseModel.description(), "testString"); + assertEquals(conditionItemConditionBaseModel.property(), "testString"); + assertEquals(conditionItemConditionBaseModel.operator(), "string_equals"); + assertEquals(conditionItemConditionBaseModel.value(), "testString"); + + String json = TestUtilities.serialize(conditionItemConditionBaseModel); + + ConditionItemConditionBase conditionItemConditionBaseModelNew = TestUtilities.deserialize(json, ConditionItemConditionBase.class); + assertTrue(conditionItemConditionBaseModelNew instanceof ConditionItemConditionBase); + assertEquals(conditionItemConditionBaseModelNew.description(), "testString"); + assertEquals(conditionItemConditionBaseModelNew.property(), "testString"); + assertEquals(conditionItemConditionBaseModelNew.operator(), "string_equals"); + assertEquals(conditionItemConditionBaseModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testConditionItemConditionBaseError() throws Throwable { + new ConditionItemConditionBase.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/ConditionItemConditionListConditionListConditionAndTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionAndTest.java new file mode 100644 index 00000000..d3482409 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionAndTest.java @@ -0,0 +1,59 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionListConditionListConditionAnd; +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 ConditionItemConditionListConditionListConditionAnd model. + */ +public class ConditionItemConditionListConditionListConditionAndTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConditionItemConditionListConditionListConditionAnd() throws Throwable { + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(conditionItemModel.description(), "testString"); + assertEquals(conditionItemModel.property(), "testString"); + assertEquals(conditionItemModel.operator(), "string_equals"); + assertEquals(conditionItemModel.value(), "testString"); + + ConditionItemConditionListConditionListConditionAnd conditionItemConditionListConditionListConditionAndModel = new ConditionItemConditionListConditionListConditionAnd.Builder() + .description("testString") + .and(java.util.Arrays.asList(conditionItemModel)) + .build(); + assertEquals(conditionItemConditionListConditionListConditionAndModel.description(), "testString"); + assertEquals(conditionItemConditionListConditionListConditionAndModel.and(), java.util.Arrays.asList(conditionItemModel)); + + String json = TestUtilities.serialize(conditionItemConditionListConditionListConditionAndModel); + + ConditionItemConditionListConditionListConditionAnd conditionItemConditionListConditionListConditionAndModelNew = TestUtilities.deserialize(json, ConditionItemConditionListConditionListConditionAnd.class); + assertTrue(conditionItemConditionListConditionListConditionAndModelNew instanceof ConditionItemConditionListConditionListConditionAnd); + assertEquals(conditionItemConditionListConditionListConditionAndModelNew.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/ConditionItemConditionListConditionListConditionOrTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionOrTest.java new file mode 100644 index 00000000..862643ec --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListConditionListConditionOrTest.java @@ -0,0 +1,59 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionListConditionListConditionOr; +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 ConditionItemConditionListConditionListConditionOr model. + */ +public class ConditionItemConditionListConditionListConditionOrTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConditionItemConditionListConditionListConditionOr() throws Throwable { + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(conditionItemModel.description(), "testString"); + assertEquals(conditionItemModel.property(), "testString"); + assertEquals(conditionItemModel.operator(), "string_equals"); + assertEquals(conditionItemModel.value(), "testString"); + + ConditionItemConditionListConditionListConditionOr conditionItemConditionListConditionListConditionOrModel = new ConditionItemConditionListConditionListConditionOr.Builder() + .description("testString") + .or(java.util.Arrays.asList(conditionItemModel)) + .build(); + assertEquals(conditionItemConditionListConditionListConditionOrModel.description(), "testString"); + assertEquals(conditionItemConditionListConditionListConditionOrModel.or(), java.util.Arrays.asList(conditionItemModel)); + + String json = TestUtilities.serialize(conditionItemConditionListConditionListConditionOrModel); + + ConditionItemConditionListConditionListConditionOr conditionItemConditionListConditionListConditionOrModelNew = TestUtilities.deserialize(json, ConditionItemConditionListConditionListConditionOr.class); + assertTrue(conditionItemConditionListConditionListConditionOrModelNew instanceof ConditionItemConditionListConditionListConditionOr); + assertEquals(conditionItemConditionListConditionListConditionOrModelNew.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/ConditionItemConditionListTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListTest.java new file mode 100644 index 00000000..e497b207 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionListTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItemConditionList; +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 ConditionItemConditionList model. + */ +public class ConditionItemConditionListTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testConditionItemConditionList() throws Throwable { + ConditionItemConditionList conditionItemConditionListModel = new ConditionItemConditionList(); + assertNotNull(conditionItemConditionListModel); + } +} \ 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/ConditionItemConditionSubRuleConditionSubRuleConditionAllIfTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAllIfTest.java new file mode 100644 index 00000000..749f6e8e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAllIfTest.java @@ -0,0 +1,75 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionSubRuleConditionSubRuleConditionAllIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 ConditionItemConditionSubRuleConditionSubRuleConditionAllIf model. + */ +public class ConditionItemConditionSubRuleConditionSubRuleConditionAllIfTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConditionItemConditionSubRuleConditionSubRuleConditionAllIf() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + SubRule subRuleModel = new SubRule.Builder() + .target(ruleTargetModel) + .build(); + assertEquals(subRuleModel.target(), ruleTargetModel); + + ConditionItemConditionSubRuleConditionSubRuleConditionAllIf conditionItemConditionSubRuleConditionSubRuleConditionAllIfModel = new ConditionItemConditionSubRuleConditionSubRuleConditionAllIf.Builder() + .allIfexists(subRuleModel) + .build(); + assertEquals(conditionItemConditionSubRuleConditionSubRuleConditionAllIfModel.allIfexists(), subRuleModel); + + String json = TestUtilities.serialize(conditionItemConditionSubRuleConditionSubRuleConditionAllIfModel); + + ConditionItemConditionSubRuleConditionSubRuleConditionAllIf conditionItemConditionSubRuleConditionSubRuleConditionAllIfModelNew = TestUtilities.deserialize(json, ConditionItemConditionSubRuleConditionSubRuleConditionAllIf.class); + assertTrue(conditionItemConditionSubRuleConditionSubRuleConditionAllIfModelNew instanceof ConditionItemConditionSubRuleConditionSubRuleConditionAllIf); + assertEquals(conditionItemConditionSubRuleConditionSubRuleConditionAllIfModelNew.allIfexists().toString(), subRuleModel.toString()); + } +} \ 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/ConditionItemConditionSubRuleConditionSubRuleConditionAllTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAllTest.java new file mode 100644 index 00000000..c0c5f1a7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAllTest.java @@ -0,0 +1,75 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionSubRuleConditionSubRuleConditionAll; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 ConditionItemConditionSubRuleConditionSubRuleConditionAll model. + */ +public class ConditionItemConditionSubRuleConditionSubRuleConditionAllTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConditionItemConditionSubRuleConditionSubRuleConditionAll() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + SubRule subRuleModel = new SubRule.Builder() + .target(ruleTargetModel) + .build(); + assertEquals(subRuleModel.target(), ruleTargetModel); + + ConditionItemConditionSubRuleConditionSubRuleConditionAll conditionItemConditionSubRuleConditionSubRuleConditionAllModel = new ConditionItemConditionSubRuleConditionSubRuleConditionAll.Builder() + .all(subRuleModel) + .build(); + assertEquals(conditionItemConditionSubRuleConditionSubRuleConditionAllModel.all(), subRuleModel); + + String json = TestUtilities.serialize(conditionItemConditionSubRuleConditionSubRuleConditionAllModel); + + ConditionItemConditionSubRuleConditionSubRuleConditionAll conditionItemConditionSubRuleConditionSubRuleConditionAllModelNew = TestUtilities.deserialize(json, ConditionItemConditionSubRuleConditionSubRuleConditionAll.class); + assertTrue(conditionItemConditionSubRuleConditionSubRuleConditionAllModelNew instanceof ConditionItemConditionSubRuleConditionSubRuleConditionAll); + assertEquals(conditionItemConditionSubRuleConditionSubRuleConditionAllModelNew.all().toString(), subRuleModel.toString()); + } +} \ 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/ConditionItemConditionSubRuleConditionSubRuleConditionAnyIfTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAnyIfTest.java new file mode 100644 index 00000000..4d820090 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAnyIfTest.java @@ -0,0 +1,75 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf model. + */ +public class ConditionItemConditionSubRuleConditionSubRuleConditionAnyIfTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConditionItemConditionSubRuleConditionSubRuleConditionAnyIf() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + SubRule subRuleModel = new SubRule.Builder() + .target(ruleTargetModel) + .build(); + assertEquals(subRuleModel.target(), ruleTargetModel); + + ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf conditionItemConditionSubRuleConditionSubRuleConditionAnyIfModel = new ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf.Builder() + .anyIfexists(subRuleModel) + .build(); + assertEquals(conditionItemConditionSubRuleConditionSubRuleConditionAnyIfModel.anyIfexists(), subRuleModel); + + String json = TestUtilities.serialize(conditionItemConditionSubRuleConditionSubRuleConditionAnyIfModel); + + ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf conditionItemConditionSubRuleConditionSubRuleConditionAnyIfModelNew = TestUtilities.deserialize(json, ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf.class); + assertTrue(conditionItemConditionSubRuleConditionSubRuleConditionAnyIfModelNew instanceof ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf); + assertEquals(conditionItemConditionSubRuleConditionSubRuleConditionAnyIfModelNew.anyIfexists().toString(), subRuleModel.toString()); + } +} \ 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/ConditionItemConditionSubRuleConditionSubRuleConditionAnyTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAnyTest.java new file mode 100644 index 00000000..3c5686e9 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleConditionSubRuleConditionAnyTest.java @@ -0,0 +1,75 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionSubRuleConditionSubRuleConditionAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 ConditionItemConditionSubRuleConditionSubRuleConditionAny model. + */ +public class ConditionItemConditionSubRuleConditionSubRuleConditionAnyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConditionItemConditionSubRuleConditionSubRuleConditionAny() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + SubRule subRuleModel = new SubRule.Builder() + .target(ruleTargetModel) + .build(); + assertEquals(subRuleModel.target(), ruleTargetModel); + + ConditionItemConditionSubRuleConditionSubRuleConditionAny conditionItemConditionSubRuleConditionSubRuleConditionAnyModel = new ConditionItemConditionSubRuleConditionSubRuleConditionAny.Builder() + .any(subRuleModel) + .build(); + assertEquals(conditionItemConditionSubRuleConditionSubRuleConditionAnyModel.any(), subRuleModel); + + String json = TestUtilities.serialize(conditionItemConditionSubRuleConditionSubRuleConditionAnyModel); + + ConditionItemConditionSubRuleConditionSubRuleConditionAny conditionItemConditionSubRuleConditionSubRuleConditionAnyModelNew = TestUtilities.deserialize(json, ConditionItemConditionSubRuleConditionSubRuleConditionAny.class); + assertTrue(conditionItemConditionSubRuleConditionSubRuleConditionAnyModelNew instanceof ConditionItemConditionSubRuleConditionSubRuleConditionAny); + assertEquals(conditionItemConditionSubRuleConditionSubRuleConditionAnyModelNew.any().toString(), subRuleModel.toString()); + } +} \ 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/ConditionItemConditionSubRuleTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleTest.java new file mode 100644 index 00000000..15faa6c2 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemConditionSubRuleTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionSubRule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 ConditionItemConditionSubRule model. + */ +public class ConditionItemConditionSubRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testConditionItemConditionSubRule() throws Throwable { + ConditionItemConditionSubRule conditionItemConditionSubRuleModel = new ConditionItemConditionSubRule(); + assertNotNull(conditionItemConditionSubRuleModel); + } +} \ 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/ProviderTypeInstanceAttributesTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemTest.java similarity index 74% rename from modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributesTest.java rename to modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemTest.java index ed4a99d0..735dba9e 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributesTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConditionItemTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -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.ProviderTypeInstanceAttributes; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConditionItem; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -23,15 +23,16 @@ import static org.testng.Assert.*; /** - * Unit test class for the ProviderTypeInstanceAttributes model. + * Unit test class for the ConditionItem model. */ -public class ProviderTypeInstanceAttributesTest { +public class ConditionItemTest { final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + // TODO: Add tests for models that are abstract @Test - public void testProviderTypeInstanceAttributes() throws Throwable { - ProviderTypeInstanceAttributes providerTypeInstanceAttributesModel = new ProviderTypeInstanceAttributes(); - assertNotNull(providerTypeInstanceAttributesModel); + public void testConditionItem() throws Throwable { + ConditionItem conditionItemModel = new ConditionItem(); + assertNotNull(conditionItemModel); } } \ 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/ConfigurationInformationPointsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConfigurationInformationPointsTest.java new file mode 100644 index 00000000..e61f20a7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ConfigurationInformationPointsTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConfigurationInformationPoints; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Endpoint; +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 ConfigurationInformationPoints model. + */ +public class ConfigurationInformationPointsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testConfigurationInformationPoints() throws Throwable { + ConfigurationInformationPoints configurationInformationPointsModel = new ConfigurationInformationPoints(); + assertNull(configurationInformationPointsModel.getType()); + assertNull(configurationInformationPointsModel.getEndpoints()); + } +} \ 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/ControlChangesTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesTest.java new file mode 100644 index 00000000..2a427700 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesTest.java @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlChanges; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlChangesUpdated; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; +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 ControlChanges model. + */ +public class ControlChangesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlChanges() throws Throwable { + ControlChanges controlChangesModel = new ControlChanges(); + assertNull(controlChangesModel.getTotalAdded()); + assertNull(controlChangesModel.getTotalRemoved()); + assertNull(controlChangesModel.getTotalUpdated()); + assertNull(controlChangesModel.getAdded()); + assertNull(controlChangesModel.getRemoved()); + assertNull(controlChangesModel.getUpdated()); + } +} \ 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/ControlChangesUpdatedTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesUpdatedTest.java new file mode 100644 index 00000000..990cba9f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlChangesUpdatedTest.java @@ -0,0 +1,43 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlChangesUpdated; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; +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 ControlChangesUpdated model. + */ +public class ControlChangesUpdatedTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlChangesUpdated() throws Throwable { + ControlChangesUpdated controlChangesUpdatedModel = new ControlChangesUpdated(); + assertNull(controlChangesUpdatedModel.getCurrent()); + assertNull(controlChangesUpdatedModel.getLatest()); + } +} \ 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/ControlDocTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlDocTest.java new file mode 100644 index 00000000..7d510a3b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlDocTest.java @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ControlDoc; +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 ControlDoc model. + */ +public class ControlDocTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlDoc() throws Throwable { + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + assertEquals(controlDocModel.controlDocsId(), "testString"); + assertEquals(controlDocModel.controlDocsType(), "testString"); + + String json = TestUtilities.serialize(controlDocModel); + + ControlDoc controlDocModelNew = TestUtilities.deserialize(json, ControlDoc.class); + assertTrue(controlDocModelNew instanceof ControlDoc); + assertEquals(controlDocModelNew.controlDocsId(), "testString"); + assertEquals(controlDocModelNew.controlDocsType(), "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/ControlLibraryCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryCollectionTest.java index 9df39838..57c181f8 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryCollectionTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlLibraryCollectionTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,10 +15,15 @@ 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.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Control; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrary; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibraryItem; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PaginatedCollectionFirst; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PaginatedCollectionNext; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +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.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -36,8 +41,8 @@ public class ControlLibraryCollectionTest { @Test public void testControlLibraryCollection() throws Throwable { ControlLibraryCollection controlLibraryCollectionModel = new ControlLibraryCollection(); - assertNull(controlLibraryCollectionModel.getTotalCount()); assertNull(controlLibraryCollectionModel.getLimit()); + assertNull(controlLibraryCollectionModel.getTotalCount()); assertNull(controlLibraryCollectionModel.getFirst()); assertNull(controlLibraryCollectionModel.getNext()); assertNull(controlLibraryCollectionModel.getControlLibraries()); 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 bc0314f1..daf4266b 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,13 +14,12 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; 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.ControlDocs; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Control; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrary; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecifications; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlsInControlLib; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Implementation; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -37,134 +36,22 @@ public class ControlLibraryTest { @Test public void testControlLibrary() throws Throwable { - ParameterInfo parameterInfoModel = new ParameterInfo.Builder() - .parameterName("parameter_name") - .parameterDisplayName("parameter_display_name") - .parameterType("string") - .parameterValue("public") - .build(); - assertEquals(parameterInfoModel.parameterName(), "parameter_name"); - assertEquals(parameterInfoModel.parameterDisplayName(), "parameter_display_name"); - assertEquals(parameterInfoModel.parameterType(), "string"); - assertEquals(parameterInfoModel.parameterValue(), "public"); - - Implementation implementationModel = new Implementation.Builder() - .assessmentId("assessment_id") - .assessmentMethod("assessment_method") - .assessmentType("assessment_type") - .assessmentDescription("assessment_description") - .parameterCount(Long.valueOf("5")) - .parameters(java.util.Arrays.asList(parameterInfoModel)) - .build(); - assertEquals(implementationModel.assessmentId(), "assessment_id"); - assertEquals(implementationModel.assessmentMethod(), "assessment_method"); - assertEquals(implementationModel.assessmentType(), "assessment_type"); - assertEquals(implementationModel.assessmentDescription(), "assessment_description"); - assertEquals(implementationModel.parameterCount(), Long.valueOf("5")); - assertEquals(implementationModel.parameters(), java.util.Arrays.asList(parameterInfoModel)); - - ControlSpecifications controlSpecificationsModel = new ControlSpecifications.Builder() - .controlSpecificationId("f3517159-889e-4781-819a-89d89b747c85") - .responsibility("user") - .componentId("f3517159-889e-4781-819a-89d89b747c85") - .componentName("component_name") - .environment("environment") - .controlSpecificationDescription("control_specification_description") - .assessmentsCount(Long.valueOf("1")) - .assessments(java.util.Arrays.asList(implementationModel)) - .build(); - assertEquals(controlSpecificationsModel.controlSpecificationId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModel.responsibility(), "user"); - assertEquals(controlSpecificationsModel.componentId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModel.componentName(), "component_name"); - assertEquals(controlSpecificationsModel.environment(), "environment"); - assertEquals(controlSpecificationsModel.controlSpecificationDescription(), "control_specification_description"); - assertEquals(controlSpecificationsModel.assessmentsCount(), Long.valueOf("1")); - assertEquals(controlSpecificationsModel.assessments(), java.util.Arrays.asList(implementationModel)); - - ControlDocs controlDocsModel = new ControlDocs.Builder() - .controlDocsId("control_docs_id") - .controlDocsType("control_docs_type") - .build(); - assertEquals(controlDocsModel.controlDocsId(), "control_docs_id"); - assertEquals(controlDocsModel.controlDocsType(), "control_docs_type"); - - ControlsInControlLib controlsInControlLibModel = new ControlsInControlLib.Builder() - .controlName("control_name") - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") - .controlDescription("control_description") - .controlCategory("control_category") - .controlParent("control_parent") - .controlTags(java.util.Arrays.asList("control_tags", "control_tags", "control_tags", "control_tags", "control_tags")) - .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) - .controlDocs(controlDocsModel) - .controlRequirement(true) - .status("enabled") - .build(); - assertEquals(controlsInControlLibModel.controlName(), "control_name"); - assertEquals(controlsInControlLibModel.controlId(), "1fa45e17-9322-4e6c-bbd6-1c51db08e790"); - assertEquals(controlsInControlLibModel.controlDescription(), "control_description"); - assertEquals(controlsInControlLibModel.controlCategory(), "control_category"); - assertEquals(controlsInControlLibModel.controlParent(), "control_parent"); - assertEquals(controlsInControlLibModel.controlTags(), java.util.Arrays.asList("control_tags", "control_tags", "control_tags", "control_tags", "control_tags")); - assertEquals(controlsInControlLibModel.controlSpecifications(), java.util.Arrays.asList(controlSpecificationsModel)); - assertEquals(controlsInControlLibModel.controlDocs(), controlDocsModel); - assertEquals(controlsInControlLibModel.controlRequirement(), Boolean.valueOf(true)); - assertEquals(controlsInControlLibModel.status(), "enabled"); - - ControlLibrary controlLibraryModel = new ControlLibrary.Builder() - .id("f3517159-889e-4781-819a-89d89b747c85") - .accountId("130003ea8bfa43c5aacea07a86da3000") - .controlLibraryName("testString") - .controlLibraryDescription("testString") - .controlLibraryType("predefined") - .versionGroupLabel("e0923045-f00d-44de-b49b-6f1f0e8033cc") - .controlLibraryVersion("testString") - .createdOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .createdBy("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .updatedBy("testString") - .latest(true) - .hierarchyEnabled(true) - .controlsCount(Long.valueOf("26")) - .controlParentsCount(Long.valueOf("26")) - .controls(java.util.Arrays.asList(controlsInControlLibModel)) - .build(); - assertEquals(controlLibraryModel.id(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlLibraryModel.accountId(), "130003ea8bfa43c5aacea07a86da3000"); - assertEquals(controlLibraryModel.controlLibraryName(), "testString"); - assertEquals(controlLibraryModel.controlLibraryDescription(), "testString"); - assertEquals(controlLibraryModel.controlLibraryType(), "predefined"); - assertEquals(controlLibraryModel.versionGroupLabel(), "e0923045-f00d-44de-b49b-6f1f0e8033cc"); - assertEquals(controlLibraryModel.controlLibraryVersion(), "testString"); - assertEquals(controlLibraryModel.createdOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(controlLibraryModel.createdBy(), "testString"); - assertEquals(controlLibraryModel.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(controlLibraryModel.updatedBy(), "testString"); - assertEquals(controlLibraryModel.latest(), Boolean.valueOf(true)); - assertEquals(controlLibraryModel.hierarchyEnabled(), Boolean.valueOf(true)); - assertEquals(controlLibraryModel.controlsCount(), Long.valueOf("26")); - assertEquals(controlLibraryModel.controlParentsCount(), Long.valueOf("26")); - assertEquals(controlLibraryModel.controls(), java.util.Arrays.asList(controlsInControlLibModel)); - - String json = TestUtilities.serialize(controlLibraryModel); - - ControlLibrary controlLibraryModelNew = TestUtilities.deserialize(json, ControlLibrary.class); - assertTrue(controlLibraryModelNew instanceof ControlLibrary); - assertEquals(controlLibraryModelNew.id(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlLibraryModelNew.accountId(), "130003ea8bfa43c5aacea07a86da3000"); - assertEquals(controlLibraryModelNew.controlLibraryName(), "testString"); - assertEquals(controlLibraryModelNew.controlLibraryDescription(), "testString"); - assertEquals(controlLibraryModelNew.controlLibraryType(), "predefined"); - assertEquals(controlLibraryModelNew.versionGroupLabel(), "e0923045-f00d-44de-b49b-6f1f0e8033cc"); - assertEquals(controlLibraryModelNew.controlLibraryVersion(), "testString"); - assertEquals(controlLibraryModelNew.createdOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(controlLibraryModelNew.createdBy(), "testString"); - assertEquals(controlLibraryModelNew.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(controlLibraryModelNew.updatedBy(), "testString"); - assertEquals(controlLibraryModelNew.latest(), Boolean.valueOf(true)); - assertEquals(controlLibraryModelNew.hierarchyEnabled(), Boolean.valueOf(true)); - assertEquals(controlLibraryModelNew.controlsCount(), Long.valueOf("26")); - assertEquals(controlLibraryModelNew.controlParentsCount(), Long.valueOf("26")); + ControlLibrary controlLibraryModel = new ControlLibrary(); + assertNull(controlLibraryModel.getControlLibraryName()); + assertNull(controlLibraryModel.getControlLibraryDescription()); + assertNull(controlLibraryModel.getControlLibraryType()); + assertNull(controlLibraryModel.getControlLibraryVersion()); + assertNull(controlLibraryModel.getControls()); + assertNull(controlLibraryModel.getId()); + assertNull(controlLibraryModel.getAccountId()); + assertNull(controlLibraryModel.getVersionGroupLabel()); + assertNull(controlLibraryModel.isLatest()); + assertNull(controlLibraryModel.getCreatedBy()); + assertNull(controlLibraryModel.getCreatedOn()); + assertNull(controlLibraryModel.getUpdatedBy()); + assertNull(controlLibraryModel.getUpdatedOn()); + assertNull(controlLibraryModel.isHierarchyEnabled()); + assertNull(controlLibraryModel.getControlsCount()); + assertNull(controlLibraryModel.getControlParentsCount()); } } \ 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/ControlPrototypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlPrototypeTest.java new file mode 100644 index 00000000..749291d6 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlPrototypeTest.java @@ -0,0 +1,101 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.AssessmentPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationPrototype; +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 ControlPrototype model. + */ +public class ControlPrototypeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlPrototype() throws Throwable { + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("testString") + .assessmentDescription("testString") + .build(); + assertEquals(assessmentPrototypeModel.assessmentId(), "testString"); + assertEquals(assessmentPrototypeModel.assessmentDescription(), "testString"); + + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("testString") + .environment("ibm-cloud") + .controlSpecificationId("testString") + .controlSpecificationDescription("testString") + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) + .build(); + assertEquals(controlSpecificationPrototypeModel.componentId(), "testString"); + assertEquals(controlSpecificationPrototypeModel.environment(), "ibm-cloud"); + assertEquals(controlSpecificationPrototypeModel.controlSpecificationId(), "testString"); + assertEquals(controlSpecificationPrototypeModel.controlSpecificationDescription(), "testString"); + assertEquals(controlSpecificationPrototypeModel.assessments(), java.util.Arrays.asList(assessmentPrototypeModel)); + + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + assertEquals(controlDocModel.controlDocsId(), "testString"); + assertEquals(controlDocModel.controlDocsType(), "testString"); + + ControlPrototype controlPrototypeModel = new ControlPrototype.Builder() + .controlName("testString") + .controlDescription("testString") + .controlCategory("testString") + .controlRequirement(true) + .controlParent("testString") + .controlSpecifications(java.util.Arrays.asList(controlSpecificationPrototypeModel)) + .controlDocs(controlDocModel) + .status("testString") + .build(); + assertEquals(controlPrototypeModel.controlName(), "testString"); + assertEquals(controlPrototypeModel.controlDescription(), "testString"); + assertEquals(controlPrototypeModel.controlCategory(), "testString"); + assertEquals(controlPrototypeModel.controlRequirement(), Boolean.valueOf(true)); + assertEquals(controlPrototypeModel.controlParent(), "testString"); + assertEquals(controlPrototypeModel.controlSpecifications(), java.util.Arrays.asList(controlSpecificationPrototypeModel)); + assertEquals(controlPrototypeModel.controlDocs(), controlDocModel); + assertEquals(controlPrototypeModel.status(), "testString"); + + String json = TestUtilities.serialize(controlPrototypeModel); + + ControlPrototype controlPrototypeModelNew = TestUtilities.deserialize(json, ControlPrototype.class); + assertTrue(controlPrototypeModelNew instanceof ControlPrototype); + assertEquals(controlPrototypeModelNew.controlName(), "testString"); + assertEquals(controlPrototypeModelNew.controlDescription(), "testString"); + assertEquals(controlPrototypeModelNew.controlCategory(), "testString"); + assertEquals(controlPrototypeModelNew.controlRequirement(), Boolean.valueOf(true)); + assertEquals(controlPrototypeModelNew.controlParent(), "testString"); + assertEquals(controlPrototypeModelNew.controlDocs().toString(), controlDocModel.toString()); + assertEquals(controlPrototypeModelNew.status(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testControlPrototypeError() throws Throwable { + new ControlPrototype.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/ControlSpecificationPrototypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationPrototypeTest.java new file mode 100644 index 00000000..bbcd2d4c --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationPrototypeTest.java @@ -0,0 +1,64 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.AssessmentPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationPrototype; +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 ControlSpecificationPrototype model. + */ +public class ControlSpecificationPrototypeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlSpecificationPrototype() throws Throwable { + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("testString") + .assessmentDescription("testString") + .build(); + assertEquals(assessmentPrototypeModel.assessmentId(), "testString"); + assertEquals(assessmentPrototypeModel.assessmentDescription(), "testString"); + + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("testString") + .environment("ibm-cloud") + .controlSpecificationId("testString") + .controlSpecificationDescription("testString") + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) + .build(); + assertEquals(controlSpecificationPrototypeModel.componentId(), "testString"); + assertEquals(controlSpecificationPrototypeModel.environment(), "ibm-cloud"); + assertEquals(controlSpecificationPrototypeModel.controlSpecificationId(), "testString"); + assertEquals(controlSpecificationPrototypeModel.controlSpecificationDescription(), "testString"); + assertEquals(controlSpecificationPrototypeModel.assessments(), java.util.Arrays.asList(assessmentPrototypeModel)); + + String json = TestUtilities.serialize(controlSpecificationPrototypeModel); + + ControlSpecificationPrototype controlSpecificationPrototypeModelNew = TestUtilities.deserialize(json, ControlSpecificationPrototype.class); + assertTrue(controlSpecificationPrototypeModelNew instanceof ControlSpecificationPrototype); + assertEquals(controlSpecificationPrototypeModelNew.componentId(), "testString"); + assertEquals(controlSpecificationPrototypeModelNew.environment(), "ibm-cloud"); + assertEquals(controlSpecificationPrototypeModelNew.controlSpecificationId(), "testString"); + assertEquals(controlSpecificationPrototypeModelNew.controlSpecificationDescription(), "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/ControlSpecificationTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationTest.java new file mode 100644 index 00000000..97b578f0 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationTest.java @@ -0,0 +1,106 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +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 ControlSpecification model. + */ +public class ControlSpecificationTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlSpecification() throws Throwable { + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); + + Assessment assessmentModel = new Assessment.Builder() + .assessmentId("382c2b06-e6b2-43ee-b189-c1c7743b67ee") + .assessmentType("ibm-cloud-rule") + .assessmentMethod("ibm-cloud-rule") + .assessmentDescription("Check whether Cloud Object Storage is accessible only by using private endpoints") + .parameterCount(Long.valueOf("1")) + .parameters(java.util.Arrays.asList(parameterModel)) + .build(); + assertEquals(assessmentModel.assessmentId(), "382c2b06-e6b2-43ee-b189-c1c7743b67ee"); + assertEquals(assessmentModel.assessmentType(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentMethod(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentDescription(), "Check whether Cloud Object Storage is accessible only by using private endpoints"); + assertEquals(assessmentModel.parameterCount(), Long.valueOf("1")); + assertEquals(assessmentModel.parameters(), java.util.Arrays.asList(parameterModel)); + + ControlSpecification controlSpecificationModel = new ControlSpecification.Builder() + .id("testString") + .responsibility("testString") + .componentId("testString") + .componentName("testString") + .componentType("testString") + .environment("testString") + .description("testString") + .assessmentsCount(Long.valueOf("26")) + .assessments(java.util.Arrays.asList(assessmentModel)) + .build(); + assertEquals(controlSpecificationModel.id(), "testString"); + assertEquals(controlSpecificationModel.responsibility(), "testString"); + assertEquals(controlSpecificationModel.componentId(), "testString"); + assertEquals(controlSpecificationModel.componentName(), "testString"); + assertEquals(controlSpecificationModel.componentType(), "testString"); + assertEquals(controlSpecificationModel.environment(), "testString"); + assertEquals(controlSpecificationModel.description(), "testString"); + assertEquals(controlSpecificationModel.assessmentsCount(), Long.valueOf("26")); + assertEquals(controlSpecificationModel.assessments(), java.util.Arrays.asList(assessmentModel)); + + String json = TestUtilities.serialize(controlSpecificationModel); + + ControlSpecification controlSpecificationModelNew = TestUtilities.deserialize(json, ControlSpecification.class); + assertTrue(controlSpecificationModelNew instanceof ControlSpecification); + assertEquals(controlSpecificationModelNew.id(), "testString"); + assertEquals(controlSpecificationModelNew.responsibility(), "testString"); + assertEquals(controlSpecificationModelNew.componentId(), "testString"); + assertEquals(controlSpecificationModelNew.componentName(), "testString"); + assertEquals(controlSpecificationModelNew.componentType(), "testString"); + assertEquals(controlSpecificationModelNew.environment(), "testString"); + assertEquals(controlSpecificationModelNew.description(), "testString"); + assertEquals(controlSpecificationModelNew.assessmentsCount(), Long.valueOf("26")); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testControlSpecificationError() throws Throwable { + new ControlSpecification.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/ControlSpecificationWithStatsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationWithStatsTest.java index a273dee5..0d957677 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationWithStatsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSpecificationWithStatsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,9 +14,9 @@ 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.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AssessmentWithStats; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationWithStats; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -35,8 +35,9 @@ public class ControlSpecificationWithStatsTest { public void testControlSpecificationWithStats() throws Throwable { ControlSpecificationWithStats controlSpecificationWithStatsModel = new ControlSpecificationWithStats(); assertNull(controlSpecificationWithStatsModel.getControlSpecificationId()); - assertNull(controlSpecificationWithStatsModel.getComponentId()); assertNull(controlSpecificationWithStatsModel.getControlSpecificationDescription()); + assertNull(controlSpecificationWithStatsModel.getComponentId()); + assertNull(controlSpecificationWithStatsModel.getComponentName()); assertNull(controlSpecificationWithStatsModel.getEnvironment()); assertNull(controlSpecificationWithStatsModel.getResponsibility()); assertNull(controlSpecificationWithStatsModel.getAssessments()); @@ -46,5 +47,6 @@ public void testControlSpecificationWithStats() throws Throwable { assertNull(controlSpecificationWithStatsModel.getNotCompliantCount()); assertNull(controlSpecificationWithStatsModel.getUnableToPerformCount()); assertNull(controlSpecificationWithStatsModel.getUserEvaluationRequiredCount()); + assertNull(controlSpecificationWithStatsModel.getNotApplicableCount()); } } \ 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/ControlSummaryTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSummaryTest.java new file mode 100644 index 00000000..61e4aee1 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlSummaryTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ControlSummary; +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 ControlSummary model. + */ +public class ControlSummaryTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControlSummary() throws Throwable { + ControlSummary controlSummaryModel = new ControlSummary(); + assertNull(controlSummaryModel.getId()); + assertNull(controlSummaryModel.getControlName()); + assertNull(controlSummaryModel.getControlDescription()); + } +} \ 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/ControlTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlTest.java new file mode 100644 index 00000000..86163909 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlTest.java @@ -0,0 +1,50 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Control; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +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 Control model. + */ +public class ControlTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testControl() throws Throwable { + Control controlModel = new Control(); + assertNull(controlModel.getControlName()); + assertNull(controlModel.getControlId()); + assertNull(controlModel.getControlDescription()); + assertNull(controlModel.getControlCategory()); + assertNull(controlModel.getControlParent()); + assertNull(controlModel.getControlSeverity()); + assertNull(controlModel.getControlTags()); + assertNull(controlModel.getControlSpecifications()); + assertNull(controlModel.getControlDocs()); + assertNull(controlModel.getStatus()); + } +} \ 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/ControlWithStatsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlWithStatsTest.java index a3ab9c7c..f0548155 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlWithStatsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ControlWithStatsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,10 +14,11 @@ 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.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AssessmentWithStats; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationWithStats; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlWithStats; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -35,19 +36,22 @@ public class ControlWithStatsTest { @Test public void testControlWithStats() throws Throwable { ControlWithStats controlWithStatsModel = new ControlWithStats(); + assertNull(controlWithStatsModel.getReportId()); + assertNull(controlWithStatsModel.getHomeAccountId()); assertNull(controlWithStatsModel.getId()); assertNull(controlWithStatsModel.getControlLibraryId()); assertNull(controlWithStatsModel.getControlLibraryVersion()); assertNull(controlWithStatsModel.getControlName()); assertNull(controlWithStatsModel.getControlDescription()); assertNull(controlWithStatsModel.getControlCategory()); - assertNull(controlWithStatsModel.getControlPath()); assertNull(controlWithStatsModel.getControlSpecifications()); + assertNull(controlWithStatsModel.getResourceTags()); assertNull(controlWithStatsModel.getStatus()); assertNull(controlWithStatsModel.getTotalCount()); assertNull(controlWithStatsModel.getCompliantCount()); assertNull(controlWithStatsModel.getNotCompliantCount()); assertNull(controlWithStatsModel.getUnableToPerformCount()); assertNull(controlWithStatsModel.getUserEvaluationRequiredCount()); + assertNull(controlWithStatsModel.getNotApplicableCount()); } } \ 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/CreateControlLibraryOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateControlLibraryOptionsTest.java new file mode 100644 index 00000000..156d956b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateControlLibraryOptionsTest.java @@ -0,0 +1,107 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.AssessmentPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateControlLibraryOptions; +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 CreateControlLibraryOptions model. + */ +public class CreateControlLibraryOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateControlLibraryOptions() throws Throwable { + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() + .assessmentId("testString") + .assessmentDescription("testString") + .build(); + assertEquals(assessmentPrototypeModel.assessmentId(), "testString"); + assertEquals(assessmentPrototypeModel.assessmentDescription(), "testString"); + + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("testString") + .environment("ibm-cloud") + .controlSpecificationId("testString") + .controlSpecificationDescription("testString") + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) + .build(); + assertEquals(controlSpecificationPrototypeModel.componentId(), "testString"); + assertEquals(controlSpecificationPrototypeModel.environment(), "ibm-cloud"); + assertEquals(controlSpecificationPrototypeModel.controlSpecificationId(), "testString"); + assertEquals(controlSpecificationPrototypeModel.controlSpecificationDescription(), "testString"); + assertEquals(controlSpecificationPrototypeModel.assessments(), java.util.Arrays.asList(assessmentPrototypeModel)); + + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + assertEquals(controlDocModel.controlDocsId(), "testString"); + assertEquals(controlDocModel.controlDocsType(), "testString"); + + ControlPrototype controlPrototypeModel = new ControlPrototype.Builder() + .controlName("testString") + .controlDescription("testString") + .controlCategory("testString") + .controlRequirement(true) + .controlParent("testString") + .controlSpecifications(java.util.Arrays.asList(controlSpecificationPrototypeModel)) + .controlDocs(controlDocModel) + .status("testString") + .build(); + assertEquals(controlPrototypeModel.controlName(), "testString"); + assertEquals(controlPrototypeModel.controlDescription(), "testString"); + assertEquals(controlPrototypeModel.controlCategory(), "testString"); + assertEquals(controlPrototypeModel.controlRequirement(), Boolean.valueOf(true)); + assertEquals(controlPrototypeModel.controlParent(), "testString"); + assertEquals(controlPrototypeModel.controlSpecifications(), java.util.Arrays.asList(controlSpecificationPrototypeModel)); + assertEquals(controlPrototypeModel.controlDocs(), controlDocModel); + assertEquals(controlPrototypeModel.status(), "testString"); + + CreateControlLibraryOptions createControlLibraryOptionsModel = new CreateControlLibraryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryName("testString") + .controlLibraryDescription("testString") + .controlLibraryType("custom") + .controlLibraryVersion("testString") + .controls(java.util.Arrays.asList(controlPrototypeModel)) + .accountId("testString") + .build(); + assertEquals(createControlLibraryOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(createControlLibraryOptionsModel.controlLibraryName(), "testString"); + assertEquals(createControlLibraryOptionsModel.controlLibraryDescription(), "testString"); + assertEquals(createControlLibraryOptionsModel.controlLibraryType(), "custom"); + assertEquals(createControlLibraryOptionsModel.controlLibraryVersion(), "testString"); + assertEquals(createControlLibraryOptionsModel.controls(), java.util.Arrays.asList(controlPrototypeModel)); + assertEquals(createControlLibraryOptionsModel.accountId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateControlLibraryOptionsError() throws Throwable { + new CreateControlLibraryOptions.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/CreateProfileAttachmentOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileAttachmentOptionsTest.java new file mode 100644 index 00000000..95b525ec --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileAttachmentOptionsTest.java @@ -0,0 +1,120 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileAttachmentOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DateRange; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadById; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentBase; +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 CreateProfileAttachmentOptions model. + */ +public class CreateProfileAttachmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateProfileAttachmentOptions() throws Throwable { + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); + + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList("testString")) + .build(); + assertEquals(attachmentNotificationsControlsModel.thresholdLimit(), Long.valueOf("15")); + assertEquals(attachmentNotificationsControlsModel.failedControlIds(), java.util.Arrays.asList("testString")); + + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() + .enabled(true) + .controls(attachmentNotificationsControlsModel) + .build(); + assertEquals(attachmentNotificationsModel.enabled(), Boolean.valueOf(true)); + assertEquals(attachmentNotificationsModel.controls(), attachmentNotificationsControlsModel); + + MultiCloudScopePayloadById multiCloudScopePayloadModel = new MultiCloudScopePayloadById.Builder() + .id("testString") + .build(); + assertEquals(multiCloudScopePayloadModel.id(), "testString"); + + DateRange dateRangeModel = new DateRange.Builder() + .startDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .endDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .build(); + assertEquals(dateRangeModel.startDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); + assertEquals(dateRangeModel.endDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); + + ProfileAttachmentBase profileAttachmentBaseModel = new ProfileAttachmentBase.Builder() + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .description("testString") + .name("testString") + .notifications(attachmentNotificationsModel) + .schedule("daily") + .scope(java.util.Arrays.asList(multiCloudScopePayloadModel)) + .status("enabled") + .dataSelectionRange(dateRangeModel) + .build(); + assertEquals(profileAttachmentBaseModel.attachmentParameters(), java.util.Arrays.asList(parameterModel)); + assertEquals(profileAttachmentBaseModel.description(), "testString"); + assertEquals(profileAttachmentBaseModel.name(), "testString"); + assertEquals(profileAttachmentBaseModel.notifications(), attachmentNotificationsModel); + assertEquals(profileAttachmentBaseModel.schedule(), "daily"); + assertEquals(profileAttachmentBaseModel.scope(), java.util.Arrays.asList(multiCloudScopePayloadModel)); + assertEquals(profileAttachmentBaseModel.status(), "enabled"); + assertEquals(profileAttachmentBaseModel.dataSelectionRange(), dateRangeModel); + + CreateProfileAttachmentOptions createProfileAttachmentOptionsModel = new CreateProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .newAttachments(java.util.Arrays.asList(profileAttachmentBaseModel)) + .newProfileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .accountId("testString") + .build(); + assertEquals(createProfileAttachmentOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(createProfileAttachmentOptionsModel.profileId(), "9c265b4a-4cdf-47f1-acd3-17b5808f7f3f"); + assertEquals(createProfileAttachmentOptionsModel.newAttachments(), java.util.Arrays.asList(profileAttachmentBaseModel)); + assertEquals(createProfileAttachmentOptionsModel.newProfileId(), "9c265b4a-4cdf-47f1-acd3-17b5808f7f3f"); + assertEquals(createProfileAttachmentOptionsModel.accountId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateProfileAttachmentOptionsError() throws Throwable { + new CreateProfileAttachmentOptions.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/CreateProfileOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileOptionsTest.java index 1974da03..fa97edd9 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProfileOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,7 +15,7 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateProfileOptions; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParameters; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControlsPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -34,43 +34,47 @@ public class CreateProfileOptionsTest { @Test public void testCreateProfileOptions() throws Throwable { ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() - .controlLibraryId("e98a56ff-dc24-41d4-9875-1e188e2da6cd") - .controlId("5C453578-E9A1-421E-AD0F-C6AFCDD67CCF") + .controlLibraryId("testString") + .controlId("testString") .build(); - assertEquals(profileControlsPrototypeModel.controlLibraryId(), "e98a56ff-dc24-41d4-9875-1e188e2da6cd"); - assertEquals(profileControlsPrototypeModel.controlId(), "5C453578-E9A1-421E-AD0F-C6AFCDD67CCF"); + assertEquals(profileControlsPrototypeModel.controlLibraryId(), "testString"); + assertEquals(profileControlsPrototypeModel.controlId(), "testString"); - DefaultParametersPrototype defaultParametersPrototypeModel = new DefaultParametersPrototype.Builder() + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() .assessmentType("testString") .assessmentId("testString") .parameterName("testString") .parameterDefaultValue("testString") .parameterDisplayName("testString") - .parameterType("string") + .parameterType("testString") .build(); - assertEquals(defaultParametersPrototypeModel.assessmentType(), "testString"); - assertEquals(defaultParametersPrototypeModel.assessmentId(), "testString"); - assertEquals(defaultParametersPrototypeModel.parameterName(), "testString"); - assertEquals(defaultParametersPrototypeModel.parameterDefaultValue(), "testString"); - assertEquals(defaultParametersPrototypeModel.parameterDisplayName(), "testString"); - assertEquals(defaultParametersPrototypeModel.parameterType(), "string"); + assertEquals(defaultParametersModel.assessmentType(), "testString"); + assertEquals(defaultParametersModel.assessmentId(), "testString"); + assertEquals(defaultParametersModel.parameterName(), "testString"); + assertEquals(defaultParametersModel.parameterDefaultValue(), "testString"); + assertEquals(defaultParametersModel.parameterDisplayName(), "testString"); + assertEquals(defaultParametersModel.parameterType(), "testString"); CreateProfileOptions createProfileOptionsModel = new CreateProfileOptions.Builder() - .profileName("testString") - .profileDescription("testString") - .profileType("predefined") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileName("Sample Profile") + .profileVersion("0.0.1") .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) - .defaultParameters(java.util.Arrays.asList(defaultParametersPrototypeModel)) - .xCorrelationId("testString") - .xRequestId("testString") + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .profileDescription("This is a sample profile") + .latest(true) + .versionGroupLabel("testString") + .accountId("testString") .build(); - assertEquals(createProfileOptionsModel.profileName(), "testString"); - assertEquals(createProfileOptionsModel.profileDescription(), "testString"); - assertEquals(createProfileOptionsModel.profileType(), "predefined"); + assertEquals(createProfileOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(createProfileOptionsModel.profileName(), "Sample Profile"); + assertEquals(createProfileOptionsModel.profileVersion(), "0.0.1"); assertEquals(createProfileOptionsModel.controls(), java.util.Arrays.asList(profileControlsPrototypeModel)); - assertEquals(createProfileOptionsModel.defaultParameters(), java.util.Arrays.asList(defaultParametersPrototypeModel)); - assertEquals(createProfileOptionsModel.xCorrelationId(), "testString"); - assertEquals(createProfileOptionsModel.xRequestId(), "testString"); + assertEquals(createProfileOptionsModel.defaultParameters(), java.util.Arrays.asList(defaultParametersModel)); + assertEquals(createProfileOptionsModel.profileDescription(), "This is a sample profile"); + assertEquals(createProfileOptionsModel.latest(), Boolean.valueOf(true)); + assertEquals(createProfileOptionsModel.versionGroupLabel(), "testString"); + assertEquals(createProfileOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProviderTypeInstanceOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProviderTypeInstanceOptionsTest.java index 3500cb9d..8f130d91 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProviderTypeInstanceOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateProviderTypeInstanceOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,17 +32,15 @@ public class CreateProviderTypeInstanceOptionsTest { @Test public void testCreateProviderTypeInstanceOptions() throws Throwable { CreateProviderTypeInstanceOptions createProviderTypeInstanceOptionsModel = new CreateProviderTypeInstanceOptions.Builder() - .providerTypeId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .name("workload-protection-instance-1") .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) - .xCorrelationId("testString") - .xRequestId("testString") .build(); - assertEquals(createProviderTypeInstanceOptionsModel.providerTypeId(), "testString"); + assertEquals(createProviderTypeInstanceOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(createProviderTypeInstanceOptionsModel.providerTypeId(), "3e25966275dccfa2c3a34786919c5af7"); assertEquals(createProviderTypeInstanceOptionsModel.name(), "workload-protection-instance-1"); assertEquals(createProviderTypeInstanceOptionsModel.attributes(), java.util.Collections.singletonMap("anyKey", "anyValue")); - assertEquals(createProviderTypeInstanceOptionsModel.xCorrelationId(), "testString"); - assertEquals(createProviderTypeInstanceOptionsModel.xRequestId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) 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 0c9b6890..f26955bc 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -17,11 +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.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.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.model.RequiredConfigConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleParameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTargetPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -47,74 +45,58 @@ public void testCreateRuleOptions() throws Throwable { assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); assertEquals(additionalTargetAttributeModel.value(), "testString"); - TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() + RuleTargetPrototype ruleTargetPrototypeModel = new RuleTargetPrototype.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)); + assertEquals(ruleTargetPrototypeModel.serviceName(), "testString"); + assertEquals(ruleTargetPrototypeModel.resourceKind(), "testString"); + assertEquals(ruleTargetPrototypeModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); - RequiredConfigBase requiredConfigBaseModel = new RequiredConfigBase.Builder() + RequiredConfigConditionBase requiredConfigModel = new RequiredConfigConditionBase.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 requiredConfigModel = new RequiredConfigAnd.Builder() - .description("testString") - .and(java.util.Arrays.asList(requiredConfigItemsModel)) - .build(); assertEquals(requiredConfigModel.description(), "testString"); - assertEquals(requiredConfigModel.and(), java.util.Arrays.asList(requiredConfigItemsModel)); + assertEquals(requiredConfigModel.property(), "testString"); + assertEquals(requiredConfigModel.operator(), "string_equals"); + assertEquals(requiredConfigModel.value(), "testString"); - Parameter parameterModel = new Parameter.Builder() + RuleParameter ruleParameterModel = new RuleParameter.Builder() .name("testString") .displayName("testString") .description("testString") .type("string") .build(); - assertEquals(parameterModel.name(), "testString"); - assertEquals(parameterModel.displayName(), "testString"); - assertEquals(parameterModel.description(), "testString"); - assertEquals(parameterModel.type(), "string"); + assertEquals(ruleParameterModel.name(), "testString"); + assertEquals(ruleParameterModel.displayName(), "testString"); + assertEquals(ruleParameterModel.description(), "testString"); + assertEquals(ruleParameterModel.type(), "string"); Import importModel = new Import.Builder() - .parameters(java.util.Arrays.asList(parameterModel)) + .parameters(java.util.Arrays.asList(ruleParameterModel)) .build(); - assertEquals(importModel.parameters(), java.util.Arrays.asList(parameterModel)); + assertEquals(importModel.parameters(), java.util.Arrays.asList(ruleParameterModel)); CreateRuleOptions createRuleOptionsModel = new CreateRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .description("testString") - .target(targetPrototypeModel) + .target(ruleTargetPrototypeModel) .requiredConfig(requiredConfigModel) .version("testString") .xImport(importModel) .labels(java.util.Arrays.asList("testString")) - .xCorrelationId("testString") - .xRequestId("testString") .build(); + assertEquals(createRuleOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(createRuleOptionsModel.description(), "testString"); - assertEquals(createRuleOptionsModel.target(), targetPrototypeModel); + assertEquals(createRuleOptionsModel.target(), ruleTargetPrototypeModel); assertEquals(createRuleOptionsModel.requiredConfig(), requiredConfigModel); assertEquals(createRuleOptionsModel.version(), "testString"); assertEquals(createRuleOptionsModel.xImport(), importModel); assertEquals(createRuleOptionsModel.labels(), java.util.Arrays.asList("testString")); - assertEquals(createRuleOptionsModel.xCorrelationId(), "testString"); - assertEquals(createRuleOptionsModel.xRequestId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanOptionsTest.java index dde38056..5809c4dc 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,13 @@ public class CreateScanOptionsTest { @Test public void testCreateScanOptions() throws Throwable { CreateScanOptions createScanOptionsModel = new CreateScanOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .attachmentId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .accountId("testString") .build(); + assertEquals(createScanOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(createScanOptionsModel.attachmentId(), "testString"); - assertEquals(createScanOptionsModel.xCorrelationId(), "testString"); - assertEquals(createScanOptionsModel.xRequestId(), "testString"); + assertEquals(createScanOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportOptionsTest.java new file mode 100644 index 00000000..befa2591 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.CreateScanReportOptions; +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 CreateScanReportOptions model. + */ +public class CreateScanReportOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateScanReportOptions() throws Throwable { + CreateScanReportOptions createScanReportOptionsModel = new CreateScanReportOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId("testString") + .format("csv") + .scopeId("testString") + .subscopeId("testString") + .build(); + assertEquals(createScanReportOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(createScanReportOptionsModel.reportId(), "testString"); + assertEquals(createScanReportOptionsModel.format(), "csv"); + assertEquals(createScanReportOptionsModel.scopeId(), "testString"); + assertEquals(createScanReportOptionsModel.subscopeId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateScanReportOptionsError() throws Throwable { + new CreateScanReportOptions.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/CreateScanReportTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportTest.java new file mode 100644 index 00000000..a59fb1e5 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanReportTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.CreateScanReport; +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 CreateScanReport model. + */ +public class CreateScanReportTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateScanReport() throws Throwable { + CreateScanReport createScanReportModel = new CreateScanReport(); + assertNull(createScanReportModel.getId()); + } +} \ 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/CreateScanResponseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanResponseTest.java new file mode 100644 index 00000000..1c4693e2 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScanResponseTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.CreateScanResponse; +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 CreateScanResponse model. + */ +public class CreateScanResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateScanResponse() throws Throwable { + CreateScanResponse createScanResponseModel = new CreateScanResponse(); + assertNull(createScanResponseModel.getId()); + assertNull(createScanResponseModel.getAccountId()); + assertNull(createScanResponseModel.getAttachmentId()); + assertNull(createScanResponseModel.getReportId()); + assertNull(createScanResponseModel.getStatus()); + assertNull(createScanResponseModel.getLastScanTime()); + assertNull(createScanResponseModel.getNextScanTime()); + assertNull(createScanResponseModel.getScanType()); + assertNull(createScanResponseModel.getOccurence()); + } +} \ 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/CreateScopeOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScopeOptionsTest.java new file mode 100644 index 00000000..ce6c1dbf --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateScopeOptionsTest.java @@ -0,0 +1,61 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.CreateScopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +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 CreateScopeOptions model. + */ +public class CreateScopeOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateScopeOptions() throws Throwable { + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(scopePropertyModel.name(), "testString"); + assertEquals(scopePropertyModel.value(), "testString"); + + CreateScopeOptions createScopeOptionsModel = new CreateScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .name("testString") + .description("testString") + .environment("testString") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) + .build(); + assertEquals(createScopeOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(createScopeOptionsModel.name(), "testString"); + assertEquals(createScopeOptionsModel.description(), "testString"); + assertEquals(createScopeOptionsModel.environment(), "testString"); + assertEquals(createScopeOptionsModel.xProperties(), java.util.Arrays.asList(scopePropertyModel)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateScopeOptionsError() throws Throwable { + new CreateScopeOptions.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/CreateSubscopeOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateSubscopeOptionsTest.java new file mode 100644 index 00000000..a80e2167 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateSubscopeOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.CreateSubscopeOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePrototype; +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 CreateSubscopeOptions model. + */ +public class CreateSubscopeOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateSubscopeOptions() throws Throwable { + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(scopePropertyModel.name(), "testString"); + assertEquals(scopePropertyModel.value(), "testString"); + + ScopePrototype scopePrototypeModel = new ScopePrototype.Builder() + .name("testString") + .description("testString") + .environment("testString") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) + .build(); + assertEquals(scopePrototypeModel.name(), "testString"); + assertEquals(scopePrototypeModel.description(), "testString"); + assertEquals(scopePrototypeModel.environment(), "testString"); + assertEquals(scopePrototypeModel.xProperties(), java.util.Arrays.asList(scopePropertyModel)); + + CreateSubscopeOptions createSubscopeOptionsModel = new CreateSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopes(java.util.Arrays.asList(scopePrototypeModel)) + .build(); + assertEquals(createSubscopeOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(createSubscopeOptionsModel.scopeId(), "testString"); + assertEquals(createSubscopeOptionsModel.subscopes(), java.util.Arrays.asList(scopePrototypeModel)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateSubscopeOptionsError() throws Throwable { + new CreateSubscopeOptions.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/CreateTargetOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateTargetOptionsTest.java new file mode 100644 index 00000000..663f1991 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CreateTargetOptionsTest.java @@ -0,0 +1,121 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CreateTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Credential; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Resource; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; +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 CreateTargetOptions model. + */ +public class CreateTargetOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCreateTargetOptions() throws Throwable { + Account accountModel = new Account.Builder() + .id("531fc3e28bfc43c5a2cea07786d93f5c") + .name("NIST") + .type("account_type") + .build(); + assertEquals(accountModel.id(), "531fc3e28bfc43c5a2cea07786d93f5c"); + assertEquals(accountModel.name(), "NIST"); + assertEquals(accountModel.type(), "account_type"); + + Tags tagsModel = new Tags.Builder() + .user(java.util.Arrays.asList("testString")) + .access(java.util.Arrays.asList("testString")) + .service(java.util.Arrays.asList("testString")) + .build(); + assertEquals(tagsModel.user(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.access(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.service(), java.util.Arrays.asList("testString")); + + Resource resourceModel = new Resource.Builder() + .reportId("30b434b3-cb08-4845-af10-7a8fc682b6a8") + .homeAccountId("2411ffdc16844b07b42521c3443f456d") + .id("crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::") + .resourceName("jeff's key") + .account(accountModel) + .componentId("cloud-object_storage") + .componentName("cloud-object_storage") + .environment("ibm cloud") + .tags(tagsModel) + .status("compliant") + .totalCount(Long.valueOf("140")) + .passCount(Long.valueOf("123")) + .failureCount(Long.valueOf("12")) + .errorCount(Long.valueOf("5")) + .skippedCount(Long.valueOf("7")) + .completedCount(Long.valueOf("135")) + .serviceName("pm-20") + .instanceCrn("testString") + .build(); + assertEquals(resourceModel.reportId(), "30b434b3-cb08-4845-af10-7a8fc682b6a8"); + assertEquals(resourceModel.homeAccountId(), "2411ffdc16844b07b42521c3443f456d"); + assertEquals(resourceModel.id(), "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::"); + assertEquals(resourceModel.resourceName(), "jeff's key"); + assertEquals(resourceModel.account(), accountModel); + assertEquals(resourceModel.componentId(), "cloud-object_storage"); + assertEquals(resourceModel.componentName(), "cloud-object_storage"); + assertEquals(resourceModel.environment(), "ibm cloud"); + assertEquals(resourceModel.tags(), tagsModel); + assertEquals(resourceModel.status(), "compliant"); + assertEquals(resourceModel.totalCount(), Long.valueOf("140")); + assertEquals(resourceModel.passCount(), Long.valueOf("123")); + assertEquals(resourceModel.failureCount(), Long.valueOf("12")); + assertEquals(resourceModel.errorCount(), Long.valueOf("5")); + assertEquals(resourceModel.skippedCount(), Long.valueOf("7")); + assertEquals(resourceModel.completedCount(), Long.valueOf("135")); + assertEquals(resourceModel.serviceName(), "pm-20"); + assertEquals(resourceModel.instanceCrn(), "testString"); + + Credential credentialModel = new Credential.Builder() + .secretCrn("dummy") + .resources(java.util.Arrays.asList(resourceModel)) + .build(); + assertEquals(credentialModel.secretCrn(), "dummy"); + assertEquals(credentialModel.resources(), java.util.Arrays.asList(resourceModel)); + + CreateTargetOptions createTargetOptionsModel = new CreateTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("be200c80cabc456e91139e4152327823") + .trustedProfileId("Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3") + .name("Sample Target Name") + .credentials(java.util.Arrays.asList(credentialModel)) + .build(); + assertEquals(createTargetOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(createTargetOptionsModel.accountId(), "be200c80cabc456e91139e4152327823"); + assertEquals(createTargetOptionsModel.trustedProfileId(), "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3"); + assertEquals(createTargetOptionsModel.name(), "Sample Target Name"); + assertEquals(createTargetOptionsModel.credentials(), java.util.Arrays.asList(credentialModel)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCreateTargetOptionsError() throws Throwable { + new CreateTargetOptions.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/CredentialResponseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialResponseTest.java new file mode 100644 index 00000000..d50c5326 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialResponseTest.java @@ -0,0 +1,43 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CredentialResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Resource; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; +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 CredentialResponse model. + */ +public class CredentialResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCredentialResponse() throws Throwable { + CredentialResponse credentialResponseModel = new CredentialResponse(); + assertNull(credentialResponseModel.getType()); + assertNull(credentialResponseModel.getSecretCrn()); + assertNull(credentialResponseModel.getSecretName()); + assertNull(credentialResponseModel.getResources()); + } +} \ 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/CredentialTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialTest.java new file mode 100644 index 00000000..e6544b83 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/CredentialTest.java @@ -0,0 +1,113 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Credential; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Resource; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; +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 Credential model. + */ +public class CredentialTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testCredential() throws Throwable { + Account accountModel = new Account.Builder() + .id("531fc3e28bfc43c5a2cea07786d93f5c") + .name("NIST") + .type("account_type") + .build(); + assertEquals(accountModel.id(), "531fc3e28bfc43c5a2cea07786d93f5c"); + assertEquals(accountModel.name(), "NIST"); + assertEquals(accountModel.type(), "account_type"); + + Tags tagsModel = new Tags.Builder() + .user(java.util.Arrays.asList("testString")) + .access(java.util.Arrays.asList("testString")) + .service(java.util.Arrays.asList("testString")) + .build(); + assertEquals(tagsModel.user(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.access(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.service(), java.util.Arrays.asList("testString")); + + Resource resourceModel = new Resource.Builder() + .reportId("30b434b3-cb08-4845-af10-7a8fc682b6a8") + .homeAccountId("2411ffdc16844b07b42521c3443f456d") + .id("crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::") + .resourceName("jeff's key") + .account(accountModel) + .componentId("cloud-object_storage") + .componentName("cloud-object_storage") + .environment("ibm cloud") + .tags(tagsModel) + .status("compliant") + .totalCount(Long.valueOf("140")) + .passCount(Long.valueOf("123")) + .failureCount(Long.valueOf("12")) + .errorCount(Long.valueOf("5")) + .skippedCount(Long.valueOf("7")) + .completedCount(Long.valueOf("135")) + .serviceName("pm-20") + .instanceCrn("testString") + .build(); + assertEquals(resourceModel.reportId(), "30b434b3-cb08-4845-af10-7a8fc682b6a8"); + assertEquals(resourceModel.homeAccountId(), "2411ffdc16844b07b42521c3443f456d"); + assertEquals(resourceModel.id(), "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::"); + assertEquals(resourceModel.resourceName(), "jeff's key"); + assertEquals(resourceModel.account(), accountModel); + assertEquals(resourceModel.componentId(), "cloud-object_storage"); + assertEquals(resourceModel.componentName(), "cloud-object_storage"); + assertEquals(resourceModel.environment(), "ibm cloud"); + assertEquals(resourceModel.tags(), tagsModel); + assertEquals(resourceModel.status(), "compliant"); + assertEquals(resourceModel.totalCount(), Long.valueOf("140")); + assertEquals(resourceModel.passCount(), Long.valueOf("123")); + assertEquals(resourceModel.failureCount(), Long.valueOf("12")); + assertEquals(resourceModel.errorCount(), Long.valueOf("5")); + assertEquals(resourceModel.skippedCount(), Long.valueOf("7")); + assertEquals(resourceModel.completedCount(), Long.valueOf("135")); + assertEquals(resourceModel.serviceName(), "pm-20"); + assertEquals(resourceModel.instanceCrn(), "testString"); + + Credential credentialModel = new Credential.Builder() + .secretCrn("testString") + .resources(java.util.Arrays.asList(resourceModel)) + .build(); + assertEquals(credentialModel.secretCrn(), "testString"); + assertEquals(credentialModel.resources(), java.util.Arrays.asList(resourceModel)); + + String json = TestUtilities.serialize(credentialModel); + + Credential credentialModelNew = TestUtilities.deserialize(json, Credential.class); + assertTrue(credentialModelNew instanceof Credential); + assertEquals(credentialModelNew.secretCrn(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testCredentialError() throws Throwable { + new Credential.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/DateRangeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DateRangeTest.java new file mode 100644 index 00000000..2c002f2f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DateRangeTest.java @@ -0,0 +1,55 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DateRange; +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 DateRange model. + */ +public class DateRangeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDateRange() throws Throwable { + DateRange dateRangeModel = new DateRange.Builder() + .startDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .endDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .build(); + assertEquals(dateRangeModel.startDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); + assertEquals(dateRangeModel.endDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); + + String json = TestUtilities.serialize(dateRangeModel); + + DateRange dateRangeModelNew = TestUtilities.deserialize(json, DateRange.class); + assertTrue(dateRangeModelNew instanceof DateRange); + assertEquals(dateRangeModelNew.startDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); + assertEquals(dateRangeModelNew.endDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDateRangeError() throws Throwable { + new DateRange.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/DefaultParametersChangesTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersChangesTest.java new file mode 100644 index 00000000..3540ff7d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersChangesTest.java @@ -0,0 +1,44 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersChanges; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersDifference; +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 DefaultParametersChanges model. + */ +public class DefaultParametersChangesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDefaultParametersChanges() throws Throwable { + DefaultParametersChanges defaultParametersChangesModel = new DefaultParametersChanges(); + assertNull(defaultParametersChangesModel.getTotalAdded()); + assertNull(defaultParametersChangesModel.getTotalRemoved()); + assertNull(defaultParametersChangesModel.getTotalUpdated()); + assertNull(defaultParametersChangesModel.getAdded()); + assertNull(defaultParametersChangesModel.getRemoved()); + assertNull(defaultParametersChangesModel.getUpdated()); + } +} \ 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/DefaultParametersDifferenceTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersDifferenceTest.java new file mode 100644 index 00000000..4ab48eb0 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersDifferenceTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersDifference; +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 DefaultParametersDifference model. + */ +public class DefaultParametersDifferenceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDefaultParametersDifference() throws Throwable { + DefaultParametersDifference defaultParametersDifferenceModel = new DefaultParametersDifference(); + assertNull(defaultParametersDifferenceModel.getCurrent()); + assertNull(defaultParametersDifferenceModel.getLatest()); + } +} \ 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/DefaultParametersTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersTest.java new file mode 100644 index 00000000..e95e970e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DefaultParametersTest.java @@ -0,0 +1,60 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.DefaultParameters; +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 DefaultParameters model. + */ +public class DefaultParametersTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDefaultParameters() throws Throwable { + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("testString") + .parameterDefaultValue("testString") + .parameterDisplayName("testString") + .parameterType("testString") + .build(); + assertEquals(defaultParametersModel.assessmentType(), "testString"); + assertEquals(defaultParametersModel.assessmentId(), "testString"); + assertEquals(defaultParametersModel.parameterName(), "testString"); + assertEquals(defaultParametersModel.parameterDefaultValue(), "testString"); + assertEquals(defaultParametersModel.parameterDisplayName(), "testString"); + assertEquals(defaultParametersModel.parameterType(), "testString"); + + String json = TestUtilities.serialize(defaultParametersModel); + + DefaultParameters defaultParametersModelNew = TestUtilities.deserialize(json, DefaultParameters.class); + assertTrue(defaultParametersModelNew instanceof DefaultParameters); + assertEquals(defaultParametersModelNew.assessmentType(), "testString"); + assertEquals(defaultParametersModelNew.assessmentId(), "testString"); + assertEquals(defaultParametersModelNew.parameterName(), "testString"); + assertEquals(defaultParametersModelNew.parameterDefaultValue(), "testString"); + assertEquals(defaultParametersModelNew.parameterDisplayName(), "testString"); + assertEquals(defaultParametersModelNew.parameterType(), "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/DeleteCustomControlLibraryOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomControlLibraryOptionsTest.java index 8bff2d40..bd301a37 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomControlLibraryOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteCustomControlLibraryOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,13 @@ public class DeleteCustomControlLibraryOptionsTest { @Test public void testDeleteCustomControlLibraryOptions() throws Throwable { DeleteCustomControlLibraryOptions deleteCustomControlLibraryOptionsModel = new DeleteCustomControlLibraryOptions.Builder() - .controlLibrariesId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId("testString") + .accountId("testString") .build(); - assertEquals(deleteCustomControlLibraryOptionsModel.controlLibrariesId(), "testString"); - assertEquals(deleteCustomControlLibraryOptionsModel.xCorrelationId(), "testString"); - assertEquals(deleteCustomControlLibraryOptionsModel.xRequestId(), "testString"); + assertEquals(deleteCustomControlLibraryOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(deleteCustomControlLibraryOptionsModel.controlLibraryId(), "testString"); + assertEquals(deleteCustomControlLibraryOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) 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 075756e4..1d1560bb 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,13 @@ public class DeleteCustomProfileOptionsTest { @Test public void testDeleteCustomProfileOptions() throws Throwable { DeleteCustomProfileOptions deleteCustomProfileOptionsModel = new DeleteCustomProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .accountId("testString") .build(); + assertEquals(deleteCustomProfileOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(deleteCustomProfileOptionsModel.profileId(), "testString"); - assertEquals(deleteCustomProfileOptionsModel.xCorrelationId(), "testString"); - assertEquals(deleteCustomProfileOptionsModel.xRequestId(), "testString"); + assertEquals(deleteCustomProfileOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) 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 13169d1f..9e100435 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,15 +32,15 @@ public class DeleteProfileAttachmentOptionsTest { @Test public void testDeleteProfileAttachmentOptions() throws Throwable { DeleteProfileAttachmentOptions deleteProfileAttachmentOptionsModel = new DeleteProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") .attachmentId("testString") - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .accountId("testString") .build(); + assertEquals(deleteProfileAttachmentOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(deleteProfileAttachmentOptionsModel.profileId(), "9c265b4a-4cdf-47f1-acd3-17b5808f7f3f"); assertEquals(deleteProfileAttachmentOptionsModel.attachmentId(), "testString"); - assertEquals(deleteProfileAttachmentOptionsModel.profileId(), "testString"); - assertEquals(deleteProfileAttachmentOptionsModel.xCorrelationId(), "testString"); - assertEquals(deleteProfileAttachmentOptionsModel.xRequestId(), "testString"); + assertEquals(deleteProfileAttachmentOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProviderTypeInstanceOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProviderTypeInstanceOptionsTest.java index a162ee44..d73d44b9 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProviderTypeInstanceOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteProviderTypeInstanceOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,15 +32,13 @@ public class DeleteProviderTypeInstanceOptionsTest { @Test public void testDeleteProviderTypeInstanceOptions() throws Throwable { DeleteProviderTypeInstanceOptions deleteProviderTypeInstanceOptionsModel = new DeleteProviderTypeInstanceOptions.Builder() - .providerTypeId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .providerTypeInstanceId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .build(); - assertEquals(deleteProviderTypeInstanceOptionsModel.providerTypeId(), "testString"); + assertEquals(deleteProviderTypeInstanceOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(deleteProviderTypeInstanceOptionsModel.providerTypeId(), "3e25966275dccfa2c3a34786919c5af7"); assertEquals(deleteProviderTypeInstanceOptionsModel.providerTypeInstanceId(), "testString"); - assertEquals(deleteProviderTypeInstanceOptionsModel.xCorrelationId(), "testString"); - assertEquals(deleteProviderTypeInstanceOptionsModel.xRequestId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteRuleOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteRuleOptionsTest.java index b4503675..b081249a 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteRuleOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteRuleOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,11 @@ public class DeleteRuleOptionsTest { @Test public void testDeleteRuleOptions() throws Throwable { DeleteRuleOptions deleteRuleOptionsModel = new DeleteRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .ruleId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .build(); + assertEquals(deleteRuleOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(deleteRuleOptionsModel.ruleId(), "testString"); - assertEquals(deleteRuleOptionsModel.xCorrelationId(), "testString"); - assertEquals(deleteRuleOptionsModel.xRequestId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteScopeOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteScopeOptionsTest.java new file mode 100644 index 00000000..3e02b4b8 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteScopeOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.DeleteScopeOptions; +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 DeleteScopeOptions model. + */ +public class DeleteScopeOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteScopeOptions() throws Throwable { + DeleteScopeOptions deleteScopeOptionsModel = new DeleteScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .build(); + assertEquals(deleteScopeOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(deleteScopeOptionsModel.scopeId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteScopeOptionsError() throws Throwable { + new DeleteScopeOptions.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/DeleteSubscopeOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteSubscopeOptionsTest.java new file mode 100644 index 00000000..e31c7eed --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteSubscopeOptionsTest.java @@ -0,0 +1,49 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.DeleteSubscopeOptions; +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 DeleteSubscopeOptions model. + */ +public class DeleteSubscopeOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteSubscopeOptions() throws Throwable { + DeleteSubscopeOptions deleteSubscopeOptionsModel = new DeleteSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopeId("testString") + .build(); + assertEquals(deleteSubscopeOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(deleteSubscopeOptionsModel.scopeId(), "testString"); + assertEquals(deleteSubscopeOptionsModel.subscopeId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteSubscopeOptionsError() throws Throwable { + new DeleteSubscopeOptions.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/DeleteTargetOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteTargetOptionsTest.java new file mode 100644 index 00000000..882cdeae --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/DeleteTargetOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.DeleteTargetOptions; +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 DeleteTargetOptions model. + */ +public class DeleteTargetOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testDeleteTargetOptions() throws Throwable { + DeleteTargetOptions deleteTargetOptionsModel = new DeleteTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId("testString") + .build(); + assertEquals(deleteTargetOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(deleteTargetOptionsModel.targetId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testDeleteTargetOptionsError() throws Throwable { + new DeleteTargetOptions.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/EndpointTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EndpointTest.java new file mode 100644 index 00000000..a3fce9a4 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EndpointTest.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Endpoint; +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 Endpoint model. + */ +public class EndpointTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEndpoint() throws Throwable { + Endpoint endpointModel = new Endpoint(); + assertNull(endpointModel.getHost()); + assertNull(endpointModel.getPath()); + assertNull(endpointModel.getRegion()); + assertNull(endpointModel.getAdvisoryCallLimit()); + } +} \ 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/EvalStatsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvalStatsTest.java index fffe9fe8..50871ba8 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvalStatsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvalStatsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -37,6 +37,7 @@ public void testEvalStats() throws Throwable { assertNull(evalStatsModel.getPassCount()); assertNull(evalStatsModel.getFailureCount()); assertNull(evalStatsModel.getErrorCount()); + assertNull(evalStatsModel.getSkippedCount()); assertNull(evalStatsModel.getCompletedCount()); } } \ 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/EvaluationDetailsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationDetailsTest.java new file mode 100644 index 00000000..9919949b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationDetailsTest.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.EvaluationDetails; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProviderInfo; +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 EvaluationDetails model. + */ +public class EvaluationDetailsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEvaluationDetails() throws Throwable { + EvaluationDetails evaluationDetailsModel = new EvaluationDetails(); + assertNull(evaluationDetailsModel.getXProperties()); + assertNull(evaluationDetailsModel.getProviderInfo()); + } +} \ 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/EvaluationPageTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPageTest.java index 86d9750c..d5366933 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPageTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPageTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,12 +15,15 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvalDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Evaluation; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationPage; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PageHRef; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Property; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProviderInfo; +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.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -39,13 +42,12 @@ public class EvaluationPageTest { @Test public void testEvaluationPage() throws Throwable { EvaluationPage evaluationPageModel = new EvaluationPage(); - assertNull(evaluationPageModel.getTotalCount()); assertNull(evaluationPageModel.getLimit()); - assertNull(evaluationPageModel.getStart()); + assertNull(evaluationPageModel.getTotalCount()); assertNull(evaluationPageModel.getFirst()); assertNull(evaluationPageModel.getNext()); - assertNull(evaluationPageModel.getHomeAccountId()); assertNull(evaluationPageModel.getReportId()); + assertNull(evaluationPageModel.getHomeAccountId()); assertNull(evaluationPageModel.getEvaluations()); } } \ 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/EvaluationPropertyTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPropertyTest.java new file mode 100644 index 00000000..f8cae292 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationPropertyTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.EvaluationProperty; +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 EvaluationProperty model. + */ +public class EvaluationPropertyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEvaluationProperty() throws Throwable { + EvaluationProperty evaluationPropertyModel = new EvaluationProperty(); + assertNull(evaluationPropertyModel.getProperty()); + assertNull(evaluationPropertyModel.getPropertyDescription()); + assertNull(evaluationPropertyModel.getOperator()); + assertNull(evaluationPropertyModel.getExpectedValue()); + assertNull(evaluationPropertyModel.getFoundValue()); + } +} \ 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/EvaluationProviderInfoTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProviderInfoTest.java new file mode 100644 index 00000000..d2049384 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationProviderInfoTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.EvaluationProviderInfo; +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 EvaluationProviderInfo model. + */ +public class EvaluationProviderInfoTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEvaluationProviderInfo() throws Throwable { + EvaluationProviderInfo evaluationProviderInfoModel = new EvaluationProviderInfo(); + assertNull(evaluationProviderInfoModel.getProviderType()); + } +} \ 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/EvaluationTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationTest.java index e2f0a439..8cfe6232 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EvaluationTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,10 +15,12 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvalDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Evaluation; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Property; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationDetails; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvaluationProviderInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -37,15 +39,16 @@ public class EvaluationTest { @Test public void testEvaluation() throws Throwable { Evaluation evaluationModel = new Evaluation(); - assertNull(evaluationModel.getHomeAccountId()); assertNull(evaluationModel.getReportId()); - assertNull(evaluationModel.getControlId()); + assertNull(evaluationModel.getHomeAccountId()); assertNull(evaluationModel.getComponentId()); + assertNull(evaluationModel.getComponentName()); assertNull(evaluationModel.getAssessment()); assertNull(evaluationModel.getEvaluateTime()); assertNull(evaluationModel.getTarget()); assertNull(evaluationModel.getStatus()); assertNull(evaluationModel.getReason()); assertNull(evaluationModel.getDetails()); + assertNull(evaluationModel.getEvaluatedBy()); } } \ 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/EventNotificationsPrototypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsPrototypeTest.java new file mode 100644 index 00000000..29bc4208 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/EventNotificationsPrototypeTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.EventNotificationsPrototype; +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 EventNotificationsPrototype model. + */ +public class EventNotificationsPrototypeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testEventNotificationsPrototype() throws Throwable { + EventNotificationsPrototype eventNotificationsPrototypeModel = new EventNotificationsPrototype.Builder() + .instanceCrn("testString") + .sourceDescription("This source is used for integration with IBM Cloud Security and Compliance Center.") + .sourceName("compliance") + .build(); + assertEquals(eventNotificationsPrototypeModel.instanceCrn(), "testString"); + assertEquals(eventNotificationsPrototypeModel.sourceDescription(), "This source is used for integration with IBM Cloud Security and Compliance Center."); + assertEquals(eventNotificationsPrototypeModel.sourceName(), "compliance"); + + String json = TestUtilities.serialize(eventNotificationsPrototypeModel); + + EventNotificationsPrototype eventNotificationsPrototypeModelNew = TestUtilities.deserialize(json, EventNotificationsPrototype.class); + assertTrue(eventNotificationsPrototypeModelNew instanceof EventNotificationsPrototype); + assertEquals(eventNotificationsPrototypeModelNew.instanceCrn(), "testString"); + assertEquals(eventNotificationsPrototypeModelNew.sourceDescription(), "This source is used for integration with IBM Cloud Security and Compliance Center."); + assertEquals(eventNotificationsPrototypeModelNew.sourceName(), "compliance"); + } +} \ 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/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 da030a22..1be0a2bc 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,7 +14,6 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; 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.EventNotifications; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -32,27 +31,11 @@ public class EventNotificationsTest { @Test public void testEventNotifications() throws Throwable { - EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .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: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: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: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"); - - String json = TestUtilities.serialize(eventNotificationsModel); - - EventNotifications eventNotificationsModelNew = TestUtilities.deserialize(json, EventNotifications.class); - assertTrue(eventNotificationsModelNew instanceof EventNotifications); - 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: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"); + EventNotifications eventNotificationsModel = new EventNotifications(); + assertNull(eventNotificationsModel.getInstanceCrn()); + assertNull(eventNotificationsModel.getUpdatedOn()); + assertNull(eventNotificationsModel.getSourceId()); + assertNull(eventNotificationsModel.getSourceDescription()); + assertNull(eventNotificationsModel.getSourceName()); } } \ 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/GetControlLibraryOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetControlLibraryOptionsTest.java index 45d00fe6..1bf1e8a1 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetControlLibraryOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetControlLibraryOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,13 @@ public class GetControlLibraryOptionsTest { @Test public void testGetControlLibraryOptions() throws Throwable { GetControlLibraryOptions getControlLibraryOptionsModel = new GetControlLibraryOptions.Builder() - .controlLibrariesId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId("testString") + .accountId("testString") .build(); - assertEquals(getControlLibraryOptionsModel.controlLibrariesId(), "testString"); - assertEquals(getControlLibraryOptionsModel.xCorrelationId(), "testString"); - assertEquals(getControlLibraryOptionsModel.xRequestId(), "testString"); + assertEquals(getControlLibraryOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getControlLibraryOptionsModel.controlLibraryId(), "testString"); + assertEquals(getControlLibraryOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetLatestReportsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetLatestReportsOptionsTest.java index 503bc5ae..4f546fe7 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetLatestReportsOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetLatestReportsOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,12 +32,16 @@ public class GetLatestReportsOptionsTest { @Test public void testGetLatestReportsOptions() throws Throwable { GetLatestReportsOptions getLatestReportsOptionsModel = new GetLatestReportsOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .sort("profile_name") .build(); - assertEquals(getLatestReportsOptionsModel.xCorrelationId(), "testString"); - assertEquals(getLatestReportsOptionsModel.xRequestId(), "testString"); + assertEquals(getLatestReportsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(getLatestReportsOptionsModel.sort(), "profile_name"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetLatestReportsOptionsError() throws Throwable { + new GetLatestReportsOptions.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/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 82b3745f..b190e339 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,15 +32,15 @@ public class GetProfileAttachmentOptionsTest { @Test public void testGetProfileAttachmentOptions() throws Throwable { GetProfileAttachmentOptions getProfileAttachmentOptionsModel = new GetProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") .attachmentId("testString") - .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .accountId("testString") .build(); + assertEquals(getProfileAttachmentOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getProfileAttachmentOptionsModel.profileId(), "9c265b4a-4cdf-47f1-acd3-17b5808f7f3f"); assertEquals(getProfileAttachmentOptionsModel.attachmentId(), "testString"); - assertEquals(getProfileAttachmentOptionsModel.profileId(), "testString"); - assertEquals(getProfileAttachmentOptionsModel.xCorrelationId(), "testString"); - assertEquals(getProfileAttachmentOptionsModel.xRequestId(), "testString"); + assertEquals(getProfileAttachmentOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) 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 058b78a7..efb64b28 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,13 @@ public class GetProfileOptionsTest { @Test public void testGetProfileOptions() throws Throwable { GetProfileOptions getProfileOptionsModel = new GetProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .profileId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .accountId("testString") .build(); + assertEquals(getProfileOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(getProfileOptionsModel.profileId(), "testString"); - assertEquals(getProfileOptionsModel.xCorrelationId(), "testString"); - assertEquals(getProfileOptionsModel.xRequestId(), "testString"); + assertEquals(getProfileOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeByIdOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeByIdOptionsTest.java index 26e7e186..927f9cb5 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeByIdOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeByIdOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,11 @@ public class GetProviderTypeByIdOptionsTest { @Test public void testGetProviderTypeByIdOptions() throws Throwable { GetProviderTypeByIdOptions getProviderTypeByIdOptionsModel = new GetProviderTypeByIdOptions.Builder() - .providerTypeId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .build(); - assertEquals(getProviderTypeByIdOptionsModel.providerTypeId(), "testString"); - assertEquals(getProviderTypeByIdOptionsModel.xCorrelationId(), "testString"); - assertEquals(getProviderTypeByIdOptionsModel.xRequestId(), "testString"); + assertEquals(getProviderTypeByIdOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getProviderTypeByIdOptionsModel.providerTypeId(), "3e25966275dccfa2c3a34786919c5af7"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeInstanceOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeInstanceOptionsTest.java index 0b652942..a38a6ee9 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeInstanceOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetProviderTypeInstanceOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,15 +32,13 @@ public class GetProviderTypeInstanceOptionsTest { @Test public void testGetProviderTypeInstanceOptions() throws Throwable { GetProviderTypeInstanceOptions getProviderTypeInstanceOptionsModel = new GetProviderTypeInstanceOptions.Builder() - .providerTypeId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .providerTypeInstanceId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .build(); - assertEquals(getProviderTypeInstanceOptionsModel.providerTypeId(), "testString"); + assertEquals(getProviderTypeInstanceOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getProviderTypeInstanceOptionsModel.providerTypeId(), "3e25966275dccfa2c3a34786919c5af7"); assertEquals(getProviderTypeInstanceOptionsModel.providerTypeInstanceId(), "testString"); - assertEquals(getProviderTypeInstanceOptionsModel.xCorrelationId(), "testString"); - assertEquals(getProviderTypeInstanceOptionsModel.xRequestId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportControlsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportControlsOptionsTest.java index 324a67d0..20e13fd0 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportControlsOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportControlsOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,25 +32,27 @@ public class GetReportControlsOptionsTest { @Test public void testGetReportControlsOptions() throws Throwable { GetReportControlsOptions getReportControlsOptionsModel = new GetReportControlsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .controlId("testString") .controlName("testString") .controlDescription("testString") .controlCategory("testString") .status("compliant") .sort("control_name") + .scopeId("testString") + .subscopeId("testString") .build(); + assertEquals(getReportControlsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(getReportControlsOptionsModel.reportId(), "testString"); - assertEquals(getReportControlsOptionsModel.xCorrelationId(), "testString"); - assertEquals(getReportControlsOptionsModel.xRequestId(), "testString"); assertEquals(getReportControlsOptionsModel.controlId(), "testString"); assertEquals(getReportControlsOptionsModel.controlName(), "testString"); assertEquals(getReportControlsOptionsModel.controlDescription(), "testString"); assertEquals(getReportControlsOptionsModel.controlCategory(), "testString"); assertEquals(getReportControlsOptionsModel.status(), "compliant"); assertEquals(getReportControlsOptionsModel.sort(), "control_name"); + assertEquals(getReportControlsOptionsModel.scopeId(), "testString"); + assertEquals(getReportControlsOptionsModel.subscopeId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportDownloadFileOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportDownloadFileOptionsTest.java new file mode 100644 index 00000000..eb95e888 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportDownloadFileOptionsTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.GetReportDownloadFileOptions; +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 GetReportDownloadFileOptions model. + */ +public class GetReportDownloadFileOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetReportDownloadFileOptions() throws Throwable { + GetReportDownloadFileOptions getReportDownloadFileOptionsModel = new GetReportDownloadFileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId("testString") + .accept("application/csv") + .excludeSummary(true) + .build(); + assertEquals(getReportDownloadFileOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getReportDownloadFileOptionsModel.reportId(), "testString"); + assertEquals(getReportDownloadFileOptionsModel.accept(), "application/csv"); + assertEquals(getReportDownloadFileOptionsModel.excludeSummary(), Boolean.valueOf(true)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetReportDownloadFileOptionsError() throws Throwable { + new GetReportDownloadFileOptions.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/GetReportOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportOptionsTest.java index 8670660b..88a33353 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -33,12 +33,14 @@ public class GetReportOptionsTest { public void testGetReportOptions() throws Throwable { GetReportOptions getReportOptionsModel = new GetReportOptions.Builder() .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopeId("testString") .build(); assertEquals(getReportOptionsModel.reportId(), "testString"); - assertEquals(getReportOptionsModel.xCorrelationId(), "testString"); - assertEquals(getReportOptionsModel.xRequestId(), "testString"); + assertEquals(getReportOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getReportOptionsModel.scopeId(), "testString"); + assertEquals(getReportOptionsModel.subscopeId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportRuleOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportRuleOptionsTest.java index 3ddde23d..7e3f7f9c 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportRuleOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportRuleOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,15 +32,13 @@ public class GetReportRuleOptionsTest { @Test public void testGetReportRuleOptions() throws Throwable { GetReportRuleOptions getReportRuleOptionsModel = new GetReportRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .ruleId("rule-8d444f8c-fd1d-48de-bcaa-f43732568761") - .xCorrelationId("testString") - .xRequestId("testString") + .ruleId("rule-61fa114a-2bb9-43fd-8068-b873b48bdf79") .build(); + assertEquals(getReportRuleOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(getReportRuleOptionsModel.reportId(), "testString"); - assertEquals(getReportRuleOptionsModel.ruleId(), "rule-8d444f8c-fd1d-48de-bcaa-f43732568761"); - assertEquals(getReportRuleOptionsModel.xCorrelationId(), "testString"); - assertEquals(getReportRuleOptionsModel.xRequestId(), "testString"); + assertEquals(getReportRuleOptionsModel.ruleId(), "rule-61fa114a-2bb9-43fd-8068-b873b48bdf79"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportSummaryOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportSummaryOptionsTest.java index bf54c6f2..6b427114 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportSummaryOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportSummaryOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,11 @@ public class GetReportSummaryOptionsTest { @Test public void testGetReportSummaryOptions() throws Throwable { GetReportSummaryOptions getReportSummaryOptionsModel = new GetReportSummaryOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .build(); + assertEquals(getReportSummaryOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(getReportSummaryOptionsModel.reportId(), "testString"); - assertEquals(getReportSummaryOptionsModel.xCorrelationId(), "testString"); - assertEquals(getReportSummaryOptionsModel.xRequestId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportTagsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportTagsOptionsTest.java index 2cb17407..f4bc6270 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportTagsOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportTagsOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,11 @@ public class GetReportTagsOptionsTest { @Test public void testGetReportTagsOptions() throws Throwable { GetReportTagsOptions getReportTagsOptionsModel = new GetReportTagsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .build(); + assertEquals(getReportTagsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(getReportTagsOptionsModel.reportId(), "testString"); - assertEquals(getReportTagsOptionsModel.xCorrelationId(), "testString"); - assertEquals(getReportTagsOptionsModel.xRequestId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportViolationsDriftOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportViolationsDriftOptionsTest.java index 954c7ab8..607dbf91 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportViolationsDriftOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetReportViolationsDriftOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,15 +32,17 @@ public class GetReportViolationsDriftOptionsTest { @Test public void testGetReportViolationsDriftOptions() throws Throwable { GetReportViolationsDriftOptions getReportViolationsDriftOptionsModel = new GetReportViolationsDriftOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .scanTimeDuration(Long.valueOf("0")) + .scopeId("testString") + .subscopeId("testString") .build(); + assertEquals(getReportViolationsDriftOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(getReportViolationsDriftOptionsModel.reportId(), "testString"); - assertEquals(getReportViolationsDriftOptionsModel.xCorrelationId(), "testString"); - assertEquals(getReportViolationsDriftOptionsModel.xRequestId(), "testString"); assertEquals(getReportViolationsDriftOptionsModel.scanTimeDuration(), Long.valueOf("0")); + assertEquals(getReportViolationsDriftOptionsModel.scopeId(), "testString"); + assertEquals(getReportViolationsDriftOptionsModel.subscopeId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetRuleOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetRuleOptionsTest.java index 3dbde70d..2dd868e4 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetRuleOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetRuleOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,11 @@ public class GetRuleOptionsTest { @Test public void testGetRuleOptions() throws Throwable { GetRuleOptions getRuleOptionsModel = new GetRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .ruleId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .build(); + assertEquals(getRuleOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(getRuleOptionsModel.ruleId(), "testString"); - assertEquals(getRuleOptionsModel.xCorrelationId(), "testString"); - assertEquals(getRuleOptionsModel.xRequestId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportDownloadFileOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportDownloadFileOptionsTest.java new file mode 100644 index 00000000..bd9be4be --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportDownloadFileOptionsTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.GetScanReportDownloadFileOptions; +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 GetScanReportDownloadFileOptions model. + */ +public class GetScanReportDownloadFileOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetScanReportDownloadFileOptions() throws Throwable { + GetScanReportDownloadFileOptions getScanReportDownloadFileOptionsModel = new GetScanReportDownloadFileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId("testString") + .jobId("testString") + .accept("application/csv") + .build(); + assertEquals(getScanReportDownloadFileOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getScanReportDownloadFileOptionsModel.reportId(), "testString"); + assertEquals(getScanReportDownloadFileOptionsModel.jobId(), "testString"); + assertEquals(getScanReportDownloadFileOptionsModel.accept(), "application/csv"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetScanReportDownloadFileOptionsError() throws Throwable { + new GetScanReportDownloadFileOptions.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/GetScanReportOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportOptionsTest.java new file mode 100644 index 00000000..d0e17914 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScanReportOptionsTest.java @@ -0,0 +1,49 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.GetScanReportOptions; +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 GetScanReportOptions model. + */ +public class GetScanReportOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetScanReportOptions() throws Throwable { + GetScanReportOptions getScanReportOptionsModel = new GetScanReportOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId("testString") + .jobId("testString") + .build(); + assertEquals(getScanReportOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getScanReportOptionsModel.reportId(), "testString"); + assertEquals(getScanReportOptionsModel.jobId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetScanReportOptionsError() throws Throwable { + new GetScanReportOptions.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/GetScopeOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScopeOptionsTest.java new file mode 100644 index 00000000..cb11b001 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetScopeOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.GetScopeOptions; +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 GetScopeOptions model. + */ +public class GetScopeOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetScopeOptions() throws Throwable { + GetScopeOptions getScopeOptionsModel = new GetScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .build(); + assertEquals(getScopeOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getScopeOptionsModel.scopeId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetScopeOptionsError() throws Throwable { + new GetScopeOptions.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/GetServiceOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetServiceOptionsTest.java new file mode 100644 index 00000000..6499bbb1 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetServiceOptionsTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.GetServiceOptions; +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 GetServiceOptions model. + */ +public class GetServiceOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetServiceOptions() throws Throwable { + GetServiceOptions getServiceOptionsModel = new GetServiceOptions.Builder() + .servicesName("cloud-object-storage") + .build(); + assertEquals(getServiceOptionsModel.servicesName(), "cloud-object-storage"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetServiceOptionsError() throws Throwable { + new GetServiceOptions.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/GetSettingsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSettingsOptionsTest.java index 83ac7e62..43b16afe 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSettingsOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSettingsOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,10 +32,14 @@ public class GetSettingsOptionsTest { @Test public void testGetSettingsOptions() throws Throwable { GetSettingsOptions getSettingsOptionsModel = new GetSettingsOptions.Builder() - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .build(); - assertEquals(getSettingsOptionsModel.xCorrelationId(), "1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5"); - assertEquals(getSettingsOptionsModel.xRequestId(), "testString"); + assertEquals(getSettingsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSettingsOptionsError() throws Throwable { + new GetSettingsOptions.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/GetSubscopeOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSubscopeOptionsTest.java new file mode 100644 index 00000000..318d2ae6 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetSubscopeOptionsTest.java @@ -0,0 +1,49 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.GetSubscopeOptions; +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 GetSubscopeOptions model. + */ +public class GetSubscopeOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetSubscopeOptions() throws Throwable { + GetSubscopeOptions getSubscopeOptionsModel = new GetSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopeId("testString") + .build(); + assertEquals(getSubscopeOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getSubscopeOptionsModel.scopeId(), "testString"); + assertEquals(getSubscopeOptionsModel.subscopeId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetSubscopeOptionsError() throws Throwable { + new GetSubscopeOptions.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/GetTargetOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetTargetOptionsTest.java new file mode 100644 index 00000000..d07e3426 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/GetTargetOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.GetTargetOptions; +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 GetTargetOptions model. + */ +public class GetTargetOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testGetTargetOptions() throws Throwable { + GetTargetOptions getTargetOptionsModel = new GetTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId("testString") + .build(); + assertEquals(getTargetOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(getTargetOptionsModel.targetId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testGetTargetOptionsError() throws Throwable { + new GetTargetOptions.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/ImportTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ImportTest.java index e318d7c9..a3f65e5a 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ImportTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ImportTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,7 +15,7 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; 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.RuleParameter; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -32,21 +32,21 @@ public class ImportTest { @Test public void testImport() throws Throwable { - Parameter parameterModel = new Parameter.Builder() - .name("name") - .displayName("display_name") - .description("description") + RuleParameter ruleParameterModel = new RuleParameter.Builder() + .name("testString") + .displayName("testString") + .description("testString") .type("string") .build(); - assertEquals(parameterModel.name(), "name"); - assertEquals(parameterModel.displayName(), "display_name"); - assertEquals(parameterModel.description(), "description"); - assertEquals(parameterModel.type(), "string"); + assertEquals(ruleParameterModel.name(), "testString"); + assertEquals(ruleParameterModel.displayName(), "testString"); + assertEquals(ruleParameterModel.description(), "testString"); + assertEquals(ruleParameterModel.type(), "string"); Import importModel = new Import.Builder() - .parameters(java.util.Arrays.asList(parameterModel)) + .parameters(java.util.Arrays.asList(ruleParameterModel)) .build(); - assertEquals(importModel.parameters(), java.util.Arrays.asList(parameterModel)); + assertEquals(importModel.parameters(), java.util.Arrays.asList(ruleParameterModel)); String json = TestUtilities.serialize(importModel); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LabelTypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LabelTypeTest.java index 8e5aa9c2..3188bd8f 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LabelTypeTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LabelTypeTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScanTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScanTest.java index 929a96a5..6154940e 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScanTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScanTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,7 +14,6 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; 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.LastScan; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -32,21 +31,9 @@ public class LastScanTest { @Test public void testLastScan() throws Throwable { - LastScan lastScanModel = new LastScan.Builder() - .id("e8a39d25-0051-4328-8462-988ad321f49a") - .status("in_progress") - .time(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .build(); - assertEquals(lastScanModel.id(), "e8a39d25-0051-4328-8462-988ad321f49a"); - assertEquals(lastScanModel.status(), "in_progress"); - assertEquals(lastScanModel.time(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - - String json = TestUtilities.serialize(lastScanModel); - - LastScan lastScanModelNew = TestUtilities.deserialize(json, LastScan.class); - assertTrue(lastScanModelNew instanceof LastScan); - assertEquals(lastScanModelNew.id(), "e8a39d25-0051-4328-8462-988ad321f49a"); - assertEquals(lastScanModelNew.status(), "in_progress"); - assertEquals(lastScanModelNew.time(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + LastScan lastScanModel = new LastScan(); + assertNull(lastScanModel.getId()); + assertNull(lastScanModel.getStatus()); + assertNull(lastScanModel.getTime()); } } \ 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/LinkTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LinkTest.java new file mode 100644 index 00000000..4d2a079d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LinkTest.java @@ -0,0 +1,38 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Link; +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 Link model. + */ +public class LinkTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testLink() throws Throwable { + Link linkModel = new Link(); + assertNull(linkModel.getDescription()); + assertNull(linkModel.getHref()); + } +} \ 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/ListControlLibrariesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListControlLibrariesOptionsTest.java index 5cc25889..1fbfcc6c 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListControlLibrariesOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListControlLibrariesOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,16 +32,20 @@ public class ListControlLibrariesOptionsTest { @Test public void testListControlLibrariesOptions() throws Throwable { ListControlLibrariesOptions listControlLibrariesOptionsModel = new ListControlLibrariesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") .limit(Long.valueOf("50")) - .controlLibraryType("custom") .start("testString") .build(); - assertEquals(listControlLibrariesOptionsModel.xCorrelationId(), "testString"); - assertEquals(listControlLibrariesOptionsModel.xRequestId(), "testString"); + assertEquals(listControlLibrariesOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listControlLibrariesOptionsModel.accountId(), "testString"); assertEquals(listControlLibrariesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listControlLibrariesOptionsModel.controlLibraryType(), "custom"); assertEquals(listControlLibrariesOptionsModel.start(), "testString"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListControlLibrariesOptionsError() throws Throwable { + new ListControlLibrariesOptions.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/ListInstanceAttachmentsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListInstanceAttachmentsOptionsTest.java new file mode 100644 index 00000000..8e68ecf1 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListInstanceAttachmentsOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ListInstanceAttachmentsOptions; +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 ListInstanceAttachmentsOptions model. + */ +public class ListInstanceAttachmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListInstanceAttachmentsOptions() throws Throwable { + ListInstanceAttachmentsOptions listInstanceAttachmentsOptionsModel = new ListInstanceAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") + .versionGroupLabel("6702d85a-6437-4d6f-8701-c0146648787b") + .limit(Long.valueOf("25")) + .sort("created_on") + .direction("desc") + .start("testString") + .build(); + assertEquals(listInstanceAttachmentsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listInstanceAttachmentsOptionsModel.accountId(), "testString"); + assertEquals(listInstanceAttachmentsOptionsModel.versionGroupLabel(), "6702d85a-6437-4d6f-8701-c0146648787b"); + assertEquals(listInstanceAttachmentsOptionsModel.limit(), Long.valueOf("25")); + assertEquals(listInstanceAttachmentsOptionsModel.sort(), "created_on"); + assertEquals(listInstanceAttachmentsOptionsModel.direction(), "desc"); + assertEquals(listInstanceAttachmentsOptionsModel.start(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListInstanceAttachmentsOptionsError() throws Throwable { + new ListInstanceAttachmentsOptions.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/ListProfileAttachmentsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileAttachmentsOptionsTest.java new file mode 100644 index 00000000..015a4bde --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileAttachmentsOptionsTest.java @@ -0,0 +1,49 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ListProfileAttachmentsOptions; +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 ListProfileAttachmentsOptions model. + */ +public class ListProfileAttachmentsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListProfileAttachmentsOptions() throws Throwable { + ListProfileAttachmentsOptions listProfileAttachmentsOptionsModel = new ListProfileAttachmentsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .accountId("testString") + .build(); + assertEquals(listProfileAttachmentsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listProfileAttachmentsOptionsModel.profileId(), "9c265b4a-4cdf-47f1-acd3-17b5808f7f3f"); + assertEquals(listProfileAttachmentsOptionsModel.accountId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListProfileAttachmentsOptionsError() throws Throwable { + new ListProfileAttachmentsOptions.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/ListProfileParametersOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileParametersOptionsTest.java new file mode 100644 index 00000000..ac69cebf --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfileParametersOptionsTest.java @@ -0,0 +1,47 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ListProfileParametersOptions; +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 ListProfileParametersOptions model. + */ +public class ListProfileParametersOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListProfileParametersOptions() throws Throwable { + ListProfileParametersOptions listProfileParametersOptionsModel = new ListProfileParametersOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("testString") + .build(); + assertEquals(listProfileParametersOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listProfileParametersOptionsModel.profileId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListProfileParametersOptionsError() throws Throwable { + new ListProfileParametersOptions.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/ListProfilesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfilesOptionsTest.java index 9e0e5942..2ede652e 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfilesOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProfilesOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,16 +32,20 @@ public class ListProfilesOptionsTest { @Test public void testListProfilesOptions() throws Throwable { ListProfilesOptions listProfilesOptionsModel = new ListProfilesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .accountId("testString") .limit(Long.valueOf("50")) - .profileType("custom") .start("testString") .build(); - assertEquals(listProfilesOptionsModel.xCorrelationId(), "testString"); - assertEquals(listProfilesOptionsModel.xRequestId(), "testString"); + assertEquals(listProfilesOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listProfilesOptionsModel.accountId(), "testString"); assertEquals(listProfilesOptionsModel.limit(), Long.valueOf("50")); - assertEquals(listProfilesOptionsModel.profileType(), "custom"); assertEquals(listProfilesOptionsModel.start(), "testString"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListProfilesOptionsError() throws Throwable { + new ListProfilesOptions.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/ListProviderTypeInstancesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypeInstancesOptionsTest.java index bac9ea88..bf863cc2 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypeInstancesOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypeInstancesOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,13 +32,11 @@ public class ListProviderTypeInstancesOptionsTest { @Test public void testListProviderTypeInstancesOptions() throws Throwable { ListProviderTypeInstancesOptions listProviderTypeInstancesOptionsModel = new ListProviderTypeInstancesOptions.Builder() - .providerTypeId("testString") - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .build(); - assertEquals(listProviderTypeInstancesOptionsModel.providerTypeId(), "testString"); - assertEquals(listProviderTypeInstancesOptionsModel.xCorrelationId(), "testString"); - assertEquals(listProviderTypeInstancesOptionsModel.xRequestId(), "testString"); + assertEquals(listProviderTypeInstancesOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listProviderTypeInstancesOptionsModel.providerTypeId(), "3e25966275dccfa2c3a34786919c5af7"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypesOptionsTest.java index eb582689..9260a202 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypesOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListProviderTypesOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,10 +32,14 @@ public class ListProviderTypesOptionsTest { @Test public void testListProviderTypesOptions() throws Throwable { ListProviderTypesOptions listProviderTypesOptionsModel = new ListProviderTypesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .build(); - assertEquals(listProviderTypesOptionsModel.xCorrelationId(), "testString"); - assertEquals(listProviderTypesOptionsModel.xRequestId(), "testString"); + assertEquals(listProviderTypesOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListProviderTypesOptionsError() throws Throwable { + new ListProviderTypesOptions.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/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 f39a4cd4..4be88e56 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,9 +32,8 @@ public class ListReportEvaluationsOptionsTest { @Test public void testListReportEvaluationsOptions() throws Throwable { ListReportEvaluationsOptions listReportEvaluationsOptionsModel = new ListReportEvaluationsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .assessmentId("testString") .assessmentMethod("testString") .componentId("testString") @@ -44,10 +43,12 @@ public void testListReportEvaluationsOptions() throws Throwable { .status("failure") .start("testString") .limit(Long.valueOf("50")) + .sort("assessment_id") + .scopeId("testString") + .subscopeId("testString") .build(); + assertEquals(listReportEvaluationsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(listReportEvaluationsOptionsModel.reportId(), "testString"); - assertEquals(listReportEvaluationsOptionsModel.xCorrelationId(), "testString"); - assertEquals(listReportEvaluationsOptionsModel.xRequestId(), "testString"); assertEquals(listReportEvaluationsOptionsModel.assessmentId(), "testString"); assertEquals(listReportEvaluationsOptionsModel.assessmentMethod(), "testString"); assertEquals(listReportEvaluationsOptionsModel.componentId(), "testString"); @@ -57,6 +58,9 @@ public void testListReportEvaluationsOptions() throws Throwable { assertEquals(listReportEvaluationsOptionsModel.status(), "failure"); assertEquals(listReportEvaluationsOptionsModel.start(), "testString"); assertEquals(listReportEvaluationsOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listReportEvaluationsOptionsModel.sort(), "assessment_id"); + assertEquals(listReportEvaluationsOptionsModel.scopeId(), "testString"); + assertEquals(listReportEvaluationsOptionsModel.subscopeId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportResourcesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportResourcesOptionsTest.java index 6b8572d7..7f81a0e0 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportResourcesOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportResourcesOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,9 +32,8 @@ public class ListReportResourcesOptionsTest { @Test public void testListReportResourcesOptions() throws Throwable { ListReportResourcesOptions listReportResourcesOptionsModel = new ListReportResourcesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .reportId("testString") - .xCorrelationId("testString") - .xRequestId("testString") .id("testString") .resourceName("testString") .accountId("testString") @@ -43,10 +42,11 @@ public void testListReportResourcesOptions() throws Throwable { .sort("account_id") .start("testString") .limit(Long.valueOf("50")) + .scopeId("testString") + .subscopeId("testString") .build(); + assertEquals(listReportResourcesOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(listReportResourcesOptionsModel.reportId(), "testString"); - assertEquals(listReportResourcesOptionsModel.xCorrelationId(), "testString"); - assertEquals(listReportResourcesOptionsModel.xRequestId(), "testString"); assertEquals(listReportResourcesOptionsModel.id(), "testString"); assertEquals(listReportResourcesOptionsModel.resourceName(), "testString"); assertEquals(listReportResourcesOptionsModel.accountId(), "testString"); @@ -55,6 +55,8 @@ public void testListReportResourcesOptions() throws Throwable { assertEquals(listReportResourcesOptionsModel.sort(), "account_id"); assertEquals(listReportResourcesOptionsModel.start(), "testString"); assertEquals(listReportResourcesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listReportResourcesOptionsModel.scopeId(), "testString"); + assertEquals(listReportResourcesOptionsModel.subscopeId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportsOptionsTest.java index 64f0f5cf..3ea19028 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportsOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListReportsOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,24 +32,28 @@ public class ListReportsOptionsTest { @Test public void testListReportsOptions() throws Throwable { ListReportsOptions listReportsOptionsModel = new ListReportsOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") - .attachmentId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportAttachmentId("testString") .groupId("testString") - .profileId("testString") + .reportProfileId("testString") .type("scheduled") .start("testString") .limit(Long.valueOf("50")) .sort("profile_name") .build(); - assertEquals(listReportsOptionsModel.xCorrelationId(), "testString"); - assertEquals(listReportsOptionsModel.xRequestId(), "testString"); - assertEquals(listReportsOptionsModel.attachmentId(), "testString"); + assertEquals(listReportsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listReportsOptionsModel.reportAttachmentId(), "testString"); assertEquals(listReportsOptionsModel.groupId(), "testString"); - assertEquals(listReportsOptionsModel.profileId(), "testString"); + assertEquals(listReportsOptionsModel.reportProfileId(), "testString"); assertEquals(listReportsOptionsModel.type(), "scheduled"); assertEquals(listReportsOptionsModel.start(), "testString"); assertEquals(listReportsOptionsModel.limit(), Long.valueOf("50")); assertEquals(listReportsOptionsModel.sort(), "profile_name"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListReportsOptionsError() throws Throwable { + new ListReportsOptions.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/ListRulesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListRulesOptionsTest.java index df8e2e29..86d1cbfc 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListRulesOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListRulesOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,16 +32,26 @@ public class ListRulesOptionsTest { @Test public void testListRulesOptions() throws Throwable { ListRulesOptions listRulesOptionsModel = new ListRulesOptions.Builder() - .xCorrelationId("testString") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("50")) + .start("testString") .type("system_defined") .search("testString") .serviceName("testString") + .sort("updated_on") .build(); - assertEquals(listRulesOptionsModel.xCorrelationId(), "testString"); - assertEquals(listRulesOptionsModel.xRequestId(), "testString"); + assertEquals(listRulesOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listRulesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listRulesOptionsModel.start(), "testString"); assertEquals(listRulesOptionsModel.type(), "system_defined"); assertEquals(listRulesOptionsModel.search(), "testString"); assertEquals(listRulesOptionsModel.serviceName(), "testString"); + assertEquals(listRulesOptionsModel.sort(), "updated_on"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListRulesOptionsError() throws Throwable { + new ListRulesOptions.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/ListScanReportsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScanReportsOptionsTest.java new file mode 100644 index 00000000..5652f78a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScanReportsOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ListScanReportsOptions; +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 ListScanReportsOptions model. + */ +public class ListScanReportsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListScanReportsOptions() throws Throwable { + ListScanReportsOptions listScanReportsOptionsModel = new ListScanReportsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .reportId("testString") + .scopeId("testString") + .subscopeId("testString") + .sort("status") + .build(); + assertEquals(listScanReportsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listScanReportsOptionsModel.reportId(), "testString"); + assertEquals(listScanReportsOptionsModel.scopeId(), "testString"); + assertEquals(listScanReportsOptionsModel.subscopeId(), "testString"); + assertEquals(listScanReportsOptionsModel.sort(), "status"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListScanReportsOptionsError() throws Throwable { + new ListScanReportsOptions.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/ListScopesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScopesOptionsTest.java new file mode 100644 index 00000000..0550a7e1 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListScopesOptionsTest.java @@ -0,0 +1,55 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ListScopesOptions; +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 ListScopesOptions model. + */ +public class ListScopesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListScopesOptions() throws Throwable { + ListScopesOptions listScopesOptionsModel = new ListScopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .limit(Long.valueOf("50")) + .start("testString") + .name("testString") + .description("testString") + .environment("testString") + .build(); + assertEquals(listScopesOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listScopesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listScopesOptionsModel.start(), "testString"); + assertEquals(listScopesOptionsModel.name(), "testString"); + assertEquals(listScopesOptionsModel.description(), "testString"); + assertEquals(listScopesOptionsModel.environment(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListScopesOptionsError() throws Throwable { + new ListScopesOptions.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/ListServicesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListServicesOptionsTest.java new file mode 100644 index 00000000..9d36936f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListServicesOptionsTest.java @@ -0,0 +1,37 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ListServicesOptions; +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 ListServicesOptions model. + */ +public class ListServicesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListServicesOptions() throws Throwable { + ListServicesOptions listServicesOptionsModel = new ListServicesOptions(); + assertNotNull(listServicesOptionsModel); + } +} \ 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/ListSubscopesOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListSubscopesOptionsTest.java new file mode 100644 index 00000000..30d211da --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListSubscopesOptionsTest.java @@ -0,0 +1,57 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ListSubscopesOptions; +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 ListSubscopesOptions model. + */ +public class ListSubscopesOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListSubscopesOptions() throws Throwable { + ListSubscopesOptions listSubscopesOptionsModel = new ListSubscopesOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .limit(Long.valueOf("50")) + .start("testString") + .name("testString") + .description("testString") + .environment("testString") + .build(); + assertEquals(listSubscopesOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(listSubscopesOptionsModel.scopeId(), "testString"); + assertEquals(listSubscopesOptionsModel.limit(), Long.valueOf("50")); + assertEquals(listSubscopesOptionsModel.start(), "testString"); + assertEquals(listSubscopesOptionsModel.name(), "testString"); + assertEquals(listSubscopesOptionsModel.description(), "testString"); + assertEquals(listSubscopesOptionsModel.environment(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListSubscopesOptionsError() throws Throwable { + new ListSubscopesOptions.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/ListTargetsOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListTargetsOptionsTest.java new file mode 100644 index 00000000..e2d76738 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ListTargetsOptionsTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ListTargetsOptions; +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 ListTargetsOptions model. + */ +public class ListTargetsOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testListTargetsOptions() throws Throwable { + ListTargetsOptions listTargetsOptionsModel = new ListTargetsOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .build(); + assertEquals(listTargetsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testListTargetsOptionsError() throws Throwable { + new ListTargetsOptions.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/MultiCloudScopePayloadByIdTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadByIdTest.java new file mode 100644 index 00000000..006b5bfc --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadByIdTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.MultiCloudScopePayloadById; +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 MultiCloudScopePayloadById model. + */ +public class MultiCloudScopePayloadByIdTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testMultiCloudScopePayloadById() throws Throwable { + MultiCloudScopePayloadById multiCloudScopePayloadByIdModel = new MultiCloudScopePayloadById.Builder() + .id("testString") + .build(); + assertEquals(multiCloudScopePayloadByIdModel.id(), "testString"); + + String json = TestUtilities.serialize(multiCloudScopePayloadByIdModel); + + MultiCloudScopePayloadById multiCloudScopePayloadByIdModelNew = TestUtilities.deserialize(json, MultiCloudScopePayloadById.class); + assertTrue(multiCloudScopePayloadByIdModelNew instanceof MultiCloudScopePayloadById); + assertEquals(multiCloudScopePayloadByIdModelNew.id(), "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/MultiCloudScopePayloadByPropertiesTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadByPropertiesTest.java new file mode 100644 index 00000000..2d00be02 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadByPropertiesTest.java @@ -0,0 +1,64 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.MultiCloudScopePayloadByProperties; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +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 MultiCloudScopePayloadByProperties model. + */ +public class MultiCloudScopePayloadByPropertiesTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testMultiCloudScopePayloadByProperties() throws Throwable { + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(scopePropertyModel.name(), "testString"); + assertEquals(scopePropertyModel.value(), "testString"); + + MultiCloudScopePayloadByProperties multiCloudScopePayloadByPropertiesModel = new MultiCloudScopePayloadByProperties.Builder() + .description("testString") + .environment("testString") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) + .build(); + assertEquals(multiCloudScopePayloadByPropertiesModel.description(), "testString"); + assertEquals(multiCloudScopePayloadByPropertiesModel.environment(), "testString"); + assertEquals(multiCloudScopePayloadByPropertiesModel.xProperties(), java.util.Arrays.asList(scopePropertyModel)); + + String json = TestUtilities.serialize(multiCloudScopePayloadByPropertiesModel); + + MultiCloudScopePayloadByProperties multiCloudScopePayloadByPropertiesModelNew = TestUtilities.deserialize(json, MultiCloudScopePayloadByProperties.class); + assertTrue(multiCloudScopePayloadByPropertiesModelNew instanceof MultiCloudScopePayloadByProperties); + assertEquals(multiCloudScopePayloadByPropertiesModelNew.description(), "testString"); + assertEquals(multiCloudScopePayloadByPropertiesModelNew.environment(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testMultiCloudScopePayloadByPropertiesError() throws Throwable { + new MultiCloudScopePayloadByProperties.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/MultiCloudScopePayloadTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadTest.java new file mode 100644 index 00000000..ebd8ba95 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/MultiCloudScopePayloadTest.java @@ -0,0 +1,38 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.MultiCloudScopePayload; +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 MultiCloudScopePayload model. + */ +public class MultiCloudScopePayloadTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testMultiCloudScopePayload() throws Throwable { + MultiCloudScopePayload multiCloudScopePayloadModel = new MultiCloudScopePayload(); + assertNotNull(multiCloudScopePayloadModel); + } +} \ 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/ObjectStoragePrototypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStoragePrototypeTest.java new file mode 100644 index 00000000..655df414 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStoragePrototypeTest.java @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ObjectStoragePrototype; +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 ObjectStoragePrototype model. + */ +public class ObjectStoragePrototypeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testObjectStoragePrototype() throws Throwable { + ObjectStoragePrototype objectStoragePrototypeModel = new ObjectStoragePrototype.Builder() + .bucket("testString") + .instanceCrn("testString") + .build(); + assertEquals(objectStoragePrototypeModel.bucket(), "testString"); + assertEquals(objectStoragePrototypeModel.instanceCrn(), "testString"); + + String json = TestUtilities.serialize(objectStoragePrototypeModel); + + ObjectStoragePrototype objectStoragePrototypeModelNew = TestUtilities.deserialize(json, ObjectStoragePrototype.class); + assertTrue(objectStoragePrototypeModelNew instanceof ObjectStoragePrototype); + assertEquals(objectStoragePrototypeModelNew.bucket(), "testString"); + assertEquals(objectStoragePrototypeModelNew.instanceCrn(), "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/ObjectStorageTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStorageTest.java index daeb0261..9a6c5ecf 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStorageTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ObjectStorageTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,7 +14,6 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; 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.ObjectStorage; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -32,27 +31,11 @@ public class ObjectStorageTest { @Test public void testObjectStorage() throws Throwable { - ObjectStorage objectStorageModel = new ObjectStorage.Builder() - .instanceCrn("testString") - .bucket("testString") - .bucketLocation("testString") - .bucketEndpoint("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .build(); - assertEquals(objectStorageModel.instanceCrn(), "testString"); - assertEquals(objectStorageModel.bucket(), "testString"); - assertEquals(objectStorageModel.bucketLocation(), "testString"); - assertEquals(objectStorageModel.bucketEndpoint(), "testString"); - assertEquals(objectStorageModel.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - - String json = TestUtilities.serialize(objectStorageModel); - - ObjectStorage objectStorageModelNew = TestUtilities.deserialize(json, ObjectStorage.class); - assertTrue(objectStorageModelNew instanceof ObjectStorage); - assertEquals(objectStorageModelNew.instanceCrn(), "testString"); - assertEquals(objectStorageModelNew.bucket(), "testString"); - assertEquals(objectStorageModelNew.bucketLocation(), "testString"); - assertEquals(objectStorageModelNew.bucketEndpoint(), "testString"); - assertEquals(objectStorageModelNew.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + ObjectStorage objectStorageModel = new ObjectStorage(); + assertNull(objectStorageModel.getInstanceCrn()); + assertNull(objectStorageModel.getBucket()); + assertNull(objectStorageModel.getBucketLocation()); + assertNull(objectStorageModel.getBucketEndpoint()); + assertNull(objectStorageModel.getUpdatedOn()); } } \ 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/PageHRefFirstTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefFirstTest.java index 4bfddbc1..ce4232b8 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefFirstTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefFirstTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefNextTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefNextTest.java index 1f9ff849..811c4abf 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefNextTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PageHRefNextTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ParameterTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ParameterTest.java index 63c9f29c..74de8d9a 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ParameterTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ParameterTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,23 +32,29 @@ public class ParameterTest { @Test public void testParameter() throws Throwable { Parameter parameterModel = new Parameter.Builder() - .name("testString") - .displayName("testString") - .description("testString") - .type("string") + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") .build(); - assertEquals(parameterModel.name(), "testString"); - assertEquals(parameterModel.displayName(), "testString"); - assertEquals(parameterModel.description(), "testString"); - assertEquals(parameterModel.type(), "string"); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); String json = TestUtilities.serialize(parameterModel); Parameter parameterModelNew = TestUtilities.deserialize(json, Parameter.class); assertTrue(parameterModelNew instanceof Parameter); - assertEquals(parameterModelNew.name(), "testString"); - assertEquals(parameterModelNew.displayName(), "testString"); - assertEquals(parameterModelNew.description(), "testString"); - assertEquals(parameterModelNew.type(), "string"); + assertEquals(parameterModelNew.assessmentType(), "testString"); + assertEquals(parameterModelNew.assessmentId(), "testString"); + assertEquals(parameterModelNew.parameterName(), "location"); + assertEquals(parameterModelNew.parameterDisplayName(), "Location"); + assertEquals(parameterModelNew.parameterType(), "string"); + assertEquals(parameterModelNew.parameterValue(), "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/PostTestEventOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PostTestEventOptionsTest.java index b299a192..37b30633 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PostTestEventOptionsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/PostTestEventOptionsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,10 +32,14 @@ public class PostTestEventOptionsTest { @Test public void testPostTestEventOptions() throws Throwable { PostTestEventOptions postTestEventOptionsModel = new PostTestEventOptions.Builder() - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .build(); - assertEquals(postTestEventOptionsModel.xCorrelationId(), "1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5"); - assertEquals(postTestEventOptionsModel.xRequestId(), "testString"); + assertEquals(postTestEventOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testPostTestEventOptionsError() throws Throwable { + new PostTestEventOptions.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/ProfileAttachmentBaseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentBaseTest.java new file mode 100644 index 00000000..136d9f21 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentBaseTest.java @@ -0,0 +1,117 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DateRange; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadById; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentBase; +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 ProfileAttachmentBase model. + */ +public class ProfileAttachmentBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testProfileAttachmentBase() throws Throwable { + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); + + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList("testString")) + .build(); + assertEquals(attachmentNotificationsControlsModel.thresholdLimit(), Long.valueOf("15")); + assertEquals(attachmentNotificationsControlsModel.failedControlIds(), java.util.Arrays.asList("testString")); + + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() + .enabled(true) + .controls(attachmentNotificationsControlsModel) + .build(); + assertEquals(attachmentNotificationsModel.enabled(), Boolean.valueOf(true)); + assertEquals(attachmentNotificationsModel.controls(), attachmentNotificationsControlsModel); + + MultiCloudScopePayloadById multiCloudScopePayloadModel = new MultiCloudScopePayloadById.Builder() + .id("testString") + .build(); + assertEquals(multiCloudScopePayloadModel.id(), "testString"); + + DateRange dateRangeModel = new DateRange.Builder() + .startDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .endDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .build(); + assertEquals(dateRangeModel.startDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); + assertEquals(dateRangeModel.endDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); + + ProfileAttachmentBase profileAttachmentBaseModel = new ProfileAttachmentBase.Builder() + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .description("testString") + .name("testString") + .notifications(attachmentNotificationsModel) + .schedule("daily") + .scope(java.util.Arrays.asList(multiCloudScopePayloadModel)) + .status("enabled") + .dataSelectionRange(dateRangeModel) + .build(); + assertEquals(profileAttachmentBaseModel.attachmentParameters(), java.util.Arrays.asList(parameterModel)); + assertEquals(profileAttachmentBaseModel.description(), "testString"); + assertEquals(profileAttachmentBaseModel.name(), "testString"); + assertEquals(profileAttachmentBaseModel.notifications(), attachmentNotificationsModel); + assertEquals(profileAttachmentBaseModel.schedule(), "daily"); + assertEquals(profileAttachmentBaseModel.scope(), java.util.Arrays.asList(multiCloudScopePayloadModel)); + assertEquals(profileAttachmentBaseModel.status(), "enabled"); + assertEquals(profileAttachmentBaseModel.dataSelectionRange(), dateRangeModel); + + String json = TestUtilities.serialize(profileAttachmentBaseModel); + + ProfileAttachmentBase profileAttachmentBaseModelNew = TestUtilities.deserialize(json, ProfileAttachmentBase.class); + assertTrue(profileAttachmentBaseModelNew instanceof ProfileAttachmentBase); + assertEquals(profileAttachmentBaseModelNew.description(), "testString"); + assertEquals(profileAttachmentBaseModelNew.name(), "testString"); + assertEquals(profileAttachmentBaseModelNew.notifications().toString(), attachmentNotificationsModel.toString()); + assertEquals(profileAttachmentBaseModelNew.schedule(), "daily"); + assertEquals(profileAttachmentBaseModelNew.status(), "enabled"); + assertEquals(profileAttachmentBaseModelNew.dataSelectionRange().toString(), dateRangeModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testProfileAttachmentBaseError() throws Throwable { + new ProfileAttachmentBase.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/ProfileAttachmentCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentCollectionTest.java new file mode 100644 index 00000000..f61d2f45 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentCollectionTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DateRange; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.LastScan; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadById; +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.ProfileAttachment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentCollection; +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 ProfileAttachmentCollection model. + */ +public class ProfileAttachmentCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testProfileAttachmentCollection() throws Throwable { + ProfileAttachmentCollection profileAttachmentCollectionModel = new ProfileAttachmentCollection(); + assertNull(profileAttachmentCollectionModel.getLimit()); + assertNull(profileAttachmentCollectionModel.getTotalCount()); + assertNull(profileAttachmentCollectionModel.getFirst()); + assertNull(profileAttachmentCollectionModel.getNext()); + assertNull(profileAttachmentCollectionModel.getAttachments()); + } +} \ 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/ProfileAttachmentResponseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentResponseTest.java new file mode 100644 index 00000000..7665e122 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentResponseTest.java @@ -0,0 +1,46 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DateRange; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.LastScan; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadById; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachmentResponse; +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 ProfileAttachmentResponse model. + */ +public class ProfileAttachmentResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testProfileAttachmentResponse() throws Throwable { + ProfileAttachmentResponse profileAttachmentResponseModel = new ProfileAttachmentResponse(); + assertNull(profileAttachmentResponseModel.getProfileId()); + assertNull(profileAttachmentResponseModel.getAttachments()); + } +} \ 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/ProfileAttachmentTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentTest.java new file mode 100644 index 00000000..523dfd4d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileAttachmentTest.java @@ -0,0 +1,61 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DateRange; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.LastScan; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadById; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileAttachment; +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 ProfileAttachment model. + */ +public class ProfileAttachmentTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testProfileAttachment() throws Throwable { + ProfileAttachment profileAttachmentModel = new ProfileAttachment(); + assertNull(profileAttachmentModel.getAttachmentParameters()); + assertNull(profileAttachmentModel.getDescription()); + assertNull(profileAttachmentModel.getName()); + assertNull(profileAttachmentModel.getNotifications()); + assertNull(profileAttachmentModel.getSchedule()); + assertNull(profileAttachmentModel.getScope()); + assertNull(profileAttachmentModel.getStatus()); + assertNull(profileAttachmentModel.getDataSelectionRange()); + assertNull(profileAttachmentModel.getAccountId()); + assertNull(profileAttachmentModel.getCreatedBy()); + assertNull(profileAttachmentModel.getCreatedOn()); + assertNull(profileAttachmentModel.getId()); + assertNull(profileAttachmentModel.getInstanceId()); + assertNull(profileAttachmentModel.getLastScan()); + assertNull(profileAttachmentModel.getNextScanTime()); + assertNull(profileAttachmentModel.getProfileId()); + assertNull(profileAttachmentModel.getUpdatedBy()); + assertNull(profileAttachmentModel.getUpdatedOn()); + } +} \ 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/ProfileCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileCollectionTest.java index ab702fc2..2459b738 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileCollectionTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileCollectionTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,10 +15,16 @@ 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.PaginatedCollectionFirst; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PaginatedCollectionNext; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParameters; +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.Profile; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileCollection; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -36,8 +42,8 @@ public class ProfileCollectionTest { @Test public void testProfileCollection() throws Throwable { ProfileCollection profileCollectionModel = new ProfileCollection(); - assertNull(profileCollectionModel.getTotalCount()); assertNull(profileCollectionModel.getLimit()); + assertNull(profileCollectionModel.getTotalCount()); assertNull(profileCollectionModel.getFirst()); assertNull(profileCollectionModel.getNext()); assertNull(profileCollectionModel.getProfiles()); diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsPrototypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsPrototypeTest.java index f61c3070..7fadaec3 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsPrototypeTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsPrototypeTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -32,17 +32,17 @@ public class ProfileControlsPrototypeTest { @Test public void testProfileControlsPrototype() throws Throwable { ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() - .controlLibraryId("e98a56ff-dc24-41d4-9875-1e188e2da6cd") - .controlId("5C453578-E9A1-421E-AD0F-C6AFCDD67CCF") + .controlLibraryId("testString") + .controlId("testString") .build(); - assertEquals(profileControlsPrototypeModel.controlLibraryId(), "e98a56ff-dc24-41d4-9875-1e188e2da6cd"); - assertEquals(profileControlsPrototypeModel.controlId(), "5C453578-E9A1-421E-AD0F-C6AFCDD67CCF"); + assertEquals(profileControlsPrototypeModel.controlLibraryId(), "testString"); + assertEquals(profileControlsPrototypeModel.controlId(), "testString"); String json = TestUtilities.serialize(profileControlsPrototypeModel); ProfileControlsPrototype profileControlsPrototypeModelNew = TestUtilities.deserialize(json, ProfileControlsPrototype.class); assertTrue(profileControlsPrototypeModelNew instanceof ProfileControlsPrototype); - assertEquals(profileControlsPrototypeModelNew.controlLibraryId(), "e98a56ff-dc24-41d4-9875-1e188e2da6cd"); - assertEquals(profileControlsPrototypeModelNew.controlId(), "5C453578-E9A1-421E-AD0F-C6AFCDD67CCF"); + assertEquals(profileControlsPrototypeModelNew.controlLibraryId(), "testString"); + assertEquals(profileControlsPrototypeModelNew.controlId(), "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/ProfileControlsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsTest.java index ace4370a..90830f43 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileControlsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,10 +14,10 @@ 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.ControlDocs; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecifications; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Implementation; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -35,17 +35,108 @@ public class ProfileControlsTest { @Test public void testProfileControls() throws Throwable { - ProfileControls profileControlsModel = new ProfileControls(); - assertNull(profileControlsModel.getControlLibraryId()); - assertNull(profileControlsModel.getControlId()); - assertNull(profileControlsModel.getControlLibraryVersion()); - assertNull(profileControlsModel.getControlName()); - assertNull(profileControlsModel.getControlDescription()); - assertNull(profileControlsModel.getControlCategory()); - assertNull(profileControlsModel.getControlParent()); - assertNull(profileControlsModel.isControlRequirement()); - assertNull(profileControlsModel.getControlDocs()); - assertNull(profileControlsModel.getControlSpecificationsCount()); - assertNull(profileControlsModel.getControlSpecifications()); + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + assertEquals(controlDocModel.controlDocsId(), "testString"); + assertEquals(controlDocModel.controlDocsType(), "testString"); + + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); + + Assessment assessmentModel = new Assessment.Builder() + .assessmentId("382c2b06-e6b2-43ee-b189-c1c7743b67ee") + .assessmentType("ibm-cloud-rule") + .assessmentMethod("ibm-cloud-rule") + .assessmentDescription("Check whether Cloud Object Storage is accessible only by using private endpoints") + .parameterCount(Long.valueOf("1")) + .parameters(java.util.Arrays.asList(parameterModel)) + .build(); + assertEquals(assessmentModel.assessmentId(), "382c2b06-e6b2-43ee-b189-c1c7743b67ee"); + assertEquals(assessmentModel.assessmentType(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentMethod(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentDescription(), "Check whether Cloud Object Storage is accessible only by using private endpoints"); + assertEquals(assessmentModel.parameterCount(), Long.valueOf("1")); + assertEquals(assessmentModel.parameters(), java.util.Arrays.asList(parameterModel)); + + ControlSpecification controlSpecificationModel = new ControlSpecification.Builder() + .id("testString") + .responsibility("testString") + .componentId("testString") + .componentName("testString") + .componentType("testString") + .environment("testString") + .description("testString") + .assessmentsCount(Long.valueOf("26")) + .assessments(java.util.Arrays.asList(assessmentModel)) + .build(); + assertEquals(controlSpecificationModel.id(), "testString"); + assertEquals(controlSpecificationModel.responsibility(), "testString"); + assertEquals(controlSpecificationModel.componentId(), "testString"); + assertEquals(controlSpecificationModel.componentName(), "testString"); + assertEquals(controlSpecificationModel.componentType(), "testString"); + assertEquals(controlSpecificationModel.environment(), "testString"); + assertEquals(controlSpecificationModel.description(), "testString"); + assertEquals(controlSpecificationModel.assessmentsCount(), Long.valueOf("26")); + assertEquals(controlSpecificationModel.assessments(), java.util.Arrays.asList(assessmentModel)); + + ProfileControls profileControlsModel = new ProfileControls.Builder() + .controlRequirement(true) + .controlLibraryId("testString") + .controlId("testString") + .controlLibraryVersion("testString") + .controlName("testString") + .controlDescription("testString") + .controlSeverity("testString") + .controlCategory("testString") + .controlParent("testString") + .controlDocs(controlDocModel) + .controlSpecifications(java.util.Arrays.asList(controlSpecificationModel)) + .build(); + assertEquals(profileControlsModel.controlRequirement(), Boolean.valueOf(true)); + assertEquals(profileControlsModel.controlLibraryId(), "testString"); + assertEquals(profileControlsModel.controlId(), "testString"); + assertEquals(profileControlsModel.controlLibraryVersion(), "testString"); + assertEquals(profileControlsModel.controlName(), "testString"); + assertEquals(profileControlsModel.controlDescription(), "testString"); + assertEquals(profileControlsModel.controlSeverity(), "testString"); + assertEquals(profileControlsModel.controlCategory(), "testString"); + assertEquals(profileControlsModel.controlParent(), "testString"); + assertEquals(profileControlsModel.controlDocs(), controlDocModel); + assertEquals(profileControlsModel.controlSpecifications(), java.util.Arrays.asList(controlSpecificationModel)); + + String json = TestUtilities.serialize(profileControlsModel); + + ProfileControls profileControlsModelNew = TestUtilities.deserialize(json, ProfileControls.class); + assertTrue(profileControlsModelNew instanceof ProfileControls); + assertEquals(profileControlsModelNew.controlRequirement(), Boolean.valueOf(true)); + assertEquals(profileControlsModelNew.controlLibraryId(), "testString"); + assertEquals(profileControlsModelNew.controlId(), "testString"); + assertEquals(profileControlsModelNew.controlLibraryVersion(), "testString"); + assertEquals(profileControlsModelNew.controlName(), "testString"); + assertEquals(profileControlsModelNew.controlDescription(), "testString"); + assertEquals(profileControlsModelNew.controlSeverity(), "testString"); + assertEquals(profileControlsModelNew.controlCategory(), "testString"); + assertEquals(profileControlsModelNew.controlParent(), "testString"); + assertEquals(profileControlsModelNew.controlDocs().toString(), controlDocModel.toString()); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testProfileControlsError() throws Throwable { + new ProfileControls.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/ProfileDefaultParametersResponseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileDefaultParametersResponseTest.java new file mode 100644 index 00000000..a3c0725f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileDefaultParametersResponseTest.java @@ -0,0 +1,69 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileDefaultParametersResponse; +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 ProfileDefaultParametersResponse model. + */ +public class ProfileDefaultParametersResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testProfileDefaultParametersResponse() throws Throwable { + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("testString") + .parameterDefaultValue("testString") + .parameterDisplayName("testString") + .parameterType("testString") + .build(); + assertEquals(defaultParametersModel.assessmentType(), "testString"); + assertEquals(defaultParametersModel.assessmentId(), "testString"); + assertEquals(defaultParametersModel.parameterName(), "testString"); + assertEquals(defaultParametersModel.parameterDefaultValue(), "testString"); + assertEquals(defaultParametersModel.parameterDisplayName(), "testString"); + assertEquals(defaultParametersModel.parameterType(), "testString"); + + ProfileDefaultParametersResponse profileDefaultParametersResponseModel = new ProfileDefaultParametersResponse.Builder() + .id("testString") + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .build(); + assertEquals(profileDefaultParametersResponseModel.id(), "testString"); + assertEquals(profileDefaultParametersResponseModel.defaultParameters(), java.util.Arrays.asList(defaultParametersModel)); + + String json = TestUtilities.serialize(profileDefaultParametersResponseModel); + + ProfileDefaultParametersResponse profileDefaultParametersResponseModelNew = TestUtilities.deserialize(json, ProfileDefaultParametersResponse.class); + assertTrue(profileDefaultParametersResponseModelNew instanceof ProfileDefaultParametersResponse); + assertEquals(profileDefaultParametersResponseModelNew.id(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testProfileDefaultParametersResponseError() throws Throwable { + new ProfileDefaultParametersResponse.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/ProfileInfoTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileInfoTest.java index 4f825811..bc804d57 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileInfoTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileInfoTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileTest.java index 954bde2f..5f5c5e70 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProfileTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,11 +14,12 @@ 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.ControlDocs; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecifications; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParametersPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Implementation; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Profile; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; @@ -37,24 +38,165 @@ public class ProfileTest { @Test public void testProfile() throws Throwable { - Profile profileModel = new Profile(); - assertNull(profileModel.getId()); - assertNull(profileModel.getProfileName()); - assertNull(profileModel.getProfileDescription()); - assertNull(profileModel.getProfileType()); - assertNull(profileModel.getProfileVersion()); - assertNull(profileModel.getVersionGroupLabel()); - assertNull(profileModel.getInstanceId()); - assertNull(profileModel.isLatest()); - assertNull(profileModel.isHierarchyEnabled()); - assertNull(profileModel.getCreatedBy()); - assertNull(profileModel.getCreatedOn()); - assertNull(profileModel.getUpdatedBy()); - assertNull(profileModel.getUpdatedOn()); - assertNull(profileModel.getControlsCount()); - assertNull(profileModel.getControlParentsCount()); - assertNull(profileModel.getAttachmentsCount()); - assertNull(profileModel.getControls()); - assertNull(profileModel.getDefaultParameters()); + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") + .build(); + assertEquals(controlDocModel.controlDocsId(), "testString"); + assertEquals(controlDocModel.controlDocsType(), "testString"); + + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); + + Assessment assessmentModel = new Assessment.Builder() + .assessmentId("382c2b06-e6b2-43ee-b189-c1c7743b67ee") + .assessmentType("ibm-cloud-rule") + .assessmentMethod("ibm-cloud-rule") + .assessmentDescription("Check whether Cloud Object Storage is accessible only by using private endpoints") + .parameterCount(Long.valueOf("1")) + .parameters(java.util.Arrays.asList(parameterModel)) + .build(); + assertEquals(assessmentModel.assessmentId(), "382c2b06-e6b2-43ee-b189-c1c7743b67ee"); + assertEquals(assessmentModel.assessmentType(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentMethod(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentDescription(), "Check whether Cloud Object Storage is accessible only by using private endpoints"); + assertEquals(assessmentModel.parameterCount(), Long.valueOf("1")); + assertEquals(assessmentModel.parameters(), java.util.Arrays.asList(parameterModel)); + + ControlSpecification controlSpecificationModel = new ControlSpecification.Builder() + .id("testString") + .responsibility("testString") + .componentId("testString") + .componentName("testString") + .componentType("testString") + .environment("testString") + .description("testString") + .assessmentsCount(Long.valueOf("26")) + .assessments(java.util.Arrays.asList(assessmentModel)) + .build(); + assertEquals(controlSpecificationModel.id(), "testString"); + assertEquals(controlSpecificationModel.responsibility(), "testString"); + assertEquals(controlSpecificationModel.componentId(), "testString"); + assertEquals(controlSpecificationModel.componentName(), "testString"); + assertEquals(controlSpecificationModel.componentType(), "testString"); + assertEquals(controlSpecificationModel.environment(), "testString"); + assertEquals(controlSpecificationModel.description(), "testString"); + assertEquals(controlSpecificationModel.assessmentsCount(), Long.valueOf("26")); + assertEquals(controlSpecificationModel.assessments(), java.util.Arrays.asList(assessmentModel)); + + ProfileControls profileControlsModel = new ProfileControls.Builder() + .controlRequirement(true) + .controlLibraryId("testString") + .controlId("testString") + .controlLibraryVersion("testString") + .controlName("testString") + .controlDescription("testString") + .controlSeverity("testString") + .controlCategory("testString") + .controlParent("testString") + .controlDocs(controlDocModel) + .controlSpecifications(java.util.Arrays.asList(controlSpecificationModel)) + .build(); + assertEquals(profileControlsModel.controlRequirement(), Boolean.valueOf(true)); + assertEquals(profileControlsModel.controlLibraryId(), "testString"); + assertEquals(profileControlsModel.controlId(), "testString"); + assertEquals(profileControlsModel.controlLibraryVersion(), "testString"); + assertEquals(profileControlsModel.controlName(), "testString"); + assertEquals(profileControlsModel.controlDescription(), "testString"); + assertEquals(profileControlsModel.controlSeverity(), "testString"); + assertEquals(profileControlsModel.controlCategory(), "testString"); + assertEquals(profileControlsModel.controlParent(), "testString"); + assertEquals(profileControlsModel.controlDocs(), controlDocModel); + assertEquals(profileControlsModel.controlSpecifications(), java.util.Arrays.asList(controlSpecificationModel)); + + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("testString") + .parameterDefaultValue("testString") + .parameterDisplayName("testString") + .parameterType("testString") + .build(); + assertEquals(defaultParametersModel.assessmentType(), "testString"); + assertEquals(defaultParametersModel.assessmentId(), "testString"); + assertEquals(defaultParametersModel.parameterName(), "testString"); + assertEquals(defaultParametersModel.parameterDefaultValue(), "testString"); + assertEquals(defaultParametersModel.parameterDisplayName(), "testString"); + assertEquals(defaultParametersModel.parameterType(), "testString"); + + Profile profileModel = new Profile.Builder() + .id("testString") + .profileName("testString") + .instanceId("testString") + .hierarchyEnabled(true) + .profileDescription("testString") + .profileType("custom") + .profileVersion("testString") + .versionGroupLabel("testString") + .latest(true) + .createdBy("testString") + .createdOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + .updatedBy("testString") + .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + .controlsCount(Long.valueOf("26")) + .attachmentsCount(Long.valueOf("26")) + .controls(java.util.Arrays.asList(profileControlsModel)) + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .build(); + assertEquals(profileModel.id(), "testString"); + assertEquals(profileModel.profileName(), "testString"); + assertEquals(profileModel.instanceId(), "testString"); + assertEquals(profileModel.hierarchyEnabled(), Boolean.valueOf(true)); + assertEquals(profileModel.profileDescription(), "testString"); + assertEquals(profileModel.profileType(), "custom"); + assertEquals(profileModel.profileVersion(), "testString"); + assertEquals(profileModel.versionGroupLabel(), "testString"); + assertEquals(profileModel.latest(), Boolean.valueOf(true)); + assertEquals(profileModel.createdBy(), "testString"); + assertEquals(profileModel.createdOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + assertEquals(profileModel.updatedBy(), "testString"); + assertEquals(profileModel.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + assertEquals(profileModel.controlsCount(), Long.valueOf("26")); + assertEquals(profileModel.attachmentsCount(), Long.valueOf("26")); + assertEquals(profileModel.controls(), java.util.Arrays.asList(profileControlsModel)); + assertEquals(profileModel.defaultParameters(), java.util.Arrays.asList(defaultParametersModel)); + + String json = TestUtilities.serialize(profileModel); + + Profile profileModelNew = TestUtilities.deserialize(json, Profile.class); + assertTrue(profileModelNew instanceof Profile); + assertEquals(profileModelNew.id(), "testString"); + assertEquals(profileModelNew.profileName(), "testString"); + assertEquals(profileModelNew.instanceId(), "testString"); + assertEquals(profileModelNew.hierarchyEnabled(), Boolean.valueOf(true)); + assertEquals(profileModelNew.profileDescription(), "testString"); + assertEquals(profileModelNew.profileType(), "custom"); + assertEquals(profileModelNew.profileVersion(), "testString"); + assertEquals(profileModelNew.versionGroupLabel(), "testString"); + assertEquals(profileModelNew.latest(), Boolean.valueOf(true)); + assertEquals(profileModelNew.createdBy(), "testString"); + assertEquals(profileModelNew.createdOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + assertEquals(profileModelNew.updatedBy(), "testString"); + assertEquals(profileModelNew.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + assertEquals(profileModelNew.controlsCount(), Long.valueOf("26")); + assertEquals(profileModelNew.attachmentsCount(), Long.valueOf("26")); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testProfileError() throws Throwable { + new Profile.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/ProviderTypeCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeCollectionTest.java new file mode 100644 index 00000000..06d4d60e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeCollectionTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.LabelType; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderType; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeCollection; +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 ProviderTypeCollection model. + */ +public class ProviderTypeCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testProviderTypeCollection() throws Throwable { + ProviderTypeCollection providerTypeCollectionModel = new ProviderTypeCollection(); + assertNull(providerTypeCollectionModel.getProviderTypes()); + } +} \ 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/ProviderTypeInstanceCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceCollectionTest.java new file mode 100644 index 00000000..b0bdf813 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceCollectionTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstance; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderTypeInstanceCollection; +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 ProviderTypeInstanceCollection model. + */ +public class ProviderTypeInstanceCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testProviderTypeInstanceCollection() throws Throwable { + ProviderTypeInstanceCollection providerTypeInstanceCollectionModel = new ProviderTypeInstanceCollection(); + assertNull(providerTypeInstanceCollectionModel.getProviderTypeInstances()); + } +} \ 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/ProviderTypeInstanceTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceTest.java new file mode 100644 index 00000000..851aa2c0 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceTest.java @@ -0,0 +1,42 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ProviderTypeInstance; +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 ProviderTypeInstance model. + */ +public class ProviderTypeInstanceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testProviderTypeInstance() throws Throwable { + ProviderTypeInstance providerTypeInstanceModel = new ProviderTypeInstance(); + assertNull(providerTypeInstanceModel.getId()); + assertNull(providerTypeInstanceModel.getType()); + assertNull(providerTypeInstanceModel.getName()); + assertNull(providerTypeInstanceModel.getAttributes()); + assertNull(providerTypeInstanceModel.getCreatedAt()); + assertNull(providerTypeInstanceModel.getUpdatedAt()); + } +} \ 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/ProviderTypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeTest.java new file mode 100644 index 00000000..38438f13 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.AdditionalProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.LabelType; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProviderType; +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 ProviderType model. + */ +public class ProviderTypeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testProviderType() throws Throwable { + ProviderType providerTypeModel = new ProviderType(); + assertNull(providerTypeModel.getId()); + assertNull(providerTypeModel.getType()); + assertNull(providerTypeModel.getName()); + assertNull(providerTypeModel.getDescription()); + assertNull(providerTypeModel.isS2sEnabled()); + assertNull(providerTypeModel.getInstanceLimit()); + assertNull(providerTypeModel.getMode()); + assertNull(providerTypeModel.getDataType()); + assertNull(providerTypeModel.getIcon()); + assertNull(providerTypeModel.getLabel()); + assertNull(providerTypeModel.getAttributes()); + assertNull(providerTypeModel.getCreatedAt()); + assertNull(providerTypeModel.getUpdatedAt()); + } +} \ 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/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 12f51158..21330c73 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,12 +14,10 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; 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.ControlDocs; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecifications; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlsInControlLib; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Implementation; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AssessmentPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceCustomControlLibraryOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -37,121 +35,70 @@ public class ReplaceCustomControlLibraryOptionsTest { @Test public void testReplaceCustomControlLibraryOptions() throws Throwable { - ParameterInfo parameterInfoModel = new ParameterInfo.Builder() - .parameterName("location") - .parameterDisplayName("Location") - .parameterType("string") - .parameterValue("public") - .build(); - assertEquals(parameterInfoModel.parameterName(), "location"); - assertEquals(parameterInfoModel.parameterDisplayName(), "Location"); - assertEquals(parameterInfoModel.parameterType(), "string"); - assertEquals(parameterInfoModel.parameterValue(), "public"); - - Implementation implementationModel = new Implementation.Builder() + AssessmentPrototype assessmentPrototypeModel = new AssessmentPrototype.Builder() .assessmentId("testString") - .assessmentMethod("testString") - .assessmentType("testString") .assessmentDescription("testString") - .parameterCount(Long.valueOf("26")) - .parameters(java.util.Arrays.asList(parameterInfoModel)) .build(); - assertEquals(implementationModel.assessmentId(), "testString"); - assertEquals(implementationModel.assessmentMethod(), "testString"); - assertEquals(implementationModel.assessmentType(), "testString"); - assertEquals(implementationModel.assessmentDescription(), "testString"); - assertEquals(implementationModel.parameterCount(), Long.valueOf("26")); - assertEquals(implementationModel.parameters(), java.util.Arrays.asList(parameterInfoModel)); + assertEquals(assessmentPrototypeModel.assessmentId(), "testString"); + assertEquals(assessmentPrototypeModel.assessmentDescription(), "testString"); - ControlSpecifications controlSpecificationsModel = new ControlSpecifications.Builder() - .controlSpecificationId("f3517159-889e-4781-819a-89d89b747c85") - .responsibility("user") - .componentId("f3517159-889e-4781-819a-89d89b747c85") - .componentName("testString") - .environment("testString") + ControlSpecificationPrototype controlSpecificationPrototypeModel = new ControlSpecificationPrototype.Builder() + .componentId("testString") + .environment("ibm-cloud") + .controlSpecificationId("testString") .controlSpecificationDescription("testString") - .assessmentsCount(Long.valueOf("26")) - .assessments(java.util.Arrays.asList(implementationModel)) + .assessments(java.util.Arrays.asList(assessmentPrototypeModel)) .build(); - assertEquals(controlSpecificationsModel.controlSpecificationId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModel.responsibility(), "user"); - assertEquals(controlSpecificationsModel.componentId(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(controlSpecificationsModel.componentName(), "testString"); - assertEquals(controlSpecificationsModel.environment(), "testString"); - assertEquals(controlSpecificationsModel.controlSpecificationDescription(), "testString"); - assertEquals(controlSpecificationsModel.assessmentsCount(), Long.valueOf("26")); - assertEquals(controlSpecificationsModel.assessments(), java.util.Arrays.asList(implementationModel)); + assertEquals(controlSpecificationPrototypeModel.componentId(), "testString"); + assertEquals(controlSpecificationPrototypeModel.environment(), "ibm-cloud"); + assertEquals(controlSpecificationPrototypeModel.controlSpecificationId(), "testString"); + assertEquals(controlSpecificationPrototypeModel.controlSpecificationDescription(), "testString"); + assertEquals(controlSpecificationPrototypeModel.assessments(), java.util.Arrays.asList(assessmentPrototypeModel)); - ControlDocs controlDocsModel = new ControlDocs.Builder() + ControlDoc controlDocModel = new ControlDoc.Builder() .controlDocsId("testString") .controlDocsType("testString") .build(); - assertEquals(controlDocsModel.controlDocsId(), "testString"); - assertEquals(controlDocsModel.controlDocsType(), "testString"); + assertEquals(controlDocModel.controlDocsId(), "testString"); + assertEquals(controlDocModel.controlDocsType(), "testString"); - ControlsInControlLib controlsInControlLibModel = new ControlsInControlLib.Builder() + ControlPrototype controlPrototypeModel = new ControlPrototype.Builder() .controlName("testString") - .controlId("1fa45e17-9322-4e6c-bbd6-1c51db08e790") .controlDescription("testString") .controlCategory("testString") - .controlParent("testString") - .controlTags(java.util.Arrays.asList("testString")) - .controlSpecifications(java.util.Arrays.asList(controlSpecificationsModel)) - .controlDocs(controlDocsModel) .controlRequirement(true) - .status("enabled") + .controlParent("testString") + .controlSpecifications(java.util.Arrays.asList(controlSpecificationPrototypeModel)) + .controlDocs(controlDocModel) + .status("testString") .build(); - assertEquals(controlsInControlLibModel.controlName(), "testString"); - assertEquals(controlsInControlLibModel.controlId(), "1fa45e17-9322-4e6c-bbd6-1c51db08e790"); - assertEquals(controlsInControlLibModel.controlDescription(), "testString"); - assertEquals(controlsInControlLibModel.controlCategory(), "testString"); - assertEquals(controlsInControlLibModel.controlParent(), "testString"); - assertEquals(controlsInControlLibModel.controlTags(), java.util.Arrays.asList("testString")); - assertEquals(controlsInControlLibModel.controlSpecifications(), java.util.Arrays.asList(controlSpecificationsModel)); - assertEquals(controlsInControlLibModel.controlDocs(), controlDocsModel); - assertEquals(controlsInControlLibModel.controlRequirement(), Boolean.valueOf(true)); - assertEquals(controlsInControlLibModel.status(), "enabled"); + assertEquals(controlPrototypeModel.controlName(), "testString"); + assertEquals(controlPrototypeModel.controlDescription(), "testString"); + assertEquals(controlPrototypeModel.controlCategory(), "testString"); + assertEquals(controlPrototypeModel.controlRequirement(), Boolean.valueOf(true)); + assertEquals(controlPrototypeModel.controlParent(), "testString"); + assertEquals(controlPrototypeModel.controlSpecifications(), java.util.Arrays.asList(controlSpecificationPrototypeModel)); + assertEquals(controlPrototypeModel.controlDocs(), controlDocModel); + assertEquals(controlPrototypeModel.status(), "testString"); ReplaceCustomControlLibraryOptions replaceCustomControlLibraryOptionsModel = new ReplaceCustomControlLibraryOptions.Builder() - .controlLibrariesId("testString") - .id("f3517159-889e-4781-819a-89d89b747c85") - .accountId("130003ea8bfa43c5aacea07a86da3000") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .controlLibraryId("testString") .controlLibraryName("testString") .controlLibraryDescription("testString") - .controlLibraryType("predefined") - .versionGroupLabel("e0923045-f00d-44de-b49b-6f1f0e8033cc") + .controlLibraryType("custom") .controlLibraryVersion("testString") - .createdOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .createdBy("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .updatedBy("testString") - .latest(true) - .hierarchyEnabled(true) - .controlsCount(Long.valueOf("26")) - .controlParentsCount(Long.valueOf("26")) - .controls(java.util.Arrays.asList(controlsInControlLibModel)) - .xCorrelationId("testString") - .xRequestId("testString") + .controls(java.util.Arrays.asList(controlPrototypeModel)) + .bssAccount("testString") .build(); - assertEquals(replaceCustomControlLibraryOptionsModel.controlLibrariesId(), "testString"); - assertEquals(replaceCustomControlLibraryOptionsModel.id(), "f3517159-889e-4781-819a-89d89b747c85"); - assertEquals(replaceCustomControlLibraryOptionsModel.accountId(), "130003ea8bfa43c5aacea07a86da3000"); + assertEquals(replaceCustomControlLibraryOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(replaceCustomControlLibraryOptionsModel.controlLibraryId(), "testString"); assertEquals(replaceCustomControlLibraryOptionsModel.controlLibraryName(), "testString"); assertEquals(replaceCustomControlLibraryOptionsModel.controlLibraryDescription(), "testString"); - assertEquals(replaceCustomControlLibraryOptionsModel.controlLibraryType(), "predefined"); - assertEquals(replaceCustomControlLibraryOptionsModel.versionGroupLabel(), "e0923045-f00d-44de-b49b-6f1f0e8033cc"); + assertEquals(replaceCustomControlLibraryOptionsModel.controlLibraryType(), "custom"); assertEquals(replaceCustomControlLibraryOptionsModel.controlLibraryVersion(), "testString"); - assertEquals(replaceCustomControlLibraryOptionsModel.createdOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(replaceCustomControlLibraryOptionsModel.createdBy(), "testString"); - assertEquals(replaceCustomControlLibraryOptionsModel.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(replaceCustomControlLibraryOptionsModel.updatedBy(), "testString"); - assertEquals(replaceCustomControlLibraryOptionsModel.latest(), Boolean.valueOf(true)); - assertEquals(replaceCustomControlLibraryOptionsModel.hierarchyEnabled(), Boolean.valueOf(true)); - assertEquals(replaceCustomControlLibraryOptionsModel.controlsCount(), Long.valueOf("26")); - assertEquals(replaceCustomControlLibraryOptionsModel.controlParentsCount(), Long.valueOf("26")); - assertEquals(replaceCustomControlLibraryOptionsModel.controls(), java.util.Arrays.asList(controlsInControlLibModel)); - assertEquals(replaceCustomControlLibraryOptionsModel.xCorrelationId(), "testString"); - assertEquals(replaceCustomControlLibraryOptionsModel.xRequestId(), "testString"); + assertEquals(replaceCustomControlLibraryOptionsModel.controls(), java.util.Arrays.asList(controlPrototypeModel)); + assertEquals(replaceCustomControlLibraryOptionsModel.bssAccount(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) 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 031b2742..0154b6f4 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,12 +15,11 @@ 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.AttachmentParameterPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentsNotificationsPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.FailedControls; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.LastScan; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScope; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PropertyItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DateRange; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.MultiCloudScopePayloadById; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -38,100 +37,73 @@ public class ReplaceProfileAttachmentOptionsTest { @Test public void testReplaceProfileAttachmentOptions() throws Throwable { - PropertyItem propertyItemModel = new PropertyItem.Builder() - .name("testString") - .value("testString") - .build(); - assertEquals(propertyItemModel.name(), "testString"); - assertEquals(propertyItemModel.value(), "testString"); - - MultiCloudScope multiCloudScopeModel = new MultiCloudScope.Builder() - .environment("testString") - .xProperties(java.util.Arrays.asList(propertyItemModel)) + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") .build(); - assertEquals(multiCloudScopeModel.environment(), "testString"); - assertEquals(multiCloudScopeModel.xProperties(), java.util.Arrays.asList(propertyItemModel)); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); - FailedControls failedControlsModel = new FailedControls.Builder() - .thresholdLimit(Long.valueOf("26")) - .failedControlIds(java.util.Arrays.asList("5C453578-E9A1-421E-AD0F-C6AFCDD67CCF")) + AttachmentNotificationsControls attachmentNotificationsControlsModel = new AttachmentNotificationsControls.Builder() + .thresholdLimit(Long.valueOf("15")) + .failedControlIds(java.util.Arrays.asList("testString")) .build(); - assertEquals(failedControlsModel.thresholdLimit(), Long.valueOf("26")); - assertEquals(failedControlsModel.failedControlIds(), java.util.Arrays.asList("5C453578-E9A1-421E-AD0F-C6AFCDD67CCF")); + assertEquals(attachmentNotificationsControlsModel.thresholdLimit(), Long.valueOf("15")); + assertEquals(attachmentNotificationsControlsModel.failedControlIds(), java.util.Arrays.asList("testString")); - AttachmentsNotificationsPrototype attachmentsNotificationsPrototypeModel = new AttachmentsNotificationsPrototype.Builder() + AttachmentNotifications attachmentNotificationsModel = new AttachmentNotifications.Builder() .enabled(true) - .controls(failedControlsModel) + .controls(attachmentNotificationsControlsModel) .build(); - assertEquals(attachmentsNotificationsPrototypeModel.enabled(), Boolean.valueOf(true)); - assertEquals(attachmentsNotificationsPrototypeModel.controls(), failedControlsModel); + assertEquals(attachmentNotificationsModel.enabled(), Boolean.valueOf(true)); + assertEquals(attachmentNotificationsModel.controls(), attachmentNotificationsControlsModel); - AttachmentParameterPrototype attachmentParameterPrototypeModel = new AttachmentParameterPrototype.Builder() - .assessmentType("testString") - .assessmentId("testString") - .parameterName("testString") - .parameterValue("testString") - .parameterDisplayName("testString") - .parameterType("string") + MultiCloudScopePayloadById multiCloudScopePayloadModel = new MultiCloudScopePayloadById.Builder() + .id("testString") .build(); - assertEquals(attachmentParameterPrototypeModel.assessmentType(), "testString"); - assertEquals(attachmentParameterPrototypeModel.assessmentId(), "testString"); - assertEquals(attachmentParameterPrototypeModel.parameterName(), "testString"); - assertEquals(attachmentParameterPrototypeModel.parameterValue(), "testString"); - assertEquals(attachmentParameterPrototypeModel.parameterDisplayName(), "testString"); - assertEquals(attachmentParameterPrototypeModel.parameterType(), "string"); + assertEquals(multiCloudScopePayloadModel.id(), "testString"); - LastScan lastScanModel = new LastScan.Builder() - .id("e8a39d25-0051-4328-8462-988ad321f49a") - .status("in_progress") - .time(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + DateRange dateRangeModel = new DateRange.Builder() + .startDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) + .endDate(DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")) .build(); - assertEquals(lastScanModel.id(), "e8a39d25-0051-4328-8462-988ad321f49a"); - assertEquals(lastScanModel.status(), "in_progress"); - assertEquals(lastScanModel.time(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + assertEquals(dateRangeModel.startDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); + assertEquals(dateRangeModel.endDate(), DateUtils.parseAsDateTime("2025-02-28T05:42:58.000Z")); ReplaceProfileAttachmentOptions replaceProfileAttachmentOptionsModel = new ReplaceProfileAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") .attachmentId("testString") - .id("130003ea8bfa43c5aacea07a86da3000") - .profileId("7ec45986-54fc-4b66-a303-d9577b078c65") - .accountId("130003ea8bfa43c5aacea07a86da3000") - .instanceId("edf9524f-406c-412c-acbb-ee371a5cabda") - .scope(java.util.Arrays.asList(multiCloudScopeModel)) - .createdOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .createdBy("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .updatedBy("testString") - .status("enabled") + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .description("testString") + .name("testString") + .notifications(attachmentNotificationsModel) .schedule("daily") - .notifications(attachmentsNotificationsPrototypeModel) - .attachmentParameters(java.util.Arrays.asList(attachmentParameterPrototypeModel)) - .lastScan(lastScanModel) - .nextScanTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .name("account-130003ea8bfa43c5aacea07a86da3000") - .description("Test description") - .xCorrelationId("testString") - .xRequestId("testString") + .scope(java.util.Arrays.asList(multiCloudScopePayloadModel)) + .status("enabled") + .dataSelectionRange(dateRangeModel) + .accountId("testString") .build(); + assertEquals(replaceProfileAttachmentOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(replaceProfileAttachmentOptionsModel.profileId(), "9c265b4a-4cdf-47f1-acd3-17b5808f7f3f"); assertEquals(replaceProfileAttachmentOptionsModel.attachmentId(), "testString"); - assertEquals(replaceProfileAttachmentOptionsModel.id(), "130003ea8bfa43c5aacea07a86da3000"); - assertEquals(replaceProfileAttachmentOptionsModel.profileId(), "7ec45986-54fc-4b66-a303-d9577b078c65"); - assertEquals(replaceProfileAttachmentOptionsModel.accountId(), "130003ea8bfa43c5aacea07a86da3000"); - assertEquals(replaceProfileAttachmentOptionsModel.instanceId(), "edf9524f-406c-412c-acbb-ee371a5cabda"); - assertEquals(replaceProfileAttachmentOptionsModel.scope(), java.util.Arrays.asList(multiCloudScopeModel)); - assertEquals(replaceProfileAttachmentOptionsModel.createdOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(replaceProfileAttachmentOptionsModel.createdBy(), "testString"); - assertEquals(replaceProfileAttachmentOptionsModel.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(replaceProfileAttachmentOptionsModel.updatedBy(), "testString"); - assertEquals(replaceProfileAttachmentOptionsModel.status(), "enabled"); + assertEquals(replaceProfileAttachmentOptionsModel.attachmentParameters(), java.util.Arrays.asList(parameterModel)); + assertEquals(replaceProfileAttachmentOptionsModel.description(), "testString"); + assertEquals(replaceProfileAttachmentOptionsModel.name(), "testString"); + assertEquals(replaceProfileAttachmentOptionsModel.notifications(), attachmentNotificationsModel); assertEquals(replaceProfileAttachmentOptionsModel.schedule(), "daily"); - assertEquals(replaceProfileAttachmentOptionsModel.notifications(), attachmentsNotificationsPrototypeModel); - assertEquals(replaceProfileAttachmentOptionsModel.attachmentParameters(), java.util.Arrays.asList(attachmentParameterPrototypeModel)); - assertEquals(replaceProfileAttachmentOptionsModel.lastScan(), lastScanModel); - assertEquals(replaceProfileAttachmentOptionsModel.nextScanTime(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(replaceProfileAttachmentOptionsModel.name(), "account-130003ea8bfa43c5aacea07a86da3000"); - assertEquals(replaceProfileAttachmentOptionsModel.description(), "Test description"); - assertEquals(replaceProfileAttachmentOptionsModel.xCorrelationId(), "testString"); - assertEquals(replaceProfileAttachmentOptionsModel.xRequestId(), "testString"); + assertEquals(replaceProfileAttachmentOptionsModel.scope(), java.util.Arrays.asList(multiCloudScopePayloadModel)); + assertEquals(replaceProfileAttachmentOptionsModel.status(), "enabled"); + assertEquals(replaceProfileAttachmentOptionsModel.dataSelectionRange(), dateRangeModel); + assertEquals(replaceProfileAttachmentOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) 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 b3b71f15..c5985ca4 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,8 +14,13 @@ 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.DefaultParametersPrototype; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControlsPrototype; +import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlDoc; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecification; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileControls; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -33,45 +38,146 @@ public class ReplaceProfileOptionsTest { @Test public void testReplaceProfileOptions() throws Throwable { - ProfileControlsPrototype profileControlsPrototypeModel = new ProfileControlsPrototype.Builder() - .controlLibraryId("e98a56ff-dc24-41d4-9875-1e188e2da6cd") - .controlId("5C453578-E9A1-421E-AD0F-C6AFCDD67CCF") + ControlDoc controlDocModel = new ControlDoc.Builder() + .controlDocsId("testString") + .controlDocsType("testString") .build(); - assertEquals(profileControlsPrototypeModel.controlLibraryId(), "e98a56ff-dc24-41d4-9875-1e188e2da6cd"); - assertEquals(profileControlsPrototypeModel.controlId(), "5C453578-E9A1-421E-AD0F-C6AFCDD67CCF"); + assertEquals(controlDocModel.controlDocsId(), "testString"); + assertEquals(controlDocModel.controlDocsType(), "testString"); - DefaultParametersPrototype defaultParametersPrototypeModel = new DefaultParametersPrototype.Builder() + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); + + Assessment assessmentModel = new Assessment.Builder() + .assessmentId("382c2b06-e6b2-43ee-b189-c1c7743b67ee") + .assessmentType("ibm-cloud-rule") + .assessmentMethod("ibm-cloud-rule") + .assessmentDescription("Check whether Cloud Object Storage is accessible only by using private endpoints") + .parameterCount(Long.valueOf("1")) + .parameters(java.util.Arrays.asList(parameterModel)) + .build(); + assertEquals(assessmentModel.assessmentId(), "382c2b06-e6b2-43ee-b189-c1c7743b67ee"); + assertEquals(assessmentModel.assessmentType(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentMethod(), "ibm-cloud-rule"); + assertEquals(assessmentModel.assessmentDescription(), "Check whether Cloud Object Storage is accessible only by using private endpoints"); + assertEquals(assessmentModel.parameterCount(), Long.valueOf("1")); + assertEquals(assessmentModel.parameters(), java.util.Arrays.asList(parameterModel)); + + ControlSpecification controlSpecificationModel = new ControlSpecification.Builder() + .id("testString") + .responsibility("testString") + .componentId("testString") + .componentName("testString") + .componentType("testString") + .environment("testString") + .description("testString") + .assessmentsCount(Long.valueOf("26")) + .assessments(java.util.Arrays.asList(assessmentModel)) + .build(); + assertEquals(controlSpecificationModel.id(), "testString"); + assertEquals(controlSpecificationModel.responsibility(), "testString"); + assertEquals(controlSpecificationModel.componentId(), "testString"); + assertEquals(controlSpecificationModel.componentName(), "testString"); + assertEquals(controlSpecificationModel.componentType(), "testString"); + assertEquals(controlSpecificationModel.environment(), "testString"); + assertEquals(controlSpecificationModel.description(), "testString"); + assertEquals(controlSpecificationModel.assessmentsCount(), Long.valueOf("26")); + assertEquals(controlSpecificationModel.assessments(), java.util.Arrays.asList(assessmentModel)); + + ProfileControls profileControlsModel = new ProfileControls.Builder() + .controlRequirement(true) + .controlLibraryId("testString") + .controlId("testString") + .controlLibraryVersion("testString") + .controlName("testString") + .controlDescription("testString") + .controlSeverity("testString") + .controlCategory("testString") + .controlParent("testString") + .controlDocs(controlDocModel) + .controlSpecifications(java.util.Arrays.asList(controlSpecificationModel)) + .build(); + assertEquals(profileControlsModel.controlRequirement(), Boolean.valueOf(true)); + assertEquals(profileControlsModel.controlLibraryId(), "testString"); + assertEquals(profileControlsModel.controlId(), "testString"); + assertEquals(profileControlsModel.controlLibraryVersion(), "testString"); + assertEquals(profileControlsModel.controlName(), "testString"); + assertEquals(profileControlsModel.controlDescription(), "testString"); + assertEquals(profileControlsModel.controlSeverity(), "testString"); + assertEquals(profileControlsModel.controlCategory(), "testString"); + assertEquals(profileControlsModel.controlParent(), "testString"); + assertEquals(profileControlsModel.controlDocs(), controlDocModel); + assertEquals(profileControlsModel.controlSpecifications(), java.util.Arrays.asList(controlSpecificationModel)); + + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() .assessmentType("testString") .assessmentId("testString") .parameterName("testString") .parameterDefaultValue("testString") .parameterDisplayName("testString") - .parameterType("string") + .parameterType("testString") .build(); - assertEquals(defaultParametersPrototypeModel.assessmentType(), "testString"); - assertEquals(defaultParametersPrototypeModel.assessmentId(), "testString"); - assertEquals(defaultParametersPrototypeModel.parameterName(), "testString"); - assertEquals(defaultParametersPrototypeModel.parameterDefaultValue(), "testString"); - assertEquals(defaultParametersPrototypeModel.parameterDisplayName(), "testString"); - assertEquals(defaultParametersPrototypeModel.parameterType(), "string"); + assertEquals(defaultParametersModel.assessmentType(), "testString"); + assertEquals(defaultParametersModel.assessmentId(), "testString"); + assertEquals(defaultParametersModel.parameterName(), "testString"); + assertEquals(defaultParametersModel.parameterDefaultValue(), "testString"); + assertEquals(defaultParametersModel.parameterDisplayName(), "testString"); + assertEquals(defaultParametersModel.parameterType(), "testString"); ReplaceProfileOptions replaceProfileOptionsModel = new ReplaceProfileOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .profileId("testString") - .profileName("testString") - .profileDescription("testString") - .profileType("predefined") - .controls(java.util.Arrays.asList(profileControlsPrototypeModel)) - .defaultParameters(java.util.Arrays.asList(defaultParametersPrototypeModel)) - .xCorrelationId("testString") - .xRequestId("testString") + .newProfileType("custom") + .newControls(java.util.Arrays.asList(profileControlsModel)) + .newDefaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .newId("testString") + .newProfileName("testString") + .newInstanceId("testString") + .newHierarchyEnabled(true) + .newProfileDescription("testString") + .newProfileVersion("testString") + .newVersionGroupLabel("testString") + .newLatest(true) + .newCreatedBy("testString") + .newCreatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + .newUpdatedBy("testString") + .newUpdatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + .newControlsCount(Long.valueOf("26")) + .newAttachmentsCount(Long.valueOf("26")) + .accountId("testString") .build(); - assertEquals(replaceProfileOptionsModel.profileName(), "testString"); - assertEquals(replaceProfileOptionsModel.profileDescription(), "testString"); - assertEquals(replaceProfileOptionsModel.profileType(), "predefined"); - assertEquals(replaceProfileOptionsModel.controls(), java.util.Arrays.asList(profileControlsPrototypeModel)); - assertEquals(replaceProfileOptionsModel.defaultParameters(), java.util.Arrays.asList(defaultParametersPrototypeModel)); - assertEquals(replaceProfileOptionsModel.xCorrelationId(), "testString"); - assertEquals(replaceProfileOptionsModel.xRequestId(), "testString"); + assertEquals(replaceProfileOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(replaceProfileOptionsModel.profileId(), "testString"); + assertEquals(replaceProfileOptionsModel.newProfileType(), "custom"); + assertEquals(replaceProfileOptionsModel.newControls(), java.util.Arrays.asList(profileControlsModel)); + assertEquals(replaceProfileOptionsModel.newDefaultParameters(), java.util.Arrays.asList(defaultParametersModel)); + assertEquals(replaceProfileOptionsModel.newId(), "testString"); + assertEquals(replaceProfileOptionsModel.newProfileName(), "testString"); + assertEquals(replaceProfileOptionsModel.newInstanceId(), "testString"); + assertEquals(replaceProfileOptionsModel.newHierarchyEnabled(), Boolean.valueOf(true)); + assertEquals(replaceProfileOptionsModel.newProfileDescription(), "testString"); + assertEquals(replaceProfileOptionsModel.newProfileVersion(), "testString"); + assertEquals(replaceProfileOptionsModel.newVersionGroupLabel(), "testString"); + assertEquals(replaceProfileOptionsModel.newLatest(), Boolean.valueOf(true)); + assertEquals(replaceProfileOptionsModel.newCreatedBy(), "testString"); + assertEquals(replaceProfileOptionsModel.newCreatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + assertEquals(replaceProfileOptionsModel.newUpdatedBy(), "testString"); + assertEquals(replaceProfileOptionsModel.newUpdatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + assertEquals(replaceProfileOptionsModel.newControlsCount(), Long.valueOf("26")); + assertEquals(replaceProfileOptionsModel.newAttachmentsCount(), Long.valueOf("26")); + assertEquals(replaceProfileOptionsModel.accountId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileParametersOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileParametersOptionsTest.java new file mode 100644 index 00000000..34f1febb --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceProfileParametersOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.DefaultParameters; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceProfileParametersOptions; +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 ReplaceProfileParametersOptions model. + */ +public class ReplaceProfileParametersOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceProfileParametersOptions() throws Throwable { + DefaultParameters defaultParametersModel = new DefaultParameters.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("testString") + .parameterDefaultValue("testString") + .parameterDisplayName("testString") + .parameterType("testString") + .build(); + assertEquals(defaultParametersModel.assessmentType(), "testString"); + assertEquals(defaultParametersModel.assessmentId(), "testString"); + assertEquals(defaultParametersModel.parameterName(), "testString"); + assertEquals(defaultParametersModel.parameterDefaultValue(), "testString"); + assertEquals(defaultParametersModel.parameterDisplayName(), "testString"); + assertEquals(defaultParametersModel.parameterType(), "testString"); + + ReplaceProfileParametersOptions replaceProfileParametersOptionsModel = new ReplaceProfileParametersOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("testString") + .defaultParameters(java.util.Arrays.asList(defaultParametersModel)) + .id("testString") + .accountId("testString") + .build(); + assertEquals(replaceProfileParametersOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(replaceProfileParametersOptionsModel.profileId(), "testString"); + assertEquals(replaceProfileParametersOptionsModel.defaultParameters(), java.util.Arrays.asList(defaultParametersModel)); + assertEquals(replaceProfileParametersOptionsModel.id(), "testString"); + assertEquals(replaceProfileParametersOptionsModel.accountId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceProfileParametersOptionsError() throws Throwable { + new ReplaceProfileParametersOptions.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/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 8842b0b6..47ff1d26 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -16,12 +16,10 @@ 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.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.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.model.RequiredConfigConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleParameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTargetPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -47,78 +45,62 @@ public void testReplaceRuleOptions() throws Throwable { assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); assertEquals(additionalTargetAttributeModel.value(), "testString"); - TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() + RuleTargetPrototype ruleTargetPrototypeModel = new RuleTargetPrototype.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)); + assertEquals(ruleTargetPrototypeModel.serviceName(), "testString"); + assertEquals(ruleTargetPrototypeModel.resourceKind(), "testString"); + assertEquals(ruleTargetPrototypeModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); - RequiredConfigBase requiredConfigBaseModel = new RequiredConfigBase.Builder() + RequiredConfigConditionBase requiredConfigModel = new RequiredConfigConditionBase.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 requiredConfigModel = new RequiredConfigAnd.Builder() - .description("testString") - .and(java.util.Arrays.asList(requiredConfigItemsModel)) - .build(); assertEquals(requiredConfigModel.description(), "testString"); - assertEquals(requiredConfigModel.and(), java.util.Arrays.asList(requiredConfigItemsModel)); + assertEquals(requiredConfigModel.property(), "testString"); + assertEquals(requiredConfigModel.operator(), "string_equals"); + assertEquals(requiredConfigModel.value(), "testString"); - Parameter parameterModel = new Parameter.Builder() + RuleParameter ruleParameterModel = new RuleParameter.Builder() .name("testString") .displayName("testString") .description("testString") .type("string") .build(); - assertEquals(parameterModel.name(), "testString"); - assertEquals(parameterModel.displayName(), "testString"); - assertEquals(parameterModel.description(), "testString"); - assertEquals(parameterModel.type(), "string"); + assertEquals(ruleParameterModel.name(), "testString"); + assertEquals(ruleParameterModel.displayName(), "testString"); + assertEquals(ruleParameterModel.description(), "testString"); + assertEquals(ruleParameterModel.type(), "string"); Import importModel = new Import.Builder() - .parameters(java.util.Arrays.asList(parameterModel)) + .parameters(java.util.Arrays.asList(ruleParameterModel)) .build(); - assertEquals(importModel.parameters(), java.util.Arrays.asList(parameterModel)); + assertEquals(importModel.parameters(), java.util.Arrays.asList(ruleParameterModel)); ReplaceRuleOptions replaceRuleOptionsModel = new ReplaceRuleOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") .ruleId("testString") .ifMatch("testString") .description("testString") - .target(targetPrototypeModel) + .target(ruleTargetPrototypeModel) .requiredConfig(requiredConfigModel) .version("testString") .xImport(importModel) .labels(java.util.Arrays.asList("testString")) - .xCorrelationId("testString") - .xRequestId("testString") .build(); + assertEquals(replaceRuleOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); assertEquals(replaceRuleOptionsModel.ruleId(), "testString"); assertEquals(replaceRuleOptionsModel.ifMatch(), "testString"); assertEquals(replaceRuleOptionsModel.description(), "testString"); - assertEquals(replaceRuleOptionsModel.target(), targetPrototypeModel); + assertEquals(replaceRuleOptionsModel.target(), ruleTargetPrototypeModel); assertEquals(replaceRuleOptionsModel.requiredConfig(), requiredConfigModel); assertEquals(replaceRuleOptionsModel.version(), "testString"); assertEquals(replaceRuleOptionsModel.xImport(), importModel); assertEquals(replaceRuleOptionsModel.labels(), java.util.Arrays.asList("testString")); - assertEquals(replaceRuleOptionsModel.xCorrelationId(), "testString"); - assertEquals(replaceRuleOptionsModel.xRequestId(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceTargetOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceTargetOptionsTest.java new file mode 100644 index 00000000..88dfb765 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReplaceTargetOptionsTest.java @@ -0,0 +1,123 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Credential; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReplaceTargetOptions; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Resource; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; +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 ReplaceTargetOptions model. + */ +public class ReplaceTargetOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReplaceTargetOptions() throws Throwable { + Account accountModel = new Account.Builder() + .id("531fc3e28bfc43c5a2cea07786d93f5c") + .name("NIST") + .type("account_type") + .build(); + assertEquals(accountModel.id(), "531fc3e28bfc43c5a2cea07786d93f5c"); + assertEquals(accountModel.name(), "NIST"); + assertEquals(accountModel.type(), "account_type"); + + Tags tagsModel = new Tags.Builder() + .user(java.util.Arrays.asList("testString")) + .access(java.util.Arrays.asList("testString")) + .service(java.util.Arrays.asList("testString")) + .build(); + assertEquals(tagsModel.user(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.access(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.service(), java.util.Arrays.asList("testString")); + + Resource resourceModel = new Resource.Builder() + .reportId("30b434b3-cb08-4845-af10-7a8fc682b6a8") + .homeAccountId("2411ffdc16844b07b42521c3443f456d") + .id("crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::") + .resourceName("jeff's key") + .account(accountModel) + .componentId("cloud-object_storage") + .componentName("cloud-object_storage") + .environment("ibm cloud") + .tags(tagsModel) + .status("compliant") + .totalCount(Long.valueOf("140")) + .passCount(Long.valueOf("123")) + .failureCount(Long.valueOf("12")) + .errorCount(Long.valueOf("5")) + .skippedCount(Long.valueOf("7")) + .completedCount(Long.valueOf("135")) + .serviceName("pm-20") + .instanceCrn("testString") + .build(); + assertEquals(resourceModel.reportId(), "30b434b3-cb08-4845-af10-7a8fc682b6a8"); + assertEquals(resourceModel.homeAccountId(), "2411ffdc16844b07b42521c3443f456d"); + assertEquals(resourceModel.id(), "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::"); + assertEquals(resourceModel.resourceName(), "jeff's key"); + assertEquals(resourceModel.account(), accountModel); + assertEquals(resourceModel.componentId(), "cloud-object_storage"); + assertEquals(resourceModel.componentName(), "cloud-object_storage"); + assertEquals(resourceModel.environment(), "ibm cloud"); + assertEquals(resourceModel.tags(), tagsModel); + assertEquals(resourceModel.status(), "compliant"); + assertEquals(resourceModel.totalCount(), Long.valueOf("140")); + assertEquals(resourceModel.passCount(), Long.valueOf("123")); + assertEquals(resourceModel.failureCount(), Long.valueOf("12")); + assertEquals(resourceModel.errorCount(), Long.valueOf("5")); + assertEquals(resourceModel.skippedCount(), Long.valueOf("7")); + assertEquals(resourceModel.completedCount(), Long.valueOf("135")); + assertEquals(resourceModel.serviceName(), "pm-20"); + assertEquals(resourceModel.instanceCrn(), "testString"); + + Credential credentialModel = new Credential.Builder() + .secretCrn("dummy") + .resources(java.util.Arrays.asList(resourceModel)) + .build(); + assertEquals(credentialModel.secretCrn(), "dummy"); + assertEquals(credentialModel.resources(), java.util.Arrays.asList(resourceModel)); + + ReplaceTargetOptions replaceTargetOptionsModel = new ReplaceTargetOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .targetId("testString") + .accountId("be200c80cabc456e91139e4152327823") + .trustedProfileId("Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3") + .name("Sample Target Name") + .credentials(java.util.Arrays.asList(credentialModel)) + .build(); + assertEquals(replaceTargetOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(replaceTargetOptionsModel.targetId(), "testString"); + assertEquals(replaceTargetOptionsModel.accountId(), "be200c80cabc456e91139e4152327823"); + assertEquals(replaceTargetOptionsModel.trustedProfileId(), "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3"); + assertEquals(replaceTargetOptionsModel.name(), "Sample Target Name"); + assertEquals(replaceTargetOptionsModel.credentials(), java.util.Arrays.asList(credentialModel)); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testReplaceTargetOptionsError() throws Throwable { + new ReplaceTargetOptions.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/ReportCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportCollectionTest.java new file mode 100644 index 00000000..313515ff --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportCollectionTest.java @@ -0,0 +1,61 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalDetails; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Attachment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceStatsWithNonCompliant; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSummary; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvalStats; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Link; +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.ProfileInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Report; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeID; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; +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 ReportCollection model. + */ +public class ReportCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReportCollection() throws Throwable { + ReportCollection reportCollectionModel = new ReportCollection(); + assertNull(reportCollectionModel.getLimit()); + assertNull(reportCollectionModel.getTotalCount()); + assertNull(reportCollectionModel.getFirst()); + assertNull(reportCollectionModel.getNext()); + assertNull(reportCollectionModel.getHomeAccountId()); + assertNull(reportCollectionModel.getReports()); + } +} \ 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/ReportControlsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportControlsTest.java index b61488c1..eaf8aeee 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportControlsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportControlsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,11 +14,12 @@ 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.Assessment; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AssessmentWithStats; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSpecificationWithStats; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlWithStats; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ParameterInfo; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -36,14 +37,8 @@ public class ReportControlsTest { @Test public void testReportControls() throws Throwable { ReportControls reportControlsModel = new ReportControls(); - assertNull(reportControlsModel.getStatus()); - assertNull(reportControlsModel.getTotalCount()); - assertNull(reportControlsModel.getCompliantCount()); - assertNull(reportControlsModel.getNotCompliantCount()); - assertNull(reportControlsModel.getUnableToPerformCount()); - assertNull(reportControlsModel.getUserEvaluationRequiredCount()); - assertNull(reportControlsModel.getHomeAccountId()); assertNull(reportControlsModel.getReportId()); + assertNull(reportControlsModel.getHomeAccountId()); assertNull(reportControlsModel.getControls()); } } \ 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/ReportLatestTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportLatestTest.java index 4d344dc4..e01b1a4e 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportLatestTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportLatestTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,16 +14,26 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; 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.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Attachment; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceScore; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceStats; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceStatsWithNonCompliant; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSummary; import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvalStats; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Link; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Report; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportLatest; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeID; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; 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/ReportScopeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportScopeTest.java new file mode 100644 index 00000000..61a21da6 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportScopeTest.java @@ -0,0 +1,40 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ReportScope; +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 ReportScope model. + */ +public class ReportScopeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testReportScope() throws Throwable { + ReportScope reportScopeModel = new ReportScope(); + assertNull(reportScopeModel.getId()); + assertNull(reportScopeModel.getName()); + assertNull(reportScopeModel.getHref()); + assertNull(reportScopeModel.getEnvironment()); + } +} \ 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/ReportSummaryTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportSummaryTest.java index ff2b0cae..d9e2332d 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportSummaryTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportSummaryTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -40,11 +40,11 @@ public class ReportSummaryTest { public void testReportSummary() throws Throwable { ReportSummary reportSummaryModel = new ReportSummary(); assertNull(reportSummaryModel.getReportId()); - assertNull(reportSummaryModel.getIsntanceId()); + assertNull(reportSummaryModel.getInstanceId()); assertNull(reportSummaryModel.getAccount()); assertNull(reportSummaryModel.getScore()); - assertNull(reportSummaryModel.getControls()); assertNull(reportSummaryModel.getEvaluations()); + assertNull(reportSummaryModel.getControls()); assertNull(reportSummaryModel.getResources()); } } \ 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/ReportTagsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTagsTest.java index ae466f9c..63336f43 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTagsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTagsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTest.java index 1a9be977..c5400bd0 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,12 +14,23 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; 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.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Attachment; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotifications; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AttachmentNotificationsControls; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComplianceStatsWithNonCompliant; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlSummary; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EvalStats; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Link; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ProfileInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Report; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ReportScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeID; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -38,14 +49,20 @@ public class ReportTest { public void testReport() throws Throwable { Report reportModel = new Report(); assertNull(reportModel.getId()); + assertNull(reportModel.getType()); assertNull(reportModel.getGroupId()); assertNull(reportModel.getCreatedOn()); assertNull(reportModel.getScanTime()); - assertNull(reportModel.getType()); assertNull(reportModel.getCosObject()); assertNull(reportModel.getInstanceId()); assertNull(reportModel.getAccount()); assertNull(reportModel.getProfile()); + assertNull(reportModel.getScope()); assertNull(reportModel.getAttachment()); + assertNull(reportModel.getControlsSummary()); + assertNull(reportModel.getEvaluationsSummary()); + assertNull(reportModel.getTags()); + assertNull(reportModel.getScopes()); + assertNull(reportModel.getAdditionalDetails()); } } \ 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/ReportViolationDataPointTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationDataPointTest.java index f3f50a91..6a46619f 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationDataPointTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationDataPointTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -36,6 +36,6 @@ public void testReportViolationDataPoint() throws Throwable { assertNull(reportViolationDataPointModel.getReportId()); assertNull(reportViolationDataPointModel.getReportGroupId()); assertNull(reportViolationDataPointModel.getScanTime()); - assertNull(reportViolationDataPointModel.getControls()); + assertNull(reportViolationDataPointModel.getControlsSummary()); } } \ 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/ReportViolationsDriftTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationsDriftTest.java index 8e85ce62..0e09b9b3 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationsDriftTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ReportViolationsDriftTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -35,7 +35,7 @@ public class ReportViolationsDriftTest { public void testReportViolationsDrift() throws Throwable { ReportViolationsDrift reportViolationsDriftModel = new ReportViolationsDrift(); assertNull(reportViolationsDriftModel.getHomeAccountId()); - assertNull(reportViolationsDriftModel.getReportId()); + assertNull(reportViolationsDriftModel.getReportGroupId()); assertNull(reportViolationsDriftModel.getDataPoints()); } } \ 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/RequiredConfigConditionBaseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionBaseTest.java new file mode 100644 index 00000000..de6c0700 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionBaseTest.java @@ -0,0 +1,60 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RequiredConfigConditionBase; +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 RequiredConfigConditionBase model. + */ +public class RequiredConfigConditionBaseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigConditionBase() throws Throwable { + RequiredConfigConditionBase requiredConfigConditionBaseModel = new RequiredConfigConditionBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(requiredConfigConditionBaseModel.description(), "testString"); + assertEquals(requiredConfigConditionBaseModel.property(), "testString"); + assertEquals(requiredConfigConditionBaseModel.operator(), "string_equals"); + assertEquals(requiredConfigConditionBaseModel.value(), "testString"); + + String json = TestUtilities.serialize(requiredConfigConditionBaseModel); + + RequiredConfigConditionBase requiredConfigConditionBaseModelNew = TestUtilities.deserialize(json, RequiredConfigConditionBase.class); + assertTrue(requiredConfigConditionBaseModelNew instanceof RequiredConfigConditionBase); + assertEquals(requiredConfigConditionBaseModelNew.description(), "testString"); + assertEquals(requiredConfigConditionBaseModelNew.property(), "testString"); + assertEquals(requiredConfigConditionBaseModelNew.operator(), "string_equals"); + assertEquals(requiredConfigConditionBaseModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRequiredConfigConditionBaseError() throws Throwable { + new RequiredConfigConditionBase.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/RequiredConfigConditionListConditionListConditionAndTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionAndTest.java new file mode 100644 index 00000000..ec441a97 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionAndTest.java @@ -0,0 +1,59 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionListConditionListConditionAnd; +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 RequiredConfigConditionListConditionListConditionAnd model. + */ +public class RequiredConfigConditionListConditionListConditionAndTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigConditionListConditionListConditionAnd() throws Throwable { + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(conditionItemModel.description(), "testString"); + assertEquals(conditionItemModel.property(), "testString"); + assertEquals(conditionItemModel.operator(), "string_equals"); + assertEquals(conditionItemModel.value(), "testString"); + + RequiredConfigConditionListConditionListConditionAnd requiredConfigConditionListConditionListConditionAndModel = new RequiredConfigConditionListConditionListConditionAnd.Builder() + .description("testString") + .and(java.util.Arrays.asList(conditionItemModel)) + .build(); + assertEquals(requiredConfigConditionListConditionListConditionAndModel.description(), "testString"); + assertEquals(requiredConfigConditionListConditionListConditionAndModel.and(), java.util.Arrays.asList(conditionItemModel)); + + String json = TestUtilities.serialize(requiredConfigConditionListConditionListConditionAndModel); + + RequiredConfigConditionListConditionListConditionAnd requiredConfigConditionListConditionListConditionAndModelNew = TestUtilities.deserialize(json, RequiredConfigConditionListConditionListConditionAnd.class); + assertTrue(requiredConfigConditionListConditionListConditionAndModelNew instanceof RequiredConfigConditionListConditionListConditionAnd); + assertEquals(requiredConfigConditionListConditionListConditionAndModelNew.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/RequiredConfigConditionListConditionListConditionOrTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionOrTest.java new file mode 100644 index 00000000..1d44c7c6 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListConditionListConditionOrTest.java @@ -0,0 +1,59 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionListConditionListConditionOr; +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 RequiredConfigConditionListConditionListConditionOr model. + */ +public class RequiredConfigConditionListConditionListConditionOrTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigConditionListConditionListConditionOr() throws Throwable { + ConditionItemConditionBase conditionItemModel = new ConditionItemConditionBase.Builder() + .description("testString") + .property("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(conditionItemModel.description(), "testString"); + assertEquals(conditionItemModel.property(), "testString"); + assertEquals(conditionItemModel.operator(), "string_equals"); + assertEquals(conditionItemModel.value(), "testString"); + + RequiredConfigConditionListConditionListConditionOr requiredConfigConditionListConditionListConditionOrModel = new RequiredConfigConditionListConditionListConditionOr.Builder() + .description("testString") + .or(java.util.Arrays.asList(conditionItemModel)) + .build(); + assertEquals(requiredConfigConditionListConditionListConditionOrModel.description(), "testString"); + assertEquals(requiredConfigConditionListConditionListConditionOrModel.or(), java.util.Arrays.asList(conditionItemModel)); + + String json = TestUtilities.serialize(requiredConfigConditionListConditionListConditionOrModel); + + RequiredConfigConditionListConditionListConditionOr requiredConfigConditionListConditionListConditionOrModelNew = TestUtilities.deserialize(json, RequiredConfigConditionListConditionListConditionOr.class); + assertTrue(requiredConfigConditionListConditionListConditionOrModelNew instanceof RequiredConfigConditionListConditionListConditionOr); + assertEquals(requiredConfigConditionListConditionListConditionOrModelNew.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/RequiredConfigConditionListTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListTest.java new file mode 100644 index 00000000..a2e3e91c --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionListTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConditionItemConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionList; +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 RequiredConfigConditionList model. + */ +public class RequiredConfigConditionListTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testRequiredConfigConditionList() throws Throwable { + RequiredConfigConditionList requiredConfigConditionListModel = new RequiredConfigConditionList(); + assertNotNull(requiredConfigConditionListModel); + } +} \ 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/RequiredConfigConditionSubRuleConditionSubRuleConditionAllIfTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAllIfTest.java new file mode 100644 index 00000000..b1dd5249 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAllIfTest.java @@ -0,0 +1,75 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf model. + */ +public class RequiredConfigConditionSubRuleConditionSubRuleConditionAllIfTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigConditionSubRuleConditionSubRuleConditionAllIf() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + SubRule subRuleModel = new SubRule.Builder() + .target(ruleTargetModel) + .build(); + assertEquals(subRuleModel.target(), ruleTargetModel); + + RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf requiredConfigConditionSubRuleConditionSubRuleConditionAllIfModel = new RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf.Builder() + .allIfexists(subRuleModel) + .build(); + assertEquals(requiredConfigConditionSubRuleConditionSubRuleConditionAllIfModel.allIfexists(), subRuleModel); + + String json = TestUtilities.serialize(requiredConfigConditionSubRuleConditionSubRuleConditionAllIfModel); + + RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf requiredConfigConditionSubRuleConditionSubRuleConditionAllIfModelNew = TestUtilities.deserialize(json, RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf.class); + assertTrue(requiredConfigConditionSubRuleConditionSubRuleConditionAllIfModelNew instanceof RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf); + assertEquals(requiredConfigConditionSubRuleConditionSubRuleConditionAllIfModelNew.allIfexists().toString(), subRuleModel.toString()); + } +} \ 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/RequiredConfigConditionSubRuleConditionSubRuleConditionAllTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAllTest.java new file mode 100644 index 00000000..ea41906d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAllTest.java @@ -0,0 +1,75 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RequiredConfigConditionSubRuleConditionSubRuleConditionAll; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 RequiredConfigConditionSubRuleConditionSubRuleConditionAll model. + */ +public class RequiredConfigConditionSubRuleConditionSubRuleConditionAllTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigConditionSubRuleConditionSubRuleConditionAll() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + SubRule subRuleModel = new SubRule.Builder() + .target(ruleTargetModel) + .build(); + assertEquals(subRuleModel.target(), ruleTargetModel); + + RequiredConfigConditionSubRuleConditionSubRuleConditionAll requiredConfigConditionSubRuleConditionSubRuleConditionAllModel = new RequiredConfigConditionSubRuleConditionSubRuleConditionAll.Builder() + .all(subRuleModel) + .build(); + assertEquals(requiredConfigConditionSubRuleConditionSubRuleConditionAllModel.all(), subRuleModel); + + String json = TestUtilities.serialize(requiredConfigConditionSubRuleConditionSubRuleConditionAllModel); + + RequiredConfigConditionSubRuleConditionSubRuleConditionAll requiredConfigConditionSubRuleConditionSubRuleConditionAllModelNew = TestUtilities.deserialize(json, RequiredConfigConditionSubRuleConditionSubRuleConditionAll.class); + assertTrue(requiredConfigConditionSubRuleConditionSubRuleConditionAllModelNew instanceof RequiredConfigConditionSubRuleConditionSubRuleConditionAll); + assertEquals(requiredConfigConditionSubRuleConditionSubRuleConditionAllModelNew.all().toString(), subRuleModel.toString()); + } +} \ 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/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIfTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIfTest.java new file mode 100644 index 00000000..1133ed4e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIfTest.java @@ -0,0 +1,75 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf model. + */ +public class RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIfTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + SubRule subRuleModel = new SubRule.Builder() + .target(ruleTargetModel) + .build(); + assertEquals(subRuleModel.target(), ruleTargetModel); + + RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf requiredConfigConditionSubRuleConditionSubRuleConditionAnyIfModel = new RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf.Builder() + .anyIfexists(subRuleModel) + .build(); + assertEquals(requiredConfigConditionSubRuleConditionSubRuleConditionAnyIfModel.anyIfexists(), subRuleModel); + + String json = TestUtilities.serialize(requiredConfigConditionSubRuleConditionSubRuleConditionAnyIfModel); + + RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf requiredConfigConditionSubRuleConditionSubRuleConditionAnyIfModelNew = TestUtilities.deserialize(json, RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf.class); + assertTrue(requiredConfigConditionSubRuleConditionSubRuleConditionAnyIfModelNew instanceof RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf); + assertEquals(requiredConfigConditionSubRuleConditionSubRuleConditionAnyIfModelNew.anyIfexists().toString(), subRuleModel.toString()); + } +} \ 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/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyTest.java new file mode 100644 index 00000000..9d237a14 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleConditionSubRuleConditionAnyTest.java @@ -0,0 +1,75 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RequiredConfigConditionSubRuleConditionSubRuleConditionAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 RequiredConfigConditionSubRuleConditionSubRuleConditionAny model. + */ +public class RequiredConfigConditionSubRuleConditionSubRuleConditionAnyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRequiredConfigConditionSubRuleConditionSubRuleConditionAny() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + SubRule subRuleModel = new SubRule.Builder() + .target(ruleTargetModel) + .build(); + assertEquals(subRuleModel.target(), ruleTargetModel); + + RequiredConfigConditionSubRuleConditionSubRuleConditionAny requiredConfigConditionSubRuleConditionSubRuleConditionAnyModel = new RequiredConfigConditionSubRuleConditionSubRuleConditionAny.Builder() + .any(subRuleModel) + .build(); + assertEquals(requiredConfigConditionSubRuleConditionSubRuleConditionAnyModel.any(), subRuleModel); + + String json = TestUtilities.serialize(requiredConfigConditionSubRuleConditionSubRuleConditionAnyModel); + + RequiredConfigConditionSubRuleConditionSubRuleConditionAny requiredConfigConditionSubRuleConditionSubRuleConditionAnyModelNew = TestUtilities.deserialize(json, RequiredConfigConditionSubRuleConditionSubRuleConditionAny.class); + assertTrue(requiredConfigConditionSubRuleConditionSubRuleConditionAnyModelNew instanceof RequiredConfigConditionSubRuleConditionSubRuleConditionAny); + assertEquals(requiredConfigConditionSubRuleConditionSubRuleConditionAnyModelNew.any().toString(), subRuleModel.toString()); + } +} \ 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/RequiredConfigConditionSubRuleTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleTest.java new file mode 100644 index 00000000..2c033e04 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigConditionSubRuleTest.java @@ -0,0 +1,41 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RequiredConfigConditionSubRule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 RequiredConfigConditionSubRule model. + */ +public class RequiredConfigConditionSubRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + // TODO: Add tests for models that are abstract + @Test + public void testRequiredConfigConditionSubRule() throws Throwable { + RequiredConfigConditionSubRule requiredConfigConditionSubRuleModel = new RequiredConfigConditionSubRule(); + assertNotNull(requiredConfigConditionSubRuleModel); + } +} \ 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 34309d65..35f42efd 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,8 +15,6 @@ 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.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/ResourcePageTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourcePageTest.java index 48cfbd29..70878f89 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourcePageTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourcePageTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,9 +15,11 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Account; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.PageHRef; +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.Resource; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ResourcePage; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -35,13 +37,12 @@ public class ResourcePageTest { @Test public void testResourcePage() throws Throwable { ResourcePage resourcePageModel = new ResourcePage(); - assertNull(resourcePageModel.getTotalCount()); assertNull(resourcePageModel.getLimit()); - assertNull(resourcePageModel.getStart()); + assertNull(resourcePageModel.getTotalCount()); assertNull(resourcePageModel.getFirst()); assertNull(resourcePageModel.getNext()); - assertNull(resourcePageModel.getHomeAccountId()); assertNull(resourcePageModel.getReportId()); + assertNull(resourcePageModel.getHomeAccountId()); assertNull(resourcePageModel.getResources()); } } \ 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/ResourceSummaryItemTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryItemTest.java index a6530337..b53faeb9 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryItemTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryItemTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -33,16 +33,18 @@ public class ResourceSummaryItemTest { @Test public void testResourceSummaryItem() throws Throwable { ResourceSummaryItem resourceSummaryItemModel = new ResourceSummaryItem(); - assertNull(resourceSummaryItemModel.getName()); assertNull(resourceSummaryItemModel.getId()); + assertNull(resourceSummaryItemModel.getName()); + assertNull(resourceSummaryItemModel.getAccount()); assertNull(resourceSummaryItemModel.getService()); + assertNull(resourceSummaryItemModel.getServiceDisplayName()); assertNull(resourceSummaryItemModel.getTags()); - assertNull(resourceSummaryItemModel.getAccount()); assertNull(resourceSummaryItemModel.getStatus()); assertNull(resourceSummaryItemModel.getTotalCount()); assertNull(resourceSummaryItemModel.getPassCount()); assertNull(resourceSummaryItemModel.getFailureCount()); assertNull(resourceSummaryItemModel.getErrorCount()); + assertNull(resourceSummaryItemModel.getSkippedCount()); assertNull(resourceSummaryItemModel.getCompletedCount()); } } \ 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/ResourceSummaryTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryTest.java index d8464449..6ffc3e6a 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceSummaryTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -40,6 +40,7 @@ public void testResourceSummary() throws Throwable { assertNull(resourceSummaryModel.getNotCompliantCount()); assertNull(resourceSummaryModel.getUnableToPerformCount()); assertNull(resourceSummaryModel.getUserEvaluationRequiredCount()); + assertNull(resourceSummaryModel.getNotApplicableCount()); assertNull(resourceSummaryModel.getTopFailed()); } } \ 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/ResourceTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceTest.java index 81e87bbc..d3d9fa6f 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ResourceTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -16,6 +16,7 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Account; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Resource; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -32,18 +33,90 @@ public class ResourceTest { @Test public void testResource() throws Throwable { - Resource resourceModel = new Resource(); - assertNull(resourceModel.getReportId()); - assertNull(resourceModel.getId()); - assertNull(resourceModel.getResourceName()); - assertNull(resourceModel.getComponentId()); - assertNull(resourceModel.getEnvironment()); - assertNull(resourceModel.getAccount()); - assertNull(resourceModel.getStatus()); - assertNull(resourceModel.getTotalCount()); - assertNull(resourceModel.getPassCount()); - assertNull(resourceModel.getFailureCount()); - assertNull(resourceModel.getErrorCount()); - assertNull(resourceModel.getCompletedCount()); + Account accountModel = new Account.Builder() + .id("531fc3e28bfc43c5a2cea07786d93f5c") + .name("NIST") + .type("account_type") + .build(); + assertEquals(accountModel.id(), "531fc3e28bfc43c5a2cea07786d93f5c"); + assertEquals(accountModel.name(), "NIST"); + assertEquals(accountModel.type(), "account_type"); + + Tags tagsModel = new Tags.Builder() + .user(java.util.Arrays.asList("testString")) + .access(java.util.Arrays.asList("testString")) + .service(java.util.Arrays.asList("testString")) + .build(); + assertEquals(tagsModel.user(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.access(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.service(), java.util.Arrays.asList("testString")); + + Resource resourceModel = new Resource.Builder() + .reportId("30b434b3-cb08-4845-af10-7a8fc682b6a8") + .homeAccountId("2411ffdc16844b07b42521c3443f456d") + .id("crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::") + .resourceName("jeff's key") + .account(accountModel) + .componentId("cloud-object_storage") + .componentName("cloud-object_storage") + .environment("ibm cloud") + .tags(tagsModel) + .status("compliant") + .totalCount(Long.valueOf("140")) + .passCount(Long.valueOf("123")) + .failureCount(Long.valueOf("12")) + .errorCount(Long.valueOf("5")) + .skippedCount(Long.valueOf("7")) + .completedCount(Long.valueOf("135")) + .serviceName("pm-20") + .instanceCrn("testString") + .build(); + assertEquals(resourceModel.reportId(), "30b434b3-cb08-4845-af10-7a8fc682b6a8"); + assertEquals(resourceModel.homeAccountId(), "2411ffdc16844b07b42521c3443f456d"); + assertEquals(resourceModel.id(), "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::"); + assertEquals(resourceModel.resourceName(), "jeff's key"); + assertEquals(resourceModel.account(), accountModel); + assertEquals(resourceModel.componentId(), "cloud-object_storage"); + assertEquals(resourceModel.componentName(), "cloud-object_storage"); + assertEquals(resourceModel.environment(), "ibm cloud"); + assertEquals(resourceModel.tags(), tagsModel); + assertEquals(resourceModel.status(), "compliant"); + assertEquals(resourceModel.totalCount(), Long.valueOf("140")); + assertEquals(resourceModel.passCount(), Long.valueOf("123")); + assertEquals(resourceModel.failureCount(), Long.valueOf("12")); + assertEquals(resourceModel.errorCount(), Long.valueOf("5")); + assertEquals(resourceModel.skippedCount(), Long.valueOf("7")); + assertEquals(resourceModel.completedCount(), Long.valueOf("135")); + assertEquals(resourceModel.serviceName(), "pm-20"); + assertEquals(resourceModel.instanceCrn(), "testString"); + + String json = TestUtilities.serialize(resourceModel); + + Resource resourceModelNew = TestUtilities.deserialize(json, Resource.class); + assertTrue(resourceModelNew instanceof Resource); + assertEquals(resourceModelNew.reportId(), "30b434b3-cb08-4845-af10-7a8fc682b6a8"); + assertEquals(resourceModelNew.homeAccountId(), "2411ffdc16844b07b42521c3443f456d"); + assertEquals(resourceModelNew.id(), "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::"); + assertEquals(resourceModelNew.resourceName(), "jeff's key"); + assertEquals(resourceModelNew.account().toString(), accountModel.toString()); + assertEquals(resourceModelNew.componentId(), "cloud-object_storage"); + assertEquals(resourceModelNew.componentName(), "cloud-object_storage"); + assertEquals(resourceModelNew.environment(), "ibm cloud"); + assertEquals(resourceModelNew.tags().toString(), tagsModel.toString()); + assertEquals(resourceModelNew.status(), "compliant"); + assertEquals(resourceModelNew.totalCount(), Long.valueOf("140")); + assertEquals(resourceModelNew.passCount(), Long.valueOf("123")); + assertEquals(resourceModelNew.failureCount(), Long.valueOf("12")); + assertEquals(resourceModelNew.errorCount(), Long.valueOf("5")); + assertEquals(resourceModelNew.skippedCount(), Long.valueOf("7")); + assertEquals(resourceModelNew.completedCount(), Long.valueOf("135")); + assertEquals(resourceModelNew.serviceName(), "pm-20"); + assertEquals(resourceModelNew.instanceCrn(), "testString"); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testResourceError() throws Throwable { + new Resource.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/RuleCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleCollectionTest.java new file mode 100644 index 00000000..21040672 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleCollectionTest.java @@ -0,0 +1,50 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +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.PageHRefFirst; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.PageHRefNext; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RequiredConfigConditionBase; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Rule; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleParameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; +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 RuleCollection model. + */ +public class RuleCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleCollection() throws Throwable { + RuleCollection ruleCollectionModel = new RuleCollection(); + assertNull(ruleCollectionModel.getLimit()); + assertNull(ruleCollectionModel.getTotalCount()); + assertNull(ruleCollectionModel.getFirst()); + assertNull(ruleCollectionModel.getNext()); + assertNull(ruleCollectionModel.getRules()); + } +} \ 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/RuleInfoTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleInfoTest.java index 3a168701..1f77db71 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleInfoTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleInfoTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleParameterTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleParameterTest.java new file mode 100644 index 00000000..6443e3ca --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleParameterTest.java @@ -0,0 +1,60 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RuleParameter; +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 RuleParameter model. + */ +public class RuleParameterTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleParameter() throws Throwable { + RuleParameter ruleParameterModel = new RuleParameter.Builder() + .name("testString") + .displayName("testString") + .description("testString") + .type("string") + .build(); + assertEquals(ruleParameterModel.name(), "testString"); + assertEquals(ruleParameterModel.displayName(), "testString"); + assertEquals(ruleParameterModel.description(), "testString"); + assertEquals(ruleParameterModel.type(), "string"); + + String json = TestUtilities.serialize(ruleParameterModel); + + RuleParameter ruleParameterModelNew = TestUtilities.deserialize(json, RuleParameter.class); + assertTrue(ruleParameterModelNew instanceof RuleParameter); + assertEquals(ruleParameterModelNew.name(), "testString"); + assertEquals(ruleParameterModelNew.displayName(), "testString"); + assertEquals(ruleParameterModelNew.description(), "testString"); + assertEquals(ruleParameterModelNew.type(), "string"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRuleParameterError() throws Throwable { + new RuleParameter.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/RulePropertyTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulePropertyTest.java new file mode 100644 index 00000000..cd6c80ac --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RulePropertyTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RuleProperty; +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 RuleProperty model. + */ +public class RulePropertyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleProperty() throws Throwable { + RuleProperty rulePropertyModel = new RuleProperty(); + assertNull(rulePropertyModel.getName()); + assertNull(rulePropertyModel.getDescription()); + assertNull(rulePropertyModel.getType()); + } +} \ 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/TargetPrototypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTargetPrototypeTest.java similarity index 58% rename from modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetPrototypeTest.java rename to modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTargetPrototypeTest.java index 6d0e5dfa..da6f4cea 100644 --- 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/RuleTargetPrototypeTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,7 +15,7 @@ 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.model.RuleTargetPrototype; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; import java.util.HashMap; @@ -24,43 +24,43 @@ import static org.testng.Assert.*; /** - * Unit test class for the TargetPrototype model. + * Unit test class for the RuleTargetPrototype model. */ -public class TargetPrototypeTest { +public class RuleTargetPrototypeTest { final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); @Test - public void testTargetPrototype() throws Throwable { + public void testRuleTargetPrototype() throws Throwable { AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() - .name("name") + .name("testString") .operator("string_equals") - .value("value") + .value("testString") .build(); - assertEquals(additionalTargetAttributeModel.name(), "name"); + assertEquals(additionalTargetAttributeModel.name(), "testString"); assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); - assertEquals(additionalTargetAttributeModel.value(), "value"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); - TargetPrototype targetPrototypeModel = new TargetPrototype.Builder() + RuleTargetPrototype ruleTargetPrototypeModel = new RuleTargetPrototype.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)); + assertEquals(ruleTargetPrototypeModel.serviceName(), "testString"); + assertEquals(ruleTargetPrototypeModel.resourceKind(), "testString"); + assertEquals(ruleTargetPrototypeModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); - String json = TestUtilities.serialize(targetPrototypeModel); + String json = TestUtilities.serialize(ruleTargetPrototypeModel); - TargetPrototype targetPrototypeModelNew = TestUtilities.deserialize(json, TargetPrototype.class); - assertTrue(targetPrototypeModelNew instanceof TargetPrototype); - assertEquals(targetPrototypeModelNew.serviceName(), "testString"); - assertEquals(targetPrototypeModelNew.resourceKind(), "testString"); + RuleTargetPrototype ruleTargetPrototypeModelNew = TestUtilities.deserialize(json, RuleTargetPrototype.class); + assertTrue(ruleTargetPrototypeModelNew instanceof RuleTargetPrototype); + assertEquals(ruleTargetPrototypeModelNew.serviceName(), "testString"); + assertEquals(ruleTargetPrototypeModelNew.resourceKind(), "testString"); } @Test(expectedExceptions = IllegalArgumentException.class) - public void testTargetPrototypeError() throws Throwable { - new TargetPrototype.Builder().build(); + public void testRuleTargetPrototypeError() throws Throwable { + new RuleTargetPrototype.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/RuleTargetTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTargetTest.java new file mode 100644 index 00000000..432029d5 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RuleTargetTest.java @@ -0,0 +1,72 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RuleTarget; +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 RuleTarget model. + */ +public class RuleTargetTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testRuleTarget() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + String json = TestUtilities.serialize(ruleTargetModel); + + RuleTarget ruleTargetModelNew = TestUtilities.deserialize(json, RuleTarget.class); + assertTrue(ruleTargetModelNew instanceof RuleTarget); + assertEquals(ruleTargetModelNew.serviceName(), "testString"); + assertEquals(ruleTargetModelNew.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModelNew.resourceKind(), "testString"); + assertEquals(ruleTargetModelNew.ref(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testRuleTargetError() throws Throwable { + new RuleTarget.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/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 cef72dce..32e8a25e 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -16,12 +16,10 @@ 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.Import; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.Parameter; -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.RequiredConfigConditionBase; 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.model.RuleParameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleTarget; 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/ScanReportCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportCollectionTest.java new file mode 100644 index 00000000..f2e52a8f --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportCollectionTest.java @@ -0,0 +1,47 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +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.ScanReport; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScanReportCollection; +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 ScanReportCollection model. + */ +public class ScanReportCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScanReportCollection() throws Throwable { + ScanReportCollection scanReportCollectionModel = new ScanReportCollection(); + assertNull(scanReportCollectionModel.getLimit()); + assertNull(scanReportCollectionModel.getTotalCount()); + assertNull(scanReportCollectionModel.getFirst()); + assertNull(scanReportCollectionModel.getNext()); + assertNull(scanReportCollectionModel.getScopeId()); + assertNull(scanReportCollectionModel.getSubscopeId()); + assertNull(scanReportCollectionModel.getScanReports()); + } +} \ 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/ScanReportTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportTest.java new file mode 100644 index 00000000..7d9fc27e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScanReportTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScanReport; +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 ScanReport model. + */ +public class ScanReportTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScanReport() throws Throwable { + ScanReport scanReportModel = new ScanReport(); + assertNull(scanReportModel.getId()); + assertNull(scanReportModel.getScanId()); + assertNull(scanReportModel.getInstanceId()); + assertNull(scanReportModel.getScopeId()); + assertNull(scanReportModel.getSubscopeId()); + assertNull(scanReportModel.getStatus()); + assertNull(scanReportModel.getCreatedOn()); + assertNull(scanReportModel.getFormat()); + assertNull(scanReportModel.getHref()); + } +} \ 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/ScopeCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeCollectionTest.java new file mode 100644 index 00000000..b84af6e7 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeCollectionTest.java @@ -0,0 +1,46 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +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.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopeCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +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 ScopeCollection model. + */ +public class ScopeCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScopeCollection() throws Throwable { + ScopeCollection scopeCollectionModel = new ScopeCollection(); + assertNull(scopeCollectionModel.getLimit()); + assertNull(scopeCollectionModel.getTotalCount()); + assertNull(scopeCollectionModel.getFirst()); + assertNull(scopeCollectionModel.getNext()); + assertNull(scopeCollectionModel.getScopes()); + } +} \ 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/ScopeIDTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeIDTest.java new file mode 100644 index 00000000..0066f49d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeIDTest.java @@ -0,0 +1,38 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopeID; +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 ScopeID model. + */ +public class ScopeIDTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScopeID() throws Throwable { + ScopeID scopeIdModel = new ScopeID(); + assertNull(scopeIdModel.getId()); + assertNull(scopeIdModel.getType()); + } +} \ 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/ScopePropertyExclusionItemTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusionItemTest.java new file mode 100644 index 00000000..c7016d12 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusionItemTest.java @@ -0,0 +1,54 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopePropertyExclusionItem; +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 ScopePropertyExclusionItem model. + */ +public class ScopePropertyExclusionItemTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScopePropertyExclusionItem() throws Throwable { + ScopePropertyExclusionItem scopePropertyExclusionItemModel = new ScopePropertyExclusionItem.Builder() + .scopeId("testString") + .scopeType("enterprise") + .build(); + assertEquals(scopePropertyExclusionItemModel.scopeId(), "testString"); + assertEquals(scopePropertyExclusionItemModel.scopeType(), "enterprise"); + + String json = TestUtilities.serialize(scopePropertyExclusionItemModel); + + ScopePropertyExclusionItem scopePropertyExclusionItemModelNew = TestUtilities.deserialize(json, ScopePropertyExclusionItem.class); + assertTrue(scopePropertyExclusionItemModelNew instanceof ScopePropertyExclusionItem); + assertEquals(scopePropertyExclusionItemModelNew.scopeId(), "testString"); + assertEquals(scopePropertyExclusionItemModelNew.scopeType(), "enterprise"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testScopePropertyExclusionItemError() throws Throwable { + new ScopePropertyExclusionItem.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/ScopePropertyExclusionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusionsTest.java new file mode 100644 index 00000000..8da74a7a --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusionsTest.java @@ -0,0 +1,61 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopePropertyExclusionItem; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyExclusions; +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 ScopePropertyExclusions model. + */ +public class ScopePropertyExclusionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScopePropertyExclusions() throws Throwable { + ScopePropertyExclusionItem scopePropertyExclusionItemModel = new ScopePropertyExclusionItem.Builder() + .scopeId("testString") + .scopeType("enterprise") + .build(); + assertEquals(scopePropertyExclusionItemModel.scopeId(), "testString"); + assertEquals(scopePropertyExclusionItemModel.scopeType(), "enterprise"); + + ScopePropertyExclusions scopePropertyExclusionsModel = new ScopePropertyExclusions.Builder() + .name("exclusions") + .value(java.util.Arrays.asList(scopePropertyExclusionItemModel)) + .build(); + assertEquals(scopePropertyExclusionsModel.name(), "exclusions"); + assertEquals(scopePropertyExclusionsModel.value(), java.util.Arrays.asList(scopePropertyExclusionItemModel)); + + String json = TestUtilities.serialize(scopePropertyExclusionsModel); + + ScopePropertyExclusions scopePropertyExclusionsModelNew = TestUtilities.deserialize(json, ScopePropertyExclusions.class); + assertTrue(scopePropertyExclusionsModelNew instanceof ScopePropertyExclusions); + assertEquals(scopePropertyExclusionsModelNew.name(), "exclusions"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testScopePropertyExclusionsError() throws Throwable { + new ScopePropertyExclusions.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/ScopePropertyScopeAnyTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeAnyTest.java new file mode 100644 index 00000000..83a85a94 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeAnyTest.java @@ -0,0 +1,54 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopePropertyScopeAny; +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 ScopePropertyScopeAny model. + */ +public class ScopePropertyScopeAnyTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScopePropertyScopeAny() throws Throwable { + ScopePropertyScopeAny scopePropertyScopeAnyModel = new ScopePropertyScopeAny.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(scopePropertyScopeAnyModel.name(), "testString"); + assertEquals(scopePropertyScopeAnyModel.value(), "testString"); + + String json = TestUtilities.serialize(scopePropertyScopeAnyModel); + + ScopePropertyScopeAny scopePropertyScopeAnyModelNew = TestUtilities.deserialize(json, ScopePropertyScopeAny.class); + assertTrue(scopePropertyScopeAnyModelNew instanceof ScopePropertyScopeAny); + assertEquals(scopePropertyScopeAnyModelNew.name(), "testString"); + assertEquals(scopePropertyScopeAnyModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testScopePropertyScopeAnyError() throws Throwable { + new ScopePropertyScopeAny.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/ScopePropertyScopeIdTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeIdTest.java new file mode 100644 index 00000000..8c367a3d --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeIdTest.java @@ -0,0 +1,54 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopePropertyScopeId; +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 ScopePropertyScopeId model. + */ +public class ScopePropertyScopeIdTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScopePropertyScopeId() throws Throwable { + ScopePropertyScopeId scopePropertyScopeIdModel = new ScopePropertyScopeId.Builder() + .name("scope_id") + .value("testString") + .build(); + assertEquals(scopePropertyScopeIdModel.name(), "scope_id"); + assertEquals(scopePropertyScopeIdModel.value(), "testString"); + + String json = TestUtilities.serialize(scopePropertyScopeIdModel); + + ScopePropertyScopeId scopePropertyScopeIdModelNew = TestUtilities.deserialize(json, ScopePropertyScopeId.class); + assertTrue(scopePropertyScopeIdModelNew instanceof ScopePropertyScopeId); + assertEquals(scopePropertyScopeIdModelNew.name(), "scope_id"); + assertEquals(scopePropertyScopeIdModelNew.value(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testScopePropertyScopeIdError() throws Throwable { + new ScopePropertyScopeId.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/ScopePropertyScopeTypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeTypeTest.java new file mode 100644 index 00000000..6ce3f205 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeTypeTest.java @@ -0,0 +1,54 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopePropertyScopeType; +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 ScopePropertyScopeType model. + */ +public class ScopePropertyScopeTypeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScopePropertyScopeType() throws Throwable { + ScopePropertyScopeType scopePropertyScopeTypeModel = new ScopePropertyScopeType.Builder() + .name("scope_type") + .value("account") + .build(); + assertEquals(scopePropertyScopeTypeModel.name(), "scope_type"); + assertEquals(scopePropertyScopeTypeModel.value(), "account"); + + String json = TestUtilities.serialize(scopePropertyScopeTypeModel); + + ScopePropertyScopeType scopePropertyScopeTypeModelNew = TestUtilities.deserialize(json, ScopePropertyScopeType.class); + assertTrue(scopePropertyScopeTypeModelNew instanceof ScopePropertyScopeType); + assertEquals(scopePropertyScopeTypeModelNew.name(), "scope_type"); + assertEquals(scopePropertyScopeTypeModelNew.value(), "account"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testScopePropertyScopeTypeError() throws Throwable { + new ScopePropertyScopeType.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/ScopePropertyTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyTest.java index 47df4b32..d38f834c 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -29,10 +29,10 @@ public class ScopePropertyTest { final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + // TODO: Add tests for models that are abstract @Test public void testScopeProperty() throws Throwable { ScopeProperty scopePropertyModel = new ScopeProperty(); - assertNull(scopePropertyModel.getName()); - assertNull(scopePropertyModel.getValue()); + assertNotNull(scopePropertyModel); } } \ 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/ScopePrototypeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePrototypeTest.java new file mode 100644 index 00000000..6a17b0ab --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePrototypeTest.java @@ -0,0 +1,61 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePrototype; +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 ScopePrototype model. + */ +public class ScopePrototypeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScopePrototype() throws Throwable { + ScopePropertyScopeAny scopePropertyModel = new ScopePropertyScopeAny.Builder() + .name("testString") + .value("testString") + .build(); + assertEquals(scopePropertyModel.name(), "testString"); + assertEquals(scopePropertyModel.value(), "testString"); + + ScopePrototype scopePrototypeModel = new ScopePrototype.Builder() + .name("testString") + .description("testString") + .environment("testString") + .xProperties(java.util.Arrays.asList(scopePropertyModel)) + .build(); + assertEquals(scopePrototypeModel.name(), "testString"); + assertEquals(scopePrototypeModel.description(), "testString"); + assertEquals(scopePrototypeModel.environment(), "testString"); + assertEquals(scopePrototypeModel.xProperties(), java.util.Arrays.asList(scopePropertyModel)); + + String json = TestUtilities.serialize(scopePrototypeModel); + + ScopePrototype scopePrototypeModelNew = TestUtilities.deserialize(json, ScopePrototype.class); + assertTrue(scopePrototypeModelNew instanceof ScopePrototype); + assertEquals(scopePrototypeModelNew.name(), "testString"); + assertEquals(scopePrototypeModelNew.description(), "testString"); + assertEquals(scopePrototypeModelNew.environment(), "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/ScopeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeTest.java new file mode 100644 index 00000000..bd27b345 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopeTest.java @@ -0,0 +1,49 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Scope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +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 Scope model. + */ +public class ScopeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testScope() throws Throwable { + Scope scopeModel = new Scope(); + assertNull(scopeModel.getId()); + assertNull(scopeModel.getName()); + assertNull(scopeModel.getDescription()); + assertNull(scopeModel.getEnvironment()); + assertNull(scopeModel.getXProperties()); + assertNull(scopeModel.getAccountId()); + assertNull(scopeModel.getInstanceId()); + assertNull(scopeModel.getCreatedBy()); + assertNull(scopeModel.getCreatedOn()); + assertNull(scopeModel.getUpdatedBy()); + assertNull(scopeModel.getUpdatedOn()); + assertNull(scopeModel.getAttachmentCount()); + } +} \ 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/ServiceCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceCollectionTest.java new file mode 100644 index 00000000..29ce8607 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceCollectionTest.java @@ -0,0 +1,44 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalTargetAttribute; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ConfigurationInformationPoints; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Endpoint; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Service; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ServiceCollection; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SupportedConfigs; +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 ServiceCollection model. + */ +public class ServiceCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testServiceCollection() throws Throwable { + ServiceCollection serviceCollectionModel = new ServiceCollection(); + assertNull(serviceCollectionModel.getServices()); + } +} \ 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/ServiceTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceTest.java new file mode 100644 index 00000000..d259ea94 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ServiceTest.java @@ -0,0 +1,53 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ConfigurationInformationPoints; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Endpoint; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.RuleProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Service; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SupportedConfigs; +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 Service model. + */ +public class ServiceTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testService() throws Throwable { + Service serviceModel = new Service(); + assertNull(serviceModel.getCreatedOn()); + assertNull(serviceModel.getCreatedBy()); + assertNull(serviceModel.getUpdatedOn()); + assertNull(serviceModel.getUpdatedBy()); + assertNull(serviceModel.getServiceName()); + assertNull(serviceModel.getServiceDisplayName()); + assertNull(serviceModel.getDescription()); + assertNull(serviceModel.isMonitoringEnabled()); + assertNull(serviceModel.isEnforcementEnabled()); + assertNull(serviceModel.isServiceListingEnabled()); + assertNull(serviceModel.getConfigInformationPoint()); + assertNull(serviceModel.getSupportedConfigs()); + } +} \ 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/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 37ab06ca..f6f7dfe8 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -34,44 +34,8 @@ public class SettingsTest { @Test public void testSettings() throws Throwable { - EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .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: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: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: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"); - - ObjectStorage objectStorageModel = new ObjectStorage.Builder() - .instanceCrn("instance_crn") - .bucket("bucket") - .bucketLocation("bucket_location") - .bucketEndpoint("bucket_endpoint") - .updatedOn(DateUtils.parseAsDateTime("2000-01-23T04:56:07.000+00:00")) - .build(); - assertEquals(objectStorageModel.instanceCrn(), "instance_crn"); - assertEquals(objectStorageModel.bucket(), "bucket"); - assertEquals(objectStorageModel.bucketLocation(), "bucket_location"); - assertEquals(objectStorageModel.bucketEndpoint(), "bucket_endpoint"); - assertEquals(objectStorageModel.updatedOn(), DateUtils.parseAsDateTime("2000-01-23T04:56:07.000+00:00")); - - Settings settingsModel = new Settings.Builder() - .eventNotifications(eventNotificationsModel) - .objectStorage(objectStorageModel) - .build(); - assertEquals(settingsModel.eventNotifications(), eventNotificationsModel); - assertEquals(settingsModel.objectStorage(), objectStorageModel); - - String json = TestUtilities.serialize(settingsModel); - - Settings settingsModelNew = TestUtilities.deserialize(json, Settings.class); - assertTrue(settingsModelNew instanceof Settings); - assertEquals(settingsModelNew.eventNotifications().toString(), eventNotificationsModel.toString()); - assertEquals(settingsModelNew.objectStorage().toString(), objectStorageModel.toString()); + Settings settingsModel = new Settings(); + assertNull(settingsModel.getEventNotifications()); + assertNull(settingsModel.getObjectStorage()); } } \ 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/SubRuleTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubRuleTest.java new file mode 100644 index 00000000..b022759b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubRuleTest.java @@ -0,0 +1,69 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RuleTarget; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubRule; +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 SubRule model. + */ +public class SubRuleTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubRule() throws Throwable { + AdditionalTargetAttribute additionalTargetAttributeModel = new AdditionalTargetAttribute.Builder() + .name("testString") + .operator("string_equals") + .value("testString") + .build(); + assertEquals(additionalTargetAttributeModel.name(), "testString"); + assertEquals(additionalTargetAttributeModel.operator(), "string_equals"); + assertEquals(additionalTargetAttributeModel.value(), "testString"); + + RuleTarget ruleTargetModel = new RuleTarget.Builder() + .serviceName("testString") + .serviceDisplayName("testString") + .resourceKind("testString") + .additionalTargetAttributes(java.util.Arrays.asList(additionalTargetAttributeModel)) + .ref("testString") + .build(); + assertEquals(ruleTargetModel.serviceName(), "testString"); + assertEquals(ruleTargetModel.serviceDisplayName(), "testString"); + assertEquals(ruleTargetModel.resourceKind(), "testString"); + assertEquals(ruleTargetModel.additionalTargetAttributes(), java.util.Arrays.asList(additionalTargetAttributeModel)); + assertEquals(ruleTargetModel.ref(), "testString"); + + SubRule subRuleModel = new SubRule.Builder() + .target(ruleTargetModel) + .build(); + assertEquals(subRuleModel.target(), ruleTargetModel); + + String json = TestUtilities.serialize(subRuleModel); + + SubRule subRuleModelNew = TestUtilities.deserialize(json, SubRule.class); + assertTrue(subRuleModelNew instanceof SubRule); + assertEquals(subRuleModelNew.target().toString(), ruleTargetModel.toString()); + } +} \ 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/SubScopeCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeCollectionTest.java new file mode 100644 index 00000000..756f2b11 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeCollectionTest.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.PageHRefFirst; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.PageHRefNext; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScopeCollection; +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 SubScopeCollection model. + */ +public class SubScopeCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubScopeCollection() throws Throwable { + SubScopeCollection subScopeCollectionModel = new SubScopeCollection(); + assertNull(subScopeCollectionModel.getLimit()); + assertNull(subScopeCollectionModel.getTotalCount()); + assertNull(subScopeCollectionModel.getFirst()); + assertNull(subScopeCollectionModel.getNext()); + assertNull(subScopeCollectionModel.getSubscopes()); + } +} \ 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/SubScopeResponseTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeResponseTest.java new file mode 100644 index 00000000..3d81cd01 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeResponseTest.java @@ -0,0 +1,39 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScope; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScopeResponse; +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 SubScopeResponse model. + */ +public class SubScopeResponseTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubScopeResponse() throws Throwable { + SubScopeResponse subScopeResponseModel = new SubScopeResponse(); + assertNull(subScopeResponseModel.getSubscopes()); + } +} \ 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/SubScopeTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeTest.java new file mode 100644 index 00000000..a227b574 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SubScopeTest.java @@ -0,0 +1,42 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.ScopePropertyScopeAny; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SubScope; +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 SubScope model. + */ +public class SubScopeTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSubScope() throws Throwable { + SubScope subScopeModel = new SubScope(); + assertNull(subScopeModel.getId()); + assertNull(subScopeModel.getName()); + assertNull(subScopeModel.getDescription()); + assertNull(subScopeModel.getEnvironment()); + assertNull(subScopeModel.getXProperties()); + } +} \ 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/SupportedConfigsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SupportedConfigsTest.java new file mode 100644 index 00000000..4607ba8b --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/SupportedConfigsTest.java @@ -0,0 +1,46 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.RuleProperty; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.SupportedConfigs; +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 SupportedConfigs model. + */ +public class SupportedConfigsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testSupportedConfigs() throws Throwable { + SupportedConfigs supportedConfigsModel = new SupportedConfigs(); + assertNull(supportedConfigsModel.getResourceKind()); + assertNull(supportedConfigsModel.getAdditionalTargetAttributes()); + assertNull(supportedConfigsModel.getXProperties()); + assertNull(supportedConfigsModel.getDescription()); + assertNull(supportedConfigsModel.isCipRequiresServiceInstance()); + assertNull(supportedConfigsModel.isResourceGroupSupport()); + assertNull(supportedConfigsModel.isTaggingSupport()); + assertNull(supportedConfigsModel.isInheritTags()); + } +} \ 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/TagsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TagsTest.java index 828c54b7..b152af1f 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TagsTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TagsTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -31,9 +31,18 @@ public class TagsTest { @Test public void testTags() throws Throwable { - Tags tagsModel = new Tags(); - assertNull(tagsModel.getUser()); - assertNull(tagsModel.getAccess()); - assertNull(tagsModel.getService()); + Tags tagsModel = new Tags.Builder() + .user(java.util.Arrays.asList("testString")) + .access(java.util.Arrays.asList("testString")) + .service(java.util.Arrays.asList("testString")) + .build(); + assertEquals(tagsModel.user(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.access(), java.util.Arrays.asList("testString")); + assertEquals(tagsModel.service(), java.util.Arrays.asList("testString")); + + String json = TestUtilities.serialize(tagsModel); + + Tags tagsModelNew = TestUtilities.deserialize(json, Tags.class); + assertTrue(tagsModelNew instanceof Tags); } } \ 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/TargetCollectionTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetCollectionTest.java new file mode 100644 index 00000000..31f9f891 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetCollectionTest.java @@ -0,0 +1,49 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CredentialResponse; +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.Resource; +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.TargetCollection; +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 TargetCollection model. + */ +public class TargetCollectionTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testTargetCollection() throws Throwable { + TargetCollection targetCollectionModel = new TargetCollection(); + assertNull(targetCollectionModel.getLimit()); + assertNull(targetCollectionModel.getTotalCount()); + assertNull(targetCollectionModel.getFirst()); + assertNull(targetCollectionModel.getNext()); + assertNull(targetCollectionModel.getTargets()); + } +} \ 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/TargetInfoTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetInfoTest.java index 848c845e..a5639f7c 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetInfoTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TargetInfoTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -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.Tags; import com.ibm.cloud.security_and_compliance_center_api.v3.model.TargetInfo; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; import java.io.InputStream; @@ -34,8 +35,10 @@ public void testTargetInfo() throws Throwable { TargetInfo targetInfoModel = new TargetInfo(); assertNull(targetInfoModel.getId()); assertNull(targetInfoModel.getAccountId()); + assertNull(targetInfoModel.getServiceName()); + assertNull(targetInfoModel.getServiceDisplayName()); assertNull(targetInfoModel.getResourceCrn()); assertNull(targetInfoModel.getResourceName()); - assertNull(targetInfoModel.getServiceName()); + assertNull(targetInfoModel.getTags()); } } \ 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 54af5e1e..96ee7f3c 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,7 +14,10 @@ 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.Account; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.CredentialResponse; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.Resource; +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.utils.TestUtilities; import java.io.InputStream; @@ -33,9 +36,14 @@ public class TargetTest { @Test public void testTarget() throws Throwable { Target targetModel = new Target(); - assertNull(targetModel.getServiceName()); - assertNull(targetModel.getServiceDisplayName()); - assertNull(targetModel.getResourceKind()); - assertNull(targetModel.getAdditionalTargetAttributes()); + assertNull(targetModel.getId()); + assertNull(targetModel.getAccountId()); + assertNull(targetModel.getTrustedProfileId()); + assertNull(targetModel.getName()); + assertNull(targetModel.getCredentials()); + assertNull(targetModel.getCreatedBy()); + assertNull(targetModel.getCreatedOn()); + assertNull(targetModel.getUpdatedBy()); + assertNull(targetModel.getUpdatedOn()); } } \ 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/TestEventTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TestEventTest.java index 5c5b451d..39e01437 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TestEventTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/TestEventTest.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at 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 837d1bea..130edbbe 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,7 +15,6 @@ 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; @@ -32,23 +31,18 @@ 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") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .providerTypeId("3e25966275dccfa2c3a34786919c5af7") .providerTypeInstanceId("testString") - .updateProviderTypeInstanceRequest(updateProviderTypeInstanceRequestModel) - .xCorrelationId("testString") - .xRequestId("testString") + .name("workload-protection-instance-1") + .attributes(java.util.Collections.singletonMap("anyKey", "anyValue")) .build(); - assertEquals(updateProviderTypeInstanceOptionsModel.providerTypeId(), "testString"); + assertEquals(updateProviderTypeInstanceOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(updateProviderTypeInstanceOptionsModel.providerTypeId(), "3e25966275dccfa2c3a34786919c5af7"); assertEquals(updateProviderTypeInstanceOptionsModel.providerTypeInstanceId(), "testString"); - assertEquals(updateProviderTypeInstanceOptionsModel.updateProviderTypeInstanceRequest(), updateProviderTypeInstanceRequestModel); - assertEquals(updateProviderTypeInstanceOptionsModel.xCorrelationId(), "testString"); - assertEquals(updateProviderTypeInstanceOptionsModel.xRequestId(), "testString"); + assertEquals(updateProviderTypeInstanceOptionsModel.name(), "workload-protection-instance-1"); + assertEquals(updateProviderTypeInstanceOptionsModel.attributes(), java.util.Collections.singletonMap("anyKey", "anyValue")); } @Test(expectedExceptions = IllegalArgumentException.class) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateScopeOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateScopeOptionsTest.java new file mode 100644 index 00000000..c8d9eeb8 --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateScopeOptionsTest.java @@ -0,0 +1,51 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.UpdateScopeOptions; +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 UpdateScopeOptions model. + */ +public class UpdateScopeOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateScopeOptions() throws Throwable { + UpdateScopeOptions updateScopeOptionsModel = new UpdateScopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .name("testString") + .description("testString") + .build(); + assertEquals(updateScopeOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(updateScopeOptionsModel.scopeId(), "testString"); + assertEquals(updateScopeOptionsModel.name(), "testString"); + assertEquals(updateScopeOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateScopeOptionsError() throws Throwable { + new UpdateScopeOptions.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/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 8d376241..0b5dd04d 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 @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,9 +14,8 @@ package com.ibm.cloud.security_and_compliance_center_api.v3.model; 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.EventNotifications; -import com.ibm.cloud.security_and_compliance_center_api.v3.model.ObjectStorage; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.EventNotificationsPrototype; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.ObjectStoragePrototype; 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.InputStream; @@ -34,41 +33,35 @@ public class UpdateSettingsOptionsTest { @Test public void testUpdateSettingsOptions() throws Throwable { - EventNotifications eventNotificationsModel = new EventNotifications.Builder() - .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: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") + ObjectStoragePrototype objectStoragePrototypeModel = new ObjectStoragePrototype.Builder() + .bucket("testString") + .instanceCrn("testString") .build(); - 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: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"); + assertEquals(objectStoragePrototypeModel.bucket(), "testString"); + assertEquals(objectStoragePrototypeModel.instanceCrn(), "testString"); - ObjectStorage objectStorageModel = new ObjectStorage.Builder() + EventNotificationsPrototype eventNotificationsPrototypeModel = new EventNotificationsPrototype.Builder() .instanceCrn("testString") - .bucket("testString") - .bucketLocation("testString") - .bucketEndpoint("testString") - .updatedOn(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) + .sourceDescription("This source is used for integration with IBM Cloud Security and Compliance Center.") + .sourceName("compliance") .build(); - assertEquals(objectStorageModel.instanceCrn(), "testString"); - assertEquals(objectStorageModel.bucket(), "testString"); - assertEquals(objectStorageModel.bucketLocation(), "testString"); - assertEquals(objectStorageModel.bucketEndpoint(), "testString"); - assertEquals(objectStorageModel.updatedOn(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); + assertEquals(eventNotificationsPrototypeModel.instanceCrn(), "testString"); + assertEquals(eventNotificationsPrototypeModel.sourceDescription(), "This source is used for integration with IBM Cloud Security and Compliance Center."); + assertEquals(eventNotificationsPrototypeModel.sourceName(), "compliance"); UpdateSettingsOptions updateSettingsOptionsModel = new UpdateSettingsOptions.Builder() - .eventNotifications(eventNotificationsModel) - .objectStorage(objectStorageModel) - .xCorrelationId("1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5") - .xRequestId("testString") + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .objectStorage(objectStoragePrototypeModel) + .eventNotifications(eventNotificationsPrototypeModel) .build(); - assertEquals(updateSettingsOptionsModel.eventNotifications(), eventNotificationsModel); - assertEquals(updateSettingsOptionsModel.objectStorage(), objectStorageModel); - assertEquals(updateSettingsOptionsModel.xCorrelationId(), "1a2b3c4d-5e6f-4a7b-8c9d-e0f1a2b3c4d5"); - assertEquals(updateSettingsOptionsModel.xRequestId(), "testString"); + assertEquals(updateSettingsOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(updateSettingsOptionsModel.objectStorage(), objectStoragePrototypeModel); + assertEquals(updateSettingsOptionsModel.eventNotifications(), eventNotificationsPrototypeModel); } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSettingsOptionsError() throws Throwable { + new UpdateSettingsOptions.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/UpdateSubscopeOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSubscopeOptionsTest.java new file mode 100644 index 00000000..189fb24e --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpdateSubscopeOptionsTest.java @@ -0,0 +1,53 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.UpdateSubscopeOptions; +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 UpdateSubscopeOptions model. + */ +public class UpdateSubscopeOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpdateSubscopeOptions() throws Throwable { + UpdateSubscopeOptions updateSubscopeOptionsModel = new UpdateSubscopeOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .scopeId("testString") + .subscopeId("testString") + .name("testString") + .description("testString") + .build(); + assertEquals(updateSubscopeOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(updateSubscopeOptionsModel.scopeId(), "testString"); + assertEquals(updateSubscopeOptionsModel.subscopeId(), "testString"); + assertEquals(updateSubscopeOptionsModel.name(), "testString"); + assertEquals(updateSubscopeOptionsModel.description(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpdateSubscopeOptionsError() throws Throwable { + new UpdateSubscopeOptions.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/UpgradeAttachmentOptionsTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpgradeAttachmentOptionsTest.java new file mode 100644 index 00000000..980728db --- /dev/null +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/UpgradeAttachmentOptionsTest.java @@ -0,0 +1,69 @@ +/* + * (C) Copyright IBM Corp. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Parameter; +import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpgradeAttachmentOptions; +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 UpgradeAttachmentOptions model. + */ +public class UpgradeAttachmentOptionsTest { + final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); + final List mockListFileWithMetadata = TestUtilities.creatMockListFileWithMetadata(); + + @Test + public void testUpgradeAttachmentOptions() throws Throwable { + Parameter parameterModel = new Parameter.Builder() + .assessmentType("testString") + .assessmentId("testString") + .parameterName("location") + .parameterDisplayName("Location") + .parameterType("string") + .parameterValue("testString") + .build(); + assertEquals(parameterModel.assessmentType(), "testString"); + assertEquals(parameterModel.assessmentId(), "testString"); + assertEquals(parameterModel.parameterName(), "location"); + assertEquals(parameterModel.parameterDisplayName(), "Location"); + assertEquals(parameterModel.parameterType(), "string"); + assertEquals(parameterModel.parameterValue(), "testString"); + + UpgradeAttachmentOptions upgradeAttachmentOptionsModel = new UpgradeAttachmentOptions.Builder() + .instanceId("acd7032c-15a3-484f-bf5b-67d41534d940") + .profileId("9c265b4a-4cdf-47f1-acd3-17b5808f7f3f") + .attachmentId("testString") + .attachmentParameters(java.util.Arrays.asList(parameterModel)) + .accountId("testString") + .build(); + assertEquals(upgradeAttachmentOptionsModel.instanceId(), "acd7032c-15a3-484f-bf5b-67d41534d940"); + assertEquals(upgradeAttachmentOptionsModel.profileId(), "9c265b4a-4cdf-47f1-acd3-17b5808f7f3f"); + assertEquals(upgradeAttachmentOptionsModel.attachmentId(), "testString"); + assertEquals(upgradeAttachmentOptionsModel.attachmentParameters(), java.util.Arrays.asList(parameterModel)); + assertEquals(upgradeAttachmentOptionsModel.accountId(), "testString"); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testUpgradeAttachmentOptionsError() throws Throwable { + new UpgradeAttachmentOptions.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/utils/TestUtilities.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/utils/TestUtilities.java index 03bd79b2..c74f689e 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/utils/TestUtilities.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/utils/TestUtilities.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -10,8 +10,10 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.utils; +import java.util.Base64; import java.util.Map; import java.util.Set; import java.util.List; @@ -115,8 +117,8 @@ public static List creatMockListFileWithMetadata() { return list; } - public static byte[] createMockByteArray(String bytes) { - return bytes.getBytes(); + public static byte[] createMockByteArray(String encodedString) throws Exception { + return Base64.getDecoder().decode(encodedString); } public static Date createMockDate(String date) throws Exception { diff --git a/pom.xml b/pom.xml index 7ffa28fb..4873be04 100644 --- a/pom.xml +++ b/pom.xml @@ -1,31 +1,23 @@ 4.0.0 - security-and-compliance-center-sdk - IBM Cloud Security and Compliance Center Service Java SDK - Java Client Library to access the IBM Cloud Security and Compliance Center APIs - https://github.com/IBM/security-and-compliance-center-api-java-sdk - com.ibm.cloud 4.0.0 pom UTF-8 - 9.17.4 - security-and-compliance-center-java-sdk - 7.4.0 4.10.0 - 4.0.0-M7 - 0.8.8 - 4.0.0 + 3.0.0-M7 + 0.8.12 + 3.0.0 1.6.13 3.0.1 3.2.1 @@ -35,10 +27,10 @@ 3.10.1 3.12.1 3.2.0 - 8.41 + 8.4.1 3.4.1 - 4.0.0-M7 - 4.0.0 + 3.0.0-M7 + 3.0.0 2.0.6 4.13.2 @@ -61,17 +53,17 @@ - scm:git:https://github.com/IBM/security-and-compliance-center-api-java-sdk - scm:git:https://github.com/IBM/security-and-compliance-center-api-java-sdk - https://github.com/IBM/security-and-compliance-center-api-java-sdk/tree/master + scm:git:https://github.com/IBM/scc-java-sdk + scm:git:https://github.com/IBM/scc-java-sdk + https://github.com/IBM/scc-java-sdk/tree/main Github - https://github.com/IBM/security-and-compliance-center-api-java-sdk/issues + https://github.com/IBM/scc-java-sdk/issues - + @@ -231,11 +223,6 @@ - - - ${project.build.directory} - - org.apache.maven.plugins @@ -268,7 +255,7 @@ true 8 - {0,date,yyyyMMdd-HHmmss} + {yyyy-MM-dd} true true false @@ -327,7 +314,6 @@ org.apache.maven.plugins maven-javadoc-plugin - true public ${project.name}, version ${project.version}
IBM Corporation
@@ -361,11 +347,6 @@ - - - ${project.build.directory} - -
org.apache.maven.plugins @@ -418,7 +399,7 @@ maven-project-info-reports-plugin ${maven-reports-plugin-version} - + @@ -438,7 +419,7 @@ central - + From ec898b8b4935299904754b85671818f8d3421369 Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:11:17 -0400 Subject: [PATCH 02/13] chore(SCC): Manual change to update SDKCommon import Signed-off-by: Bryan Bosely --- .../v3/SecurityAndComplianceCenterApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9f665f59..7c5a5d32 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 @@ -18,7 +18,6 @@ package com.ibm.cloud.security_and_compliance_center_api.v3; import com.google.gson.JsonObject; -import com.ibm.cloud.common.SdkCommon; import com.ibm.cloud.sdk.core.http.RequestBuilder; import com.ibm.cloud.sdk.core.http.ResponseConverter; import com.ibm.cloud.sdk.core.http.ServiceCall; @@ -26,6 +25,7 @@ import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; import com.ibm.cloud.sdk.core.service.BaseService; import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; +import com.ibm.cloud.security_and_compliance_center_api.common.SdkCommon; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ComparePredefinedProfilesResponse; import com.ibm.cloud.security_and_compliance_center_api.v3.model.CompareProfilesOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.ControlLibrary; From 5d4c6b3ffb1f658dc2bca5f9a0c2cfafaae24448 Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:13:54 -0400 Subject: [PATCH 03/13] chore(SCC): Manual change to add ProviderTypeInstanceAttributes class Signed-off-by: Bryan Bosely --- .../model/ProviderTypeInstanceAttributes.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ProviderTypeInstanceAttributes.java 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..9d7345d7 --- /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. 2025. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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() { }); + } +} From 24fd3c78a2a59b9446f4e9d34411a19c73363aad Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:17:51 -0400 Subject: [PATCH 04/13] chore(SCC): Manual change to fix field types Signed-off-by: Bryan Bosely --- .../v3/model/ScopePropertyExclusions.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusions.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusions.java index 85042de5..fe0d4796 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusions.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyExclusions.java @@ -19,7 +19,9 @@ /** * Any exclusions or resources that should not be part of the scope. Has to be the same type as the one specified. */ -public class ScopePropertyExclusions extends ScopeProperty { +public class ScopePropertyExclusions { + private String name; + private List value; /** * The key that denotes the user is declaring the exclusions. @@ -29,7 +31,6 @@ public interface Name { String EXCLUSIONS = "exclusions"; } - /** * Builder. */ @@ -42,7 +43,7 @@ public static class Builder { * * @param scopePropertyExclusions the instance to initialize the Builder with */ - public Builder(ScopeProperty scopePropertyExclusions) { + public Builder(ScopePropertyExclusions scopePropertyExclusions) { this.name = scopePropertyExclusions.name; this.value = scopePropertyExclusions.value; } @@ -81,7 +82,7 @@ public ScopePropertyExclusions build() { */ public Builder addValue(ScopePropertyExclusionItem value) { com.ibm.cloud.sdk.core.util.Validator.notNull(value, - "value cannot be null"); + "value cannot be null"); if (this.value == null) { this.value = new ArrayList(); } @@ -117,9 +118,9 @@ protected ScopePropertyExclusions() { } protected ScopePropertyExclusions(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); + "name cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); + "value cannot be null"); name = builder.name; value = builder.value; } @@ -132,5 +133,20 @@ protected ScopePropertyExclusions(Builder builder) { public Builder newBuilder() { return new Builder(this); } -} + /** + * Gets the name. + * @return ScopePropertyExclusions name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * @return List of ScopePropertyExclusions + */ + public List value() { + return value; + } +} From ad7792cadebea0789b488c293248c58b4ce32219 Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:19:39 -0400 Subject: [PATCH 05/13] chore(SCC): Manual change to fix field types Signed-off-by: Bryan Bosely --- .../v3/model/RequiredConfigAnd.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAnd.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAnd.java index ad7c0286..b0c53ed2 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAnd.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigAnd.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -18,8 +18,9 @@ /** * RequiredConfigAnd. */ -public class RequiredConfigAnd extends RequiredConfig { - +public class RequiredConfigAnd { + private String description; + private List and; /** * Builder. @@ -33,7 +34,7 @@ public static class Builder { * * @param requiredConfigAnd the instance to initialize the Builder with */ - public Builder(RequiredConfig requiredConfigAnd) { + public Builder(RequiredConfigAnd requiredConfigAnd) { this.description = requiredConfigAnd.description; this.and = requiredConfigAnd.and; } @@ -61,7 +62,7 @@ public RequiredConfigAnd build() { */ public Builder addAnd(RequiredConfigItems and) { com.ibm.cloud.sdk.core.util.Validator.notNull(and, - "and cannot be null"); + "and cannot be null"); if (this.and == null) { this.and = new ArrayList(); } @@ -108,5 +109,24 @@ protected RequiredConfigAnd(Builder builder) { public Builder newBuilder() { return new Builder(this); } -} + /** + * Gets the description. + * A list of required configurations where one item should evaluate to true. + * + * @return the and + */ + public String description() { + return this.description; + } + + /** + * Gets the and. + * A list of required configurations where one item should evaluate to true. + * + * @return the and. + */ + public List and() { + return this.and; + } +} From b3472a2862d7986bcbf36eae63b7111181f0dfe8 Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:20:42 -0400 Subject: [PATCH 06/13] chore(SCC): Manual change to fix field types Signed-off-by: Bryan Bosely --- .../v3/model/RequiredConfigOr.java | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOr.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOr.java index a78cf501..6c4ceff8 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOr.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/RequiredConfigOr.java @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2025. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -18,8 +18,9 @@ /** * The `OR` required configurations. */ -public class RequiredConfigOr extends RequiredConfig { - +public class RequiredConfigOr { + private String description; + private List or; /** * Builder. @@ -33,7 +34,7 @@ public static class Builder { * * @param requiredConfigOr the instance to initialize the Builder with */ - public Builder(RequiredConfig requiredConfigOr) { + public Builder(RequiredConfigOr requiredConfigOr) { this.description = requiredConfigOr.description; this.or = requiredConfigOr.or; } @@ -61,7 +62,7 @@ public RequiredConfigOr build() { */ public Builder addOr(RequiredConfigItems or) { com.ibm.cloud.sdk.core.util.Validator.notNull(or, - "or cannot be null"); + "or cannot be null"); if (this.or == null) { this.or = new ArrayList(); } @@ -80,6 +81,17 @@ public Builder description(String description) { return this; } + /** + * Gets the or. + *

+ * A list of required configurations where one item should evaluate to true. + * + * @return the or + */ + public List or() { + return this.or; + } + /** * Set the or. * Existing or will be replaced. @@ -108,5 +120,26 @@ protected RequiredConfigOr(Builder builder) { public Builder newBuilder() { return new Builder(this); } -} + /** + * Gets the description. + *

+ * A list of required configurations where one item should evaluate to true. + * + * @return the or + */ + public String description() { + return this.description; + } + + /** + * Gets the or. + *

+ * A list of required configurations where one item should evaluate to true. + * + * @return the or + */ + public List or() { + return this.or; + } +} From ae42aa46621fcebf28c885a185874379eb01bfee Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:21:58 -0400 Subject: [PATCH 07/13] chore(SCC): Manual change to fix field types Signed-off-by: Bryan Bosely --- .../v3/model/ScopePropertyScopeId.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeId.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeId.java index 770bb52b..b0030ba0 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeId.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeId.java @@ -17,7 +17,9 @@ * The value of the identifier that correlates to scope type. If ScopePropertyScopeType schema uses the value * enterprise.account_group, the value should be the identifier or ID of the account_group within the enterprise. */ -public class ScopePropertyScopeId extends ScopeProperty { +public class ScopePropertyScopeId { + private String name; + private String value; /** * The key for the scope property. @@ -40,7 +42,7 @@ public static class Builder { * * @param scopePropertyScopeId the instance to initialize the Builder with */ - public Builder(ScopeProperty scopePropertyScopeId) { + public Builder(ScopePropertyScopeId scopePropertyScopeId) { this.name = scopePropertyScopeId.name; this.value = scopePropertyScopeId.value; } @@ -98,9 +100,9 @@ protected ScopePropertyScopeId() { } protected ScopePropertyScopeId(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); + "name cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); + "value cannot be null"); name = builder.name; value = builder.value; } @@ -113,5 +115,20 @@ protected ScopePropertyScopeId(Builder builder) { public Builder newBuilder() { return new Builder(this); } -} + /** + * Gets the name. + * @return ScopePropertyScopeId name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * @return List of ScopePropertyScopeId + */ + public String value() { + return value; + } +} From 9244ac7bc4978522ed2a92768eeb07ca6c2abbd7 Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:23:03 -0400 Subject: [PATCH 08/13] chore(SCC): Manual change to fix field types Signed-off-by: Bryan Bosely --- .../v3/model/ScopePropertyScopeType.java | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeType.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeType.java index ae49caa1..e5c9aea9 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeType.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/ScopePropertyScopeType.java @@ -16,7 +16,9 @@ /** * Attribute that details what kind of type of scope. */ -public class ScopePropertyScopeType extends ScopeProperty { +public class ScopePropertyScopeType { + private String name; + private String value; /** * key to say the attribute targets the scope type. @@ -62,7 +64,7 @@ public static class Builder { * * @param scopePropertyScopeType the instance to initialize the Builder with */ - public Builder(ScopeProperty scopePropertyScopeType) { + public Builder(ScopePropertyScopeType scopePropertyScopeType) { this.name = scopePropertyScopeType.name; this.value = scopePropertyScopeType.value; } @@ -120,9 +122,9 @@ protected ScopePropertyScopeType() { } protected ScopePropertyScopeType(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, - "name cannot be null"); + "name cannot be null"); com.ibm.cloud.sdk.core.util.Validator.notNull(builder.value, - "value cannot be null"); + "value cannot be null"); name = builder.name; value = builder.value; } @@ -135,5 +137,20 @@ protected ScopePropertyScopeType(Builder builder) { public Builder newBuilder() { return new Builder(this); } -} + /** + * Gets the name. + * @return ScopePropertyScopeType name + */ + public String name() { + return name; + } + + /** + * Gets the value. + * @return ScopePropertyScopeType value + */ + public String value() { + return value; + } +} From 35d2cd424af430a9698b03a4f22244b1896dbd84 Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:24:59 -0400 Subject: [PATCH 09/13] chore(SCC): Manual change to implement Builder static class Signed-off-by: Bryan Bosely --- .../v3/model/LastScan.java | 109 ++++++++++++++++-- 1 file changed, 100 insertions(+), 9 deletions(-) diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScan.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScan.java index 91e0a45f..59cfebb4 100644 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScan.java +++ b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScan.java @@ -10,7 +10,6 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date; @@ -18,47 +17,139 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * The last scan performed on a profile attachment. + * The details of the last scan of an attachment. */ public class LastScan extends GenericModel { + /** + * The status of the last scan of an attachment. + */ + public interface Status { + /** in_progress. */ + String IN_PROGRESS = "in_progress"; + /** completed. */ + String COMPLETED = "completed"; + } + protected String id; protected String status; protected Date time; + /** + * Builder. + */ + public static class Builder { + private String id; + private String status; + private Date time; + + /** + * Instantiates a new Builder from an existing LastScan instance. + * + * @param lastScan the instance to initialize the Builder with + */ + private Builder(LastScan lastScan) { + this.id = lastScan.id; + this.status = lastScan.status; + this.time = lastScan.time; + } + + /** + * Instantiates a new builder. + */ + public Builder() { + } + + /** + * Builds a LastScan. + * + * @return the new LastScan instance + */ + public LastScan build() { + return new LastScan(this); + } + + /** + * Set the id. + * + * @param id the id + * @return the LastScan builder + */ + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * Set the status. + * + * @param status the status + * @return the LastScan builder + */ + public Builder status(String status) { + this.status = status; + return this; + } + + /** + * Set the time. + * + * @param time the time + * @return the LastScan builder + */ + public Builder time(Date time) { + this.time = time; + return this; + } + } + protected LastScan() { } + protected LastScan(Builder builder) { + id = builder.id; + status = builder.status; + time = builder.time; + } + + /** + * New builder. + * + * @return a LastScan builder + */ + public Builder newBuilder() { + return new Builder(this); + } + /** * Gets the id. * - * The ID of the last scan. + * The ID of the last scan of an attachment. * * @return the id */ - public String getId() { + public String id() { return id; } /** * Gets the status. * - * Details the state of the last scan. + * The status of the last scan of an attachment. * * @return the status */ - public String getStatus() { + public String status() { return status; } /** * Gets the time. * - * The last time the scan ran. + * The time when the last scan started. * * @return the time */ - public Date getTime() { + public Date time() { return time; } } - From 7df2d9ca6193e07adfeda49c276e8f483ee96ed0 Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:29:42 -0400 Subject: [PATCH 10/13] Manual change to update SdkIntegrationBase import Signed-off-by: Bryan Bosely --- .../v3/SecurityAndComplianceCenterApiIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 581cca2d..2c4c4170 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 @@ -18,6 +18,7 @@ import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; import com.ibm.cloud.sdk.core.util.CredentialUtils; import com.ibm.cloud.sdk.core.util.DateUtils; +import com.ibm.cloud.security_and_compliance_center_api.test.SdkIntegrationTestBase; import com.ibm.cloud.security_and_compliance_center_api.v3.model.Account; import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalDetails; import com.ibm.cloud.security_and_compliance_center_api.v3.model.AdditionalProperty; @@ -232,7 +233,6 @@ import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpdateSubscopeOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.model.UpgradeAttachmentOptions; import com.ibm.cloud.security_and_compliance_center_api.v3.utils.TestUtilities; -import com.ibm.cloud.test.SdkIntegrationTestBase; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; From 625baecf719500eb05809bfe0d45b5748fa38306 Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:36:13 -0400 Subject: [PATCH 11/13] Manual change to fix incorrect method calls in assertion Signed-off-by: Bryan Bosely --- .../v3/model/AttachmentItemTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentItemTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentItemTest.java index 5746f4af..45b6c38f 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentItemTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentItemTest.java @@ -86,9 +86,9 @@ public void testAttachmentItem() throws Throwable { .status("in_progress") .time(DateUtils.parseAsDateTime("2000-01-23T04:56:07.000+00:00")) .build(); - assertEquals(lastScanModel.id(), "e8a39d25-0051-4328-8462-988ad321f49a"); - assertEquals(lastScanModel.status(), "in_progress"); - assertEquals(lastScanModel.time(), DateUtils.parseAsDateTime("2000-01-23T04:56:07.000+00:00")); + assertEquals(lastScanModel.id, "e8a39d25-0051-4328-8462-988ad321f49a"); + assertEquals(lastScanModel.status, "in_progress"); + assertEquals(lastScanModel.time, DateUtils.parseAsDateTime("2000-01-23T04:56:07.000+00:00")); AttachmentItem attachmentItemModel = new AttachmentItem.Builder() .id("130003ea8bfa43c5aacea07a86da3000") From 76e8cf843781c25cdf961a541407a5a2abb99eed Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:41:32 -0400 Subject: [PATCH 12/13] Manual change to fix incorrect method calls in assertion Signed-off-by: Bryan Bosely --- .../v3/model/LastScanTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScanTest.java b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScanTest.java index 6154940e..011a04b9 100644 --- a/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScanTest.java +++ b/modules/security-and-compliance-center-api/src/test/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/LastScanTest.java @@ -32,8 +32,8 @@ public class LastScanTest { @Test public void testLastScan() throws Throwable { LastScan lastScanModel = new LastScan(); - assertNull(lastScanModel.getId()); - assertNull(lastScanModel.getStatus()); - assertNull(lastScanModel.getTime()); + assertNull(lastScanModel.id()); + assertNull(lastScanModel.status()); + assertNull(lastScanModel.time()); } } \ No newline at end of file From 1a8e2c31eeae0e3062feb50d4912205728a3190c Mon Sep 17 00:00:00 2001 From: Bryan Bosely Date: Tue, 15 Apr 2025 13:42:19 -0400 Subject: [PATCH 13/13] Manual change to remove unused models Signed-off-by: Bryan Bosely --- .../v3/model/AttachmentsAccountPager.java | 107 ------------------ .../v3/model/AttachmentsPager.java | 107 ------------------ 2 files changed, 214 deletions(-) delete mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentsAccountPager.java delete mode 100644 modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentsPager.java diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentsAccountPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentsAccountPager.java deleted file mode 100644 index f9bb296e..00000000 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentsAccountPager.java +++ /dev/null @@ -1,107 +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.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * AttachmentsAccountPager can be used to simplify the use of the "listAttachmentsAccount" method. - */ -public class AttachmentsAccountPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListAttachmentsAccountOptions options; - protected SecurityAndComplianceCenterApi client; - protected PageContext pageContext; - - // Hide the default ctor. - protected AttachmentsAccountPager() { } - - /** - * Constructs a new AttachmentsAccountPager instance with the specified client and options model instance. - * @param client the SecurityAndComplianceCenterApi instance to be used to invoke the "listAttachmentsAccount" method - * @param options the ListAttachmentsAccountOptions instance to be used to invoke the "listAttachmentsAccount" method - */ - public AttachmentsAccountPager(SecurityAndComplianceCenterApi client, ListAttachmentsAccountOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<AttachmentItem> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListAttachmentsAccountOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - AttachmentCollection result = client.listAttachmentsAccount(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAttachments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<AttachmentItem> containing all results returned by the "listAttachmentsAccount" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -} diff --git a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentsPager.java b/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentsPager.java deleted file mode 100644 index 6a5f4af3..00000000 --- a/modules/security-and-compliance-center-api/src/main/java/com/ibm/cloud/security_and_compliance_center_api/v3/model/AttachmentsPager.java +++ /dev/null @@ -1,107 +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.security_and_compliance_center_api.v3.SecurityAndComplianceCenterApi; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * AttachmentsPager can be used to simplify the use of the "listAttachments" method. - */ -public class AttachmentsPager { - private static class PageContext { - private String next; - public String getNext() { - return next; - } - public void setNext(String next) { - this.next = next; - } - } - - protected boolean hasNext; - protected ListAttachmentsOptions options; - protected SecurityAndComplianceCenterApi client; - protected PageContext pageContext; - - // Hide the default ctor. - protected AttachmentsPager() { } - - /** - * Constructs a new AttachmentsPager instance with the specified client and options model instance. - * @param client the SecurityAndComplianceCenterApi instance to be used to invoke the "listAttachments" method - * @param options the ListAttachmentsOptions instance to be used to invoke the "listAttachments" method - */ - public AttachmentsPager(SecurityAndComplianceCenterApi client, ListAttachmentsOptions options) { - if (options.start() != null) { - throw new IllegalArgumentException("The options 'start' field should not be set"); - } - - this.hasNext = true; - this.client = client; - this.options = options.newBuilder().build(); - this.pageContext = new PageContext(); - } - - /** - * Returns true if there are more results to be retrieved. - * @return boolean - */ - public boolean hasNext() { - return hasNext; - } - - /** - * Returns the next page of results. - * @return a List<AttachmentItem> that contains the next page of results - */ - public List getNext() { - if (!hasNext()) { - throw new NoSuchElementException("No more results available"); - } - - ListAttachmentsOptions.Builder builder = this.options.newBuilder(); - if (this.pageContext.getNext() != null) { - builder.start(this.pageContext.getNext()); - } - this.options = builder.build(); - - AttachmentCollection result = client.listAttachments(options).execute().getResult(); - - String next = null; - if (result.getNext() != null) { - next = result.getNext().getStart(); - } - this.pageContext.setNext(next); - if (next == null) { - this.hasNext = false; - } - - return result.getAttachments(); - } - - /** - * Returns all results by invoking getNext() repeatedly until all pages of results have been retrieved. - * @return a List<AttachmentItem> containing all results returned by the "listAttachments" method - */ - public List getAll() { - List results = new ArrayList<>(); - while (hasNext()) { - List nextPage = getNext(); - results.addAll(nextPage); - } - return results; - } -}