From 411a7729229f8dea093a9f679ef64d7561d0479a Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Mon, 23 Dec 2024 07:30:35 +0000 Subject: [PATCH] [Automation] Generate Fluent Lite from Swagger security#package-composite-v3 --- .../CHANGELOG.md | 344 +- .../azure-resourcemanager-security/README.md | 13 +- .../azure-resourcemanager-security/SAMPLE.md | 2412 ++++++++++---- .../azure-resourcemanager-security/pom.xml | 1 + .../security/SecurityManager.java | 371 ++- .../AdaptiveApplicationControlsClient.java | 133 - .../AdaptiveNetworkHardeningsClient.java | 172 - .../fluent/CustomRecommendationsClient.java | 153 + .../fluent/DefenderForStoragesClient.java | 89 + .../security/fluent/DevOpsPoliciesClient.java | 76 + .../fluent/DevOpsPolicyAssignmentsClient.java | 273 ++ .../security/fluent/OperationsClient.java | 4 +- .../security/fluent/SecurityCenter.java | 165 +- .../fluent/SecurityStandardsClient.java | 149 + .../fluent/StandardAssignmentsClient.java | 155 + .../AdaptiveApplicationControlGroupData.java | 217 -- .../AdaptiveApplicationControlGroupInner.java | 211 -- ...AdaptiveApplicationControlGroupsInner.java | 59 - .../models/AdaptiveNetworkHardeningInner.java | 123 - .../AdaptiveNetworkHardeningProperties.java | 119 - .../AdvancedThreatProtectionProperties.java | 47 +- .../AdvancedThreatProtectionSettingInner.java | 96 +- .../security/fluent/models/AlertInner.java | 94 +- .../fluent/models/AlertProperties.java | 159 +- .../models/AlertSyncSettingProperties.java | 46 +- .../models/AlertsSuppressionRuleInner.java | 95 +- .../AlertsSuppressionRuleProperties.java | 78 +- .../AllowedConnectionsResourceInner.java | 98 +- .../AllowedConnectionsResourceProperties.java | 53 +- .../fluent/models/ApiCollectionInner.java | 94 +- .../models/ApiCollectionProperties.java | 79 +- .../fluent/models/ApplicationInner.java | 94 +- .../fluent/models/ApplicationProperties.java | 62 +- .../fluent/models/AscLocationInner.java | 94 +- .../models/AutoProvisioningSettingInner.java | 95 +- .../AutoProvisioningSettingProperties.java | 48 +- .../fluent/models/AutomationInner.java | 101 +- .../fluent/models/AutomationProperties.java | 70 +- .../AutomationValidationStatusInner.java | 50 +- .../fluent/models/AzureDevOpsOrgInner.java | 97 +- .../AzureDevOpsOrgListResponseInner.java | 52 +- .../models/AzureDevOpsProjectInner.java | 97 +- .../models/AzureDevOpsRepositoryInner.java | 98 +- .../fluent/models/ComplianceInner.java | 94 +- .../fluent/models/ComplianceProperties.java | 57 +- .../fluent/models/ComplianceResultInner.java | 94 +- .../models/ComplianceResultProperties.java | 45 +- .../fluent/models/ConnectorSettingInner.java | 94 +- .../models/ConnectorSettingProperties.java | 51 +- .../CustomAssessmentAutomationInner.java | 99 +- .../CustomAssessmentAutomationProperties.java | 74 +- ...AssessmentAutomationRequestProperties.java | 70 +- .../CustomEntityStoreAssignmentInner.java | 99 +- ...CustomEntityStoreAssignmentProperties.java | 51 +- ...ntityStoreAssignmentRequestProperties.java | 50 +- .../models/CustomRecommendationInner.java | 332 ++ .../CustomRecommendationProperties.java | 289 ++ .../models/DataExportSettingProperties.java | 46 +- .../DefenderForStorageSettingInner.java | 229 +- .../DefenderForStorageSettingProperties.java | 237 -- .../models/DevOpsConfigurationInner.java | 97 +- .../models/DevOpsPolicyAssignmentInner.java | 167 + .../fluent/models/DevOpsPolicyInner.java | 168 + .../models/DeviceSecurityGroupInner.java | 95 +- .../models/DeviceSecurityGroupProperties.java | 69 +- .../DiscoveredSecuritySolutionInner.java | 99 +- .../DiscoveredSecuritySolutionProperties.java | 62 +- .../models/ExternalSecuritySolutionInner.java | 157 +- ...tSensitivitySettingsListResponseInner.java | 49 +- .../GetSensitivitySettingsResponseInner.java | 96 +- .../fluent/models/GitHubOwnerInner.java | 97 +- .../models/GitHubOwnerListResponseInner.java | 50 +- .../fluent/models/GitHubRepositoryInner.java | 97 +- .../fluent/models/GitLabGroupInner.java | 97 +- .../models/GitLabGroupListResponseInner.java | 50 +- .../fluent/models/GitLabProjectInner.java | 97 +- .../models/GovernanceAssignmentInner.java | 95 +- .../GovernanceAssignmentProperties.java | 81 +- .../fluent/models/GovernanceRuleInner.java | 94 +- .../models/GovernanceRuleProperties.java | 118 +- .../fluent/models/HealthReportInner.java | 94 +- .../fluent/models/HealthReportProperties.java | 84 +- .../InformationProtectionPolicyInner.java | 96 +- ...InformationProtectionPolicyProperties.java | 67 +- .../IoTSecurityAggregatedAlertInner.java | 103 +- .../IoTSecurityAggregatedAlertProperties.java | 86 +- ...SecurityAggregatedRecommendationInner.java | 103 +- ...ityAggregatedRecommendationProperties.java | 78 +- ...oTSecuritySolutionAnalyticsModelInner.java | 98 +- ...curitySolutionAnalyticsModelListInner.java | 53 +- ...uritySolutionAnalyticsModelProperties.java | 80 +- .../models/IoTSecuritySolutionModelInner.java | 110 +- .../models/IoTSecuritySolutionProperties.java | 104 +- .../models/JitNetworkAccessPolicyInner.java | 102 +- .../JitNetworkAccessPolicyProperties.java | 59 +- .../models/JitNetworkAccessRequestInner.java | 65 +- .../fluent/models/MalwareScanInner.java | 97 + .../models/MalwareScanningProperties.java | 141 - .../fluent/models/MdeOnboardingDataInner.java | 94 +- .../models/MdeOnboardingDataListInner.java | 47 +- .../models/MdeOnboardingDataProperties.java | 55 +- .../fluent/models/OperationInner.java | 118 +- .../OperationResultAutoGeneratedInner.java | 46 +- .../models/OperationStatusResultInner.java | 82 +- .../security/fluent/models/PricingInner.java | 94 +- .../fluent/models/PricingListInner.java | 47 +- .../fluent/models/PricingProperties.java | 113 +- .../RegulatoryComplianceAssessmentInner.java | 96 +- ...ulatoryComplianceAssessmentProperties.java | 72 +- .../RegulatoryComplianceControlInner.java | 96 +- ...RegulatoryComplianceControlProperties.java | 62 +- .../RegulatoryComplianceStandardInner.java | 96 +- ...egulatoryComplianceStandardProperties.java | 63 +- .../fluent/models/RuleResultsInner.java | 94 +- .../fluent/models/RulesResultsInner.java | 46 +- .../security/fluent/models/ScanInner.java | 94 +- .../fluent/models/ScanResultInner.java | 94 +- .../fluent/models/ScanResultsInner.java | 46 +- .../security/fluent/models/ScansInner.java | 46 +- .../security/fluent/models/ScoreDetails.java | 50 +- ...SecureScoreControlDefinitionItemInner.java | 96 +- ...eScoreControlDefinitionItemProperties.java | 63 +- .../SecureScoreControlDetailsInner.java | 96 +- .../SecureScoreControlScoreDetailsInner.java | 72 +- .../fluent/models/SecureScoreItemInner.java | 93 +- .../models/SecureScoreItemProperties.java | 53 +- .../SecurityAssessmentMetadataProperties.java | 117 +- ...yAssessmentMetadataPropertiesResponse.java | 149 +- ...curityAssessmentMetadataResponseInner.java | 96 +- .../models/SecurityAssessmentProperties.java | 110 +- .../SecurityAssessmentPropertiesResponse.java | 112 +- .../SecurityAssessmentResponseInner.java | 96 +- .../fluent/models/SecurityConnectorInner.java | 104 +- .../models/SecurityConnectorProperties.java | 70 +- .../fluent/models/SecurityContactInner.java | 94 +- .../models/SecurityContactProperties.java | 71 +- .../fluent/models/SecurityOperatorInner.java | 94 +- .../models/SecurityOperatorListInner.java | 48 +- .../fluent/models/SecuritySolutionInner.java | 97 +- .../models/SecuritySolutionProperties.java | 62 +- ...curitySolutionsReferenceDataListInner.java | 49 +- ...uritySolutionsReferenceDataProperties.java | 74 +- .../fluent/models/SecurityStandardInner.java | 289 ++ .../models/SecuritySubAssessmentInner.java | 95 +- .../SecuritySubAssessmentProperties.java | 77 +- .../fluent/models/SecurityTaskInner.java | 94 +- .../fluent/models/SecurityTaskProperties.java | 60 +- .../SensitiveDataDiscoveryProperties.java | 74 - .../ServerVulnerabilityAssessmentInner.java | 96 +- ...rverVulnerabilityAssessmentProperties.java | 47 +- ...lityAssessmentsAzureSettingProperties.java | 51 +- ...rverVulnerabilityAssessmentsListInner.java | 49 +- ...rVulnerabilityAssessmentsSettingInner.java | 152 +- .../security/fluent/models/SettingInner.java | 134 +- .../security/fluent/models/SoftwareInner.java | 94 +- .../fluent/models/SoftwareProperties.java | 80 +- .../models/StandardAssignmentInner.java | 353 ++ .../models/StandardAssignmentProperties.java | 347 ++ .../fluent/models/StandardProperties.java | 265 ++ .../fluent/models/TopologyResourceInner.java | 96 +- .../models/TopologyResourceProperties.java | 51 +- .../UpdateIoTSecuritySolutionProperties.java | 56 +- .../fluent/models/WorkspaceSettingInner.java | 94 +- .../models/WorkspaceSettingProperties.java | 53 +- .../AdaptiveApplicationControlGroupImpl.java | 202 -- .../AdaptiveApplicationControlGroupsImpl.java | 44 - ...AdaptiveApplicationControlsClientImpl.java | 589 ---- .../AdaptiveApplicationControlsImpl.java | 148 - .../AdaptiveNetworkHardeningImpl.java | 67 - .../AdaptiveNetworkHardeningsClientImpl.java | 851 ----- .../AdaptiveNetworkHardeningsImpl.java | 91 - .../AdvancedThreatProtectionsImpl.java | 2 +- .../implementation/AlertsClientImpl.java | 32 +- .../security/implementation/AlertsImpl.java | 2 +- .../AlertsSuppressionRulesClientImpl.java | 8 +- .../AllowedConnectionsClientImpl.java | 16 +- .../ApiCollectionsClientImpl.java | 24 +- .../ApplicationsClientImpl.java | 8 +- .../implementation/AssessmentsClientImpl.java | 8 +- .../AssessmentsMetadatasClientImpl.java | 16 +- .../AutoProvisioningSettingsClientImpl.java | 8 +- .../implementation/AutomationsClientImpl.java | 16 +- .../implementation/AutomationsImpl.java | 2 +- .../AzureDevOpsOrgsClientImpl.java | 28 +- .../AzureDevOpsProjectsClientImpl.java | 24 +- .../AzureDevOpsReposClientImpl.java | 24 +- .../ComplianceResultsClientImpl.java | 8 +- .../implementation/CompliancesClientImpl.java | 8 +- .../implementation/ConnectorsClientImpl.java | 8 +- .../implementation/ConnectorsImpl.java | 2 +- ...CustomAssessmentAutomationsClientImpl.java | 16 +- ...ustomEntityStoreAssignmentsClientImpl.java | 16 +- .../CustomRecommendationImpl.java | 196 ++ .../CustomRecommendationsClientImpl.java | 698 ++++ .../CustomRecommendationsImpl.java | 149 + .../DefenderForStorageSettingImpl.java | 69 +- .../DefenderForStoragesClientImpl.java | 398 ++- .../DefenderForStoragesImpl.java | 67 +- .../DevOpsConfigurationsClientImpl.java | 28 +- .../DevOpsOperationResultsClientImpl.java | 4 +- .../DevOpsPoliciesClientImpl.java | 454 +++ .../implementation/DevOpsPoliciesImpl.java | 70 + .../DevOpsPolicyAssignmentImpl.java | 132 + .../DevOpsPolicyAssignmentsClientImpl.java | 1284 ++++++++ .../DevOpsPolicyAssignmentsImpl.java | 163 + .../implementation/DevOpsPolicyImpl.java | 49 + .../DeviceSecurityGroupsClientImpl.java | 8 +- ...DiscoveredSecuritySolutionsClientImpl.java | 16 +- .../ExternalSecuritySolutionsClientImpl.java | 16 +- .../GitHubOwnersClientImpl.java | 20 +- .../implementation/GitHubReposClientImpl.java | 16 +- .../GitLabGroupsClientImpl.java | 20 +- .../GitLabProjectsClientImpl.java | 16 +- .../GitLabSubgroupsClientImpl.java | 4 +- .../GovernanceAssignmentsClientImpl.java | 8 +- .../GovernanceRulesClientImpl.java | 8 +- .../HealthReportsClientImpl.java | 8 +- ...formationProtectionPoliciesClientImpl.java | 8 +- .../IotSecuritySolutionAnalyticsImpl.java | 2 +- ...nsAnalyticsAggregatedAlertsClientImpl.java | 8 +- ...onsAnalyticsRecommendationsClientImpl.java | 8 +- .../IotSecuritySolutionsClientImpl.java | 16 +- .../JitNetworkAccessPoliciesClientImpl.java | 32 +- .../implementation/LocationsClientImpl.java | 8 +- .../implementation/MalwareScanImpl.java | 32 + .../implementation/OperationImpl.java | 14 +- .../implementation/OperationsClientImpl.java | 34 +- ...latoryComplianceAssessmentsClientImpl.java | 8 +- ...egulatoryComplianceControlsClientImpl.java | 8 +- ...gulatoryComplianceStandardsClientImpl.java | 8 +- ...cureScoreControlDefinitionsClientImpl.java | 16 +- .../SecureScoreControlsClientImpl.java | 16 +- .../SecureScoresClientImpl.java | 8 +- .../implementation/SecurityCenterImpl.java | 370 ++- ...curityConnectorApplicationsClientImpl.java | 8 +- .../SecurityConnectorsClientImpl.java | 40 +- .../SecurityContactsClientImpl.java | 8 +- .../SecuritySolutionsClientImpl.java | 8 +- .../implementation/SecurityStandardImpl.java | 187 ++ .../SecurityStandardsClientImpl.java | 676 ++++ .../implementation/SecurityStandardsImpl.java | 142 + ...rabilityAssessmentsSettingsClientImpl.java | 8 +- .../implementation/SettingsClientImpl.java | 8 +- .../SoftwareInventoriesClientImpl.java | 16 +- .../StandardAssignmentImpl.java | 182 ++ .../StandardAssignmentsClientImpl.java | 704 ++++ .../StandardAssignmentsImpl.java | 149 + .../SubAssessmentsClientImpl.java | 16 +- .../implementation/TasksClientImpl.java | 24 +- .../security/implementation/TasksImpl.java | 2 +- .../implementation/TopologiesClientImpl.java | 16 +- .../WorkspaceSettingsClientImpl.java | 8 +- .../security/models/AadConnectivityState.java | 2 - .../AadConnectivityStateAutoGenerated.java | 50 +- .../models/AadExternalSecuritySolution.java | 127 +- .../models/AadSolutionProperties.java | 72 +- .../models/AccessTokenAuthentication.java | 143 + .../security/models/ActionType.java | 9 +- .../models/ActionableRemediation.java | 62 +- .../models/ActionableRemediationState.java | 2 - .../ActiveConnectionsNotInAllowedRange.java | 81 +- .../AdaptiveApplicationControlGroup.java | 334 -- .../AdaptiveApplicationControlGroups.java | 27 - .../AdaptiveApplicationControlIssue.java | 76 - ...daptiveApplicationControlIssueSummary.java | 80 - .../models/AdaptiveNetworkHardening.java | 64 - ...daptiveNetworkHardeningEnforceRequest.java | 98 - .../models/AdaptiveNetworkHardenings.java | 119 - .../models/AdaptiveNetworkHardeningsList.java | 85 - .../security/models/AdditionalData.java | 94 +- .../models/AdditionalWorkspaceDataType.java | 2 - .../models/AdditionalWorkspaceType.java | 2 - .../AdditionalWorkspacesProperties.java | 58 +- .../security/models/AlertEntity.java | 70 +- .../security/models/AlertList.java | 49 +- .../AlertPropertiesSupportingEvidence.java | 71 +- .../security/models/AlertSeverity.java | 2 - ...lertSimulatorBundlesRequestProperties.java | 73 +- .../models/AlertSimulatorRequestBody.java | 45 +- .../AlertSimulatorRequestProperties.java | 112 +- .../security/models/AlertStatus.java | 2 - .../security/models/AlertSyncSettings.java | 105 +- .../models/AlertsSuppressionRulesList.java | 51 +- .../models/AllowedConnectionsList.java | 49 +- .../models/AllowlistCustomAlertRule.java | 106 +- .../AmqpC2DMessagesNotInAllowedRange.java | 81 +- ...pC2DRejectedMessagesNotInAllowedRange.java | 81 +- .../AmqpD2CMessagesNotInAllowedRange.java | 81 +- .../models/AnnotateDefaultBranchState.java | 2 - .../security/models/ApiCollectionList.java | 48 +- .../models/ApplicationSourceResourceType.java | 2 - .../security/models/ApplicationsList.java | 48 +- .../security/models/ArcAutoProvisioning.java | 49 +- .../models/ArcAutoProvisioningAws.java | 53 +- .../ArcAutoProvisioningConfiguration.java | 50 +- .../models/ArcAutoProvisioningGcp.java | 48 +- .../security/models/AscLocationList.java | 48 +- .../security/models/AssessedResourceType.java | 2 - .../security/models/AssessmentLinks.java | 44 +- .../security/models/AssessmentStatus.java | 54 +- .../security/models/AssessmentStatusCode.java | 2 - .../models/AssessmentStatusResponse.java | 65 +- .../security/models/AssessmentType.java | 2 - .../models/AssignedAssessmentItem.java | 93 + .../security/models/AssignedStandardItem.java | 93 + .../models/AtaExternalSecuritySolution.java | 127 +- .../models/AtaSolutionProperties.java | 68 +- .../models/AttestationComplianceState.java | 56 + .../security/models/AttestationEvidence.java | 121 + .../security/models/Authentication.java | 108 + .../AuthenticationDetailsProperties.java | 130 +- .../AuthenticationProvisioningState.java | 2 - .../security/models/AuthenticationType.java | 2 - .../security/models/Authorization.java | 45 +- .../security/models/AutoDiscovery.java | 2 - .../security/models/AutoProvision.java | 2 - .../models/AutoProvisioningSettingList.java | 50 +- .../security/models/AutomationAction.java | 88 +- .../models/AutomationActionEventHub.java | 69 +- .../models/AutomationActionLogicApp.java | 64 +- .../models/AutomationActionWorkspace.java | 57 +- .../security/models/AutomationList.java | 50 +- .../security/models/AutomationRuleSet.java | 47 +- .../security/models/AutomationScope.java | 52 +- .../security/models/AutomationSource.java | 53 +- .../models/AutomationTriggeringRule.java | 57 +- .../models/AutomationUpdateModel.java | 47 +- ...meRoleAuthenticationDetailsProperties.java | 79 +- ...sCredsAuthenticationDetailsProperties.java | 79 +- .../security/models/AwsEnvironmentData.java | 70 +- .../models/AwsOrganizationalData.java | 92 +- .../models/AwsOrganizationalDataMaster.java | 65 +- .../models/AwsOrganizationalDataMember.java | 59 +- .../models/AzureDevOpsOrgProperties.java | 93 +- .../AzureDevOpsProjectListResponse.java | 52 +- .../models/AzureDevOpsProjectProperties.java | 101 +- .../AzureDevOpsRepositoryListResponse.java | 52 +- .../AzureDevOpsRepositoryProperties.java | 112 +- .../AzureDevOpsScopeEnvironmentData.java | 56 +- .../security/models/AzureResourceDetails.java | 52 +- .../models/AzureResourceIdentifier.java | 56 +- .../security/models/AzureResourceLink.java | 44 +- .../security/models/AzureServersSetting.java | 125 +- .../models/AzureTrackedResourceLocation.java | 45 +- .../security/models/Baseline.java | 56 +- .../models/BaselineAdjustedResult.java | 63 +- .../security/models/BenchmarkReference.java | 49 +- .../security/models/BlobsScanSummary.java | 177 + .../security/models/BuiltInInfoType.java | 55 +- .../security/models/BundleType.java | 2 - .../security/models/Categories.java | 2 - .../models/CategoryConfiguration.java | 49 +- .../models/CefExternalSecuritySolution.java | 127 +- .../models/CefSolutionProperties.java | 76 +- .../security/models/CloudName.java | 12 +- .../security/models/CloudOffering.java | 144 +- .../resourcemanager/security/models/Code.java | 2 - .../security/models/ComplianceList.java | 49 +- .../security/models/ComplianceResultList.java | 51 +- .../security/models/ComplianceSegment.java | 47 +- .../security/models/ConfigurationStatus.java | 68 - .../security/models/ConnectableResource.java | 54 +- .../security/models/ConnectedResource.java | 50 +- .../security/models/ConnectedWorkspace.java | 45 +- .../models/ConnectionFromIpNotAllowed.java | 76 +- .../models/ConnectionToIpNotAllowed.java | 76 +- .../security/models/ConnectionType.java | 2 - .../security/models/ConnectorSettingList.java | 50 +- ...tainerRegistryVulnerabilityProperties.java | 89 +- .../security/models/ControlType.java | 2 - .../models/CspmMonitorAwsOffering.java | 60 +- ...nitorAwsOfferingNativeCloudConnection.java | 47 +- .../CspmMonitorAzureDevOpsOffering.java | 57 +- .../models/CspmMonitorDockerHubOffering.java | 85 + .../models/CspmMonitorGcpOffering.java | 60 +- ...nitorGcpOfferingNativeCloudConnection.java | 53 +- .../models/CspmMonitorGitLabOffering.java | 55 +- .../models/CspmMonitorGithubOffering.java | 55 +- .../models/CspmMonitorJFrogOffering.java | 85 + .../security/models/CustomAlertRule.java | 164 +- .../CustomAssessmentAutomationRequest.java | 96 +- ...CustomAssessmentAutomationsListResult.java | 52 +- .../CustomEntityStoreAssignmentRequest.java | 47 +- ...ustomEntityStoreAssignmentsListResult.java | 52 +- .../security/models/CustomRecommendation.java | 407 +++ .../models/CustomRecommendations.java | 162 + .../models/CustomRecommendationsList.java | 117 + .../resourcemanager/security/models/Cve.java | 47 +- .../resourcemanager/security/models/Cvss.java | 44 +- .../security/models/DataExportSettings.java | 105 +- .../security/models/DataSource.java | 2 - .../models/DefenderCspmAwsOffering.java | 83 +- .../models/DefenderCspmAwsOfferingCiem.java | 50 +- .../DefenderCspmAwsOfferingCiemDiscovery.java | 47 +- .../DefenderCspmAwsOfferingCiemOidc.java | 50 +- ...pmAwsOfferingDataSensitivityDiscovery.java | 52 +- .../DefenderCspmAwsOfferingDatabasesDspm.java | 52 +- ...ingMdcContainersAgentlessDiscoveryK8S.java | 55 +- ...sOfferingMdcContainersImageAssessment.java | 53 +- .../DefenderCspmAwsOfferingVmScanners.java | 53 +- .../models/DefenderCspmDockerHubOffering.java | 87 + .../models/DefenderCspmGcpOffering.java | 79 +- .../DefenderCspmGcpOfferingCiemDiscovery.java | 55 +- ...pmGcpOfferingDataSensitivityDiscovery.java | 58 +- ...ingMdcContainersAgentlessDiscoveryK8S.java | 60 +- ...pOfferingMdcContainersImageAssessment.java | 59 +- .../DefenderCspmGcpOfferingVmScanners.java | 50 +- .../models/DefenderCspmJFrogOffering.java | 118 + ...gOfferingMdcContainersImageAssessment.java | 97 + .../DefenderFoDatabasesAwsOffering.java | 71 +- ...tabasesAwsOfferingArcAutoProvisioning.java | 53 +- ...erFoDatabasesAwsOfferingDatabasesDspm.java | 52 +- .../DefenderFoDatabasesAwsOfferingRds.java | 50 +- .../DefenderForContainersAwsOffering.java | 116 +- ...tainersAwsOfferingCloudWatchToKinesis.java | 48 +- ...erForContainersAwsOfferingKinesisToS3.java | 47 +- ...rsAwsOfferingKubernetesDataCollection.java | 50 +- ...ontainersAwsOfferingKubernetesService.java | 47 +- ...ingMdcContainersAgentlessDiscoveryK8S.java | 55 +- ...sOfferingMdcContainersImageAssessment.java | 55 +- ...derForContainersAwsOfferingVmScanners.java | 53 +- ...efenderForContainersDockerHubOffering.java | 87 + .../DefenderForContainersGcpOffering.java | 97 +- ...ringDataPipelineNativeCloudConnection.java | 55 +- ...ingMdcContainersAgentlessDiscoveryK8S.java | 60 +- ...pOfferingMdcContainersImageAssessment.java | 60 +- ...inersGcpOfferingNativeCloudConnection.java | 54 +- ...derForContainersGcpOfferingVmScanners.java | 50 +- .../DefenderForContainersJFrogOffering.java | 87 + .../DefenderForDatabasesGcpOffering.java | 68 +- ...tabasesGcpOfferingArcAutoProvisioning.java | 51 +- ...fenderForDatabasesArcAutoProvisioning.java | 55 +- .../models/DefenderForServersAwsOffering.java | 87 +- ...ServersAwsOfferingArcAutoProvisioning.java | 53 +- ...rServersAwsOfferingDefenderForServers.java | 47 +- ...ServersAwsOfferingMdeAutoProvisioning.java | 52 +- .../DefenderForServersAwsOfferingSubPlan.java | 47 +- ...rServersAwsOfferingVaAutoProvisioning.java | 53 +- ...feringVaAutoProvisioningConfiguration.java | 50 +- ...fenderForServersAwsOfferingVmScanners.java | 53 +- .../models/DefenderForServersGcpOffering.java | 87 +- ...ServersGcpOfferingArcAutoProvisioning.java | 50 +- ...rServersGcpOfferingDefenderForServers.java | 53 +- ...ServersGcpOfferingMdeAutoProvisioning.java | 52 +- .../DefenderForServersGcpOfferingSubPlan.java | 47 +- ...rServersGcpOfferingVaAutoProvisioning.java | 53 +- ...feringVaAutoProvisioningConfiguration.java | 50 +- ...fenderForServersGcpOfferingVmScanners.java | 50 +- .../models/DefenderForStorageSetting.java | 174 +- .../DefenderForStorageSettingProperties.java | 194 ++ .../security/models/DefenderForStorages.java | 81 + .../models/DenylistCustomAlertRule.java | 69 +- .../security/models/DescendantBehavior.java | 56 + .../security/models/DevOpsCapability.java | 47 +- .../DevOpsConfigurationListResponse.java | 52 +- .../models/DevOpsConfigurationProperties.java | 101 +- .../security/models/DevOpsPolicies.java | 69 + .../security/models/DevOpsPolicy.java | 56 + .../models/DevOpsPolicyAssignment.java | 189 ++ .../DevOpsPolicyAssignmentListResponse.java | 129 + .../DevOpsPolicyAssignmentProperties.java | 254 ++ ...rols.java => DevOpsPolicyAssignments.java} | 103 +- .../models/DevOpsPolicyDescriptor.java | 177 + .../models/DevOpsPolicyListResponse.java | 127 + .../models/DevOpsPolicyProperties.java | 279 ++ .../security/models/DevOpsPolicySource.java | 56 + .../security/models/DevOpsPolicyType.java | 51 + .../models/DevOpsProvisioningState.java | 2 - .../models/DeviceSecurityGroupList.java | 50 +- .../DirectMethodInvokesNotInAllowedRange.java | 81 +- .../security/models/Direction.java | 53 - .../DiscoveredSecuritySolutionList.java | 51 +- .../models/DockerHubEnvironmentData.java | 144 + .../security/models/Effect.java | 56 + .../EffectiveNetworkSecurityGroups.java | 81 - .../security/models/EndOfSupportStatus.java | 2 - .../security/models/Enforce.java | 2 - .../security/models/EnforcementMode.java | 58 - .../security/models/EnforcementSupport.java | 58 - .../security/models/EnvironmentData.java | 103 +- .../security/models/EnvironmentDetails.java | 67 +- .../security/models/EnvironmentType.java | 12 +- .../resourcemanager/security/models/Etag.java | 45 +- .../security/models/EventSource.java | 2 - .../models/ExecuteGovernanceRuleParams.java | 45 +- .../security/models/ExemptionCategory.java | 51 + .../security/models/ExpandControlsEnum.java | 2 - .../security/models/ExpandEnum.java | 2 - .../security/models/ExportData.java | 2 - .../security/models/Extension.java | 200 +- .../models/ExternalSecuritySolutionKind.java | 2 - .../models/ExternalSecuritySolutionList.java | 50 +- .../ExternalSecuritySolutionProperties.java | 80 +- .../FailedLocalLoginsNotInAllowedRange.java | 81 +- .../security/models/FileType.java | 73 - .../models/FileUploadsNotInAllowedRange.java | 80 +- .../GcpCredentialsDetailsProperties.java | 112 +- .../models/GcpOrganizationalData.java | 92 +- .../models/GcpOrganizationalDataMember.java | 63 +- .../GcpOrganizationalDataOrganization.java | 76 +- .../security/models/GcpProjectDetails.java | 55 +- .../models/GcpProjectEnvironmentData.java | 67 +- ...SensitivitySettingsResponseProperties.java | 70 +- ...tingsResponsePropertiesMipInformation.java | 70 +- .../models/GitHubOwnerProperties.java | 94 +- .../models/GitHubRepositoryListResponse.java | 51 +- .../models/GitHubRepositoryProperties.java | 105 +- .../models/GitLabGroupProperties.java | 100 +- .../models/GitLabProjectListResponse.java | 50 +- .../models/GitLabProjectProperties.java | 104 +- .../models/GithubScopeEnvironmentData.java | 55 +- .../models/GitlabScopeEnvironmentData.java | 55 +- .../GovernanceAssignmentAdditionalData.java | 55 +- .../models/GovernanceAssignmentsList.java | 49 +- .../models/GovernanceEmailNotification.java | 53 +- .../GovernanceRuleEmailNotification.java | 52 +- .../security/models/GovernanceRuleList.java | 49 +- .../models/GovernanceRuleMetadata.java | 56 +- .../models/GovernanceRuleOwnerSource.java | 50 +- .../models/GovernanceRuleOwnerSourceType.java | 2 - .../GovernanceRuleSourceResourceType.java | 2 - .../security/models/GovernanceRuleType.java | 2 - ...overnanceRulesOperationResultsHeaders.java | 2 - .../models/HealthDataClassification.java | 53 +- .../security/models/HealthReportsList.java | 48 +- .../HttpC2DMessagesNotInAllowedRange.java | 81 +- ...pC2DRejectedMessagesNotInAllowedRange.java | 81 +- .../HttpD2CMessagesNotInAllowedRange.java | 81 +- .../HybridComputeProvisioningState.java | 2 - .../HybridComputeSettingsProperties.java | 72 +- .../security/models/Identity.java | 51 +- .../security/models/ImplementationEffort.java | 2 - .../security/models/InfoType.java | 55 +- .../models/InformationProtectionKeyword.java | 57 +- .../InformationProtectionPolicyList.java | 51 +- .../InformationProtectionPolicyName.java | 2 - .../security/models/InformationType.java | 73 +- .../models/InheritFromParentState.java | 2 - .../security/models/Inherited.java | 2 - .../security/models/Intent.java | 2 - .../IoTSecurityAggregatedAlertList.java | 52 +- ...atedAlertPropertiesTopDevicesListItem.java | 55 +- ...TSecurityAggregatedRecommendationList.java | 53 +- .../models/IoTSecurityAlertedDevice.java | 47 +- .../models/IoTSecurityDeviceAlert.java | 51 +- .../IoTSecurityDeviceRecommendation.java | 52 +- ...ticsModelPropertiesDevicesMetricsItem.java | 58 +- .../models/IoTSecuritySolutionsList.java | 51 +- .../security/models/IoTSeverityMetrics.java | 53 +- .../security/models/IsEnabled.java | 2 - .../security/models/Issue.java | 79 +- .../security/models/JFrogEnvironmentData.java | 112 + .../models/JitNetworkAccessPoliciesList.java | 50 +- .../JitNetworkAccessPolicyInitiatePort.java | 59 +- ...JitNetworkAccessPolicyInitiateRequest.java | 55 +- ...orkAccessPolicyInitiateVirtualMachine.java | 54 +- .../JitNetworkAccessPolicyVirtualMachine.java | 58 +- .../models/JitNetworkAccessPortRule.java | 67 +- .../models/JitNetworkAccessRequestPort.java | 79 +- ...JitNetworkAccessRequestVirtualMachine.java | 54 +- .../resourcemanager/security/models/Kind.java | 2 - .../security/models/KindAutoGenerated.java | 45 +- .../security/models/Label.java | 55 +- .../security/models/ListCustomAlertRule.java | 114 +- .../security/models/LocalUserNotAllowed.java | 76 +- .../security/models/Location.java | 55 +- .../models/LogAnalyticsIdentifier.java | 61 +- .../security/models/MalwareScan.java | 26 + .../models/MalwareScanProperties.java | 238 ++ .../models/MalwareScanningProperties.java | 147 + .../security/models/MinimalRiskLevel.java | 2 - .../security/models/MinimalSeverity.java | 2 - .../security/models/MipIntegrationStatus.java | 2 - .../MqttC2DMessagesNotInAllowedRange.java | 81 +- ...tC2DRejectedMessagesNotInAllowedRange.java | 81 +- .../MqttD2CMessagesNotInAllowedRange.java | 81 +- .../security/models/NotificationsSource.java | 89 +- .../models/NotificationsSourceAlert.java | 59 +- .../models/NotificationsSourceAttackPath.java | 60 +- .../security/models/OfferingType.java | 32 +- .../models/OnPremiseResourceDetails.java | 97 +- .../models/OnPremiseSqlResourceDetails.java | 94 +- .../models/OnUploadProperties.java | 51 +- .../security/models/OnboardingState.java | 2 - .../security/models/Operation.java | 28 +- .../security/models/OperationDisplay.java | 78 +- .../security/models/OperationList.java | 74 - .../security/models/OperationListResult.java | 104 + .../security/models/OperationResult.java | 2 - .../security/models/OperationStatus.java | 49 +- .../models/OperationStatusAutoGenerated.java | 49 +- .../security/models/Operations.java | 4 +- .../security/models/Operator.java | 2 - .../models/OrganizationMembershipType.java | 2 - .../security/models/Origin.java | 57 + .../models/PartialAssessmentProperties.java | 93 + .../security/models/PathRecommendation.java | 269 -- .../security/models/PermissionProperty.java | 2 - .../security/models/PricingTier.java | 2 - .../security/models/ProcessNotAllowed.java | 72 +- .../security/models/PropertyType.java | 2 - .../security/models/ProtectionMode.java | 132 - .../security/models/Protocol.java | 2 - .../security/models/ProvisioningState.java | 2 - .../models/ProxyServerProperties.java | 49 +- .../security/models/PublisherInfo.java | 134 - .../security/models/QueryCheck.java | 57 +- .../models/QueuePurgesNotInAllowedRange.java | 80 +- .../resourcemanager/security/models/Rank.java | 5 - .../security/models/RecommendationAction.java | 58 - .../models/RecommendationConfigStatus.java | 2 - ...RecommendationConfigurationProperties.java | 58 +- .../security/models/RecommendationStatus.java | 63 - .../models/RecommendationSupportedClouds.java | 56 + .../security/models/RecommendationType.java | 2 - .../RegulatoryComplianceAssessmentList.java | 52 +- .../RegulatoryComplianceControlList.java | 52 +- .../RegulatoryComplianceStandardList.java | 52 +- .../security/models/Remediation.java | 58 +- .../security/models/RemediationEta.java | 54 +- .../security/models/ReportedSeverity.java | 2 - .../security/models/ResourceDetails.java | 87 +- .../models/ResourceDetailsAutoGenerated.java | 51 +- .../security/models/ResourceIdentifier.java | 85 +- .../models/ResourceIdentifierType.java | 2 - .../security/models/ResourceIdentityType.java | 5 - .../security/models/ResourceStatus.java | 2 - .../models/ResourcesCoverageStatus.java | 2 - .../resourcemanager/security/models/Rule.java | 162 - .../security/models/RuleCategory.java | 2 - .../security/models/RuleResultsInput.java | 52 +- .../models/RuleResultsProperties.java | 48 +- .../security/models/RuleSeverity.java | 2 - .../security/models/RuleState.java | 5 - .../security/models/RuleStatus.java | 2 - .../security/models/RuleType.java | 2 - .../security/models/RulesResultsInput.java | 54 +- .../security/models/ScanProperties.java | 109 +- .../security/models/ScanResultProperties.java | 72 +- .../security/models/ScanState.java | 2 - .../security/models/ScanSummary.java | 126 + .../security/models/ScanTriggerType.java | 2 - .../security/models/ScanningMode.java | 2 - .../security/models/ScopeElement.java | 71 +- .../SecureScoreControlDefinitionList.java | 50 +- .../SecureScoreControlDefinitionSource.java | 47 +- .../models/SecureScoreControlList.java | 49 +- .../security/models/SecureScoresList.java | 49 +- .../security/models/SecurityAssessment.java | 94 +- .../models/SecurityAssessmentList.java | 49 +- ...SecurityAssessmentMetadataPartnerData.java | 56 +- ...etadataPropertiesResponsePublishDates.java | 55 +- ...ecurityAssessmentMetadataResponseList.java | 51 +- .../models/SecurityAssessmentPartnerData.java | 51 +- .../SecurityAssessmentPropertiesBase.java | 93 +- .../models/SecurityConnectorsList.java | 51 +- .../security/models/SecurityContactList.java | 51 +- .../security/models/SecurityContactName.java | 2 - ...yContactPropertiesNotificationsByRole.java | 61 +- .../security/models/SecurityContactRole.java | 2 - .../security/models/SecurityFamily.java | 2 - .../security/models/SecurityIssue.java | 71 + .../security/models/SecuritySolutionList.java | 50 +- .../models/SecuritySolutionStatus.java | 2 - .../SecuritySolutionsReferenceData.java | 99 +- .../security/models/SecurityStandard.java | 351 ++ .../security/models/SecurityStandardList.java | 105 + .../security/models/SecurityStandards.java | 157 + .../models/SecuritySubAssessmentList.java | 49 +- .../security/models/SecurityTaskList.java | 48 +- .../models/SecurityTaskParameters.java | 70 +- .../SensitiveDataDiscoveryProperties.java | 114 + .../security/models/SensitivityLabel.java | 61 +- ...AssessmentPropertiesProvisioningState.java | 2 - ...sessmentsAzureSettingSelectedProvider.java | 2 - ...erVulnerabilityAssessmentsSettingKind.java | 2 - ...lnerabilityAssessmentsSettingKindName.java | 2 - ...rVulnerabilityAssessmentsSettingsList.java | 51 +- .../models/ServerVulnerabilityProperties.java | 85 +- .../models/ServicePrincipalProperties.java | 52 +- .../security/models/SettingKind.java | 2 - .../security/models/SettingName.java | 2 - .../models/SettingNameAutoGenerated.java | 2 - .../security/models/SettingsList.java | 49 +- .../security/models/Severity.java | 2 - .../security/models/SeverityEnum.java | 2 - .../security/models/SoftwaresList.java | 49 +- .../security/models/Source.java | 2 - .../security/models/SourceSystem.java | 68 - .../security/models/SourceType.java | 2 - .../SqlServerVulnerabilityProperties.java | 62 +- .../security/models/StandardAssignment.java | 297 ++ .../models/StandardAssignmentMetadata.java | 133 + ...rdAssignmentPropertiesAttestationData.java | 185 ++ ...dardAssignmentPropertiesExemptionData.java | 131 + .../security/models/StandardAssignments.java | 171 + .../models/StandardAssignmentsList.java | 105 + .../security/models/StandardMetadata.java | 133 + .../models/StandardSupportedCloud.java | 56 + .../security/models/StandardType.java | 56 + .../security/models/State.java | 2 - .../security/models/Status.java | 2 - .../security/models/StatusAutoGenerated.java | 61 +- .../security/models/StatusName.java | 2 - .../security/models/StatusReason.java | 2 - .../security/models/SubAssessmentStatus.java | 53 +- .../models/SubAssessmentStatusCode.java | 2 - .../security/models/SubPlan.java | 2 - .../security/models/SupportedCloudEnum.java | 2 - .../models/SuppressionAlertsScope.java | 47 +- .../security/models/Tactics.java | 2 - .../resourcemanager/security/models/Tags.java | 48 +- .../security/models/TagsResource.java | 48 +- .../models/TargetBranchConfiguration.java | 52 +- .../security/models/TaskUpdateActionType.java | 2 - .../security/models/Techniques.java | 2 - .../security/models/Threats.java | 2 - .../models/ThresholdCustomAlertRule.java | 128 +- .../models/TimeWindowCustomAlertRule.java | 156 +- .../security/models/TopologyList.java | 49 +- .../models/TopologySingleResource.java | 70 +- .../models/TopologySingleResourceChild.java | 44 +- .../models/TopologySingleResourceParent.java | 44 +- .../security/models/TrackedResource.java | 109 +- .../security/models/TransportProtocol.java | 53 - .../models/TwinUpdatesNotInAllowedRange.java | 80 +- .../resourcemanager/security/models/Type.java | 2 - ...authorizedOperationsNotInAllowedRange.java | 81 +- .../models/UnmaskedIpLoggingStatus.java | 2 - .../models/UpdateIotSecuritySolutionData.java | 49 +- .../UpdateSensitivitySettingsRequest.java | 65 +- .../UserDefinedResourcesProperties.java | 56 +- .../security/models/UserImpact.java | 2 - .../security/models/UserRecommendation.java | 80 - .../security/models/VaRule.java | 80 +- .../security/models/ValueType.java | 2 - .../security/models/VendorReference.java | 47 +- .../security/models/VmRecommendation.java | 132 - .../security/models/VmScannersAws.java | 52 +- .../security/models/VmScannersBase.java | 49 +- .../models/VmScannersBaseConfiguration.java | 52 +- .../security/models/VmScannersGcp.java | 47 +- .../security/models/WorkspaceSettingList.java | 51 +- .../src/main/java/module-info.java | 4 +- .../proxy-config.json | 2 +- .../reflect-config.json | 2837 +---------------- ...ptiveApplicationControlsDeleteSamples.java | 24 - ...AdaptiveApplicationControlsGetSamples.java | 24 - ...daptiveApplicationControlsListSamples.java | 23 - ...AdaptiveApplicationControlsPutSamples.java | 108 - ...aptiveNetworkHardeningsEnforceSamples.java | 46 - .../AdaptiveNetworkHardeningsGetSamples.java | 25 - ...rdeningsListByExtendedResourceSamples.java | 25 - ...AdvancedThreatProtectionCreateSamples.java | 4 +- .../AdvancedThreatProtectionGetSamples.java | 4 +- .../AlertsGetResourceGroupLevelSamples.java | 3 +- .../AlertsGetSubscriptionLevelSamples.java | 3 +- .../AlertsListByResourceGroupSamples.java | 3 +- ...ListResourceGroupLevelByRegionSamples.java | 3 +- .../security/generated/AlertsListSamples.java | 3 +- ...sListSubscriptionLevelByRegionSamples.java | 3 +- .../generated/AlertsSimulateSamples.java | 3 +- .../AlertsSuppressionRulesDeleteSamples.java | 4 +- .../AlertsSuppressionRulesGetSamples.java | 4 +- .../AlertsSuppressionRulesListSamples.java | 8 +- .../AlertsSuppressionRulesUpdateSamples.java | 4 +- ...ourceGroupLevelStateToActivateSamples.java | 3 +- ...sourceGroupLevelStateToDismissSamples.java | 3 +- ...rceGroupLevelStateToInProgressSamples.java | 3 +- ...sourceGroupLevelStateToResolveSamples.java | 3 +- ...bscriptionLevelStateToActivateSamples.java | 3 +- ...ubscriptionLevelStateToDismissSamples.java | 3 +- ...criptionLevelStateToInProgressSamples.java | 3 +- ...ubscriptionLevelStateToResolveSamples.java | 3 +- .../AllowedConnectionsGetSamples.java | 4 +- ...wedConnectionsListByHomeRegionSamples.java | 4 +- .../AllowedConnectionsListSamples.java | 4 +- ...GetByAzureApiManagementServiceSamples.java | 4 +- ...istByAzureApiManagementServiceSamples.java | 4 +- ...CollectionsListByResourceGroupSamples.java | 4 +- .../generated/ApiCollectionsListSamples.java | 4 +- ...sOffboardAzureApiManagementApiSamples.java | 4 +- ...nsOnboardAzureApiManagementApiSamples.java | 4 +- ...icationOperationCreateOrUpdateSamples.java | 4 +- .../ApplicationOperationDeleteSamples.java | 4 +- .../ApplicationOperationGetSamples.java | 4 +- .../generated/ApplicationsListSamples.java | 4 +- .../AssessmentsCreateOrUpdateSamples.java | 4 +- .../generated/AssessmentsDeleteSamples.java | 4 +- .../generated/AssessmentsGetSamples.java | 8 +- .../generated/AssessmentsListSamples.java | 4 +- ...tsMetadataCreateInSubscriptionSamples.java | 4 +- ...tsMetadataDeleteInSubscriptionSamples.java | 4 +- ...mentsMetadataGetInSubscriptionSamples.java | 4 +- .../AssessmentsMetadataGetSamples.java | 4 +- ...entsMetadataListBySubscriptionSamples.java | 4 +- .../AssessmentsMetadataListSamples.java | 4 +- ...AutoProvisioningSettingsCreateSamples.java | 4 +- .../AutoProvisioningSettingsGetSamples.java | 4 +- .../AutoProvisioningSettingsListSamples.java | 4 +- .../AutomationsCreateOrUpdateSamples.java | 12 +- .../generated/AutomationsDeleteSamples.java | 4 +- .../AutomationsGetByResourceGroupSamples.java | 4 +- ...AutomationsListByResourceGroupSamples.java | 4 +- .../generated/AutomationsListSamples.java | 4 +- .../generated/AutomationsUpdateSamples.java | 4 +- .../generated/AutomationsValidateSamples.java | 4 +- .../AzureDevOpsOrgsCreateOrUpdateSamples.java | 4 +- .../generated/AzureDevOpsOrgsGetSamples.java | 4 +- .../AzureDevOpsOrgsListAvailableSamples.java | 4 +- .../generated/AzureDevOpsOrgsListSamples.java | 4 +- .../AzureDevOpsOrgsUpdateSamples.java | 4 +- ...reDevOpsProjectsCreateOrUpdateSamples.java | 4 +- .../AzureDevOpsProjectsGetSamples.java | 4 +- .../AzureDevOpsProjectsListSamples.java | 4 +- .../AzureDevOpsProjectsUpdateSamples.java | 4 +- ...AzureDevOpsReposCreateOrUpdateSamples.java | 4 +- .../generated/AzureDevOpsReposGetSamples.java | 4 +- .../AzureDevOpsReposListSamples.java | 4 +- .../AzureDevOpsReposUpdateSamples.java | 4 +- .../ComplianceResultsGetSamples.java | 4 +- .../ComplianceResultsListSamples.java | 4 +- .../generated/CompliancesGetSamples.java | 4 +- .../generated/CompliancesListSamples.java | 4 +- .../ConnectorsCreateOrUpdateSamples.java | 12 +- .../generated/ConnectorsDeleteSamples.java | 4 +- .../generated/ConnectorsGetSamples.java | 4 +- .../generated/ConnectorsListSamples.java | 4 +- ...tomAssessmentAutomationsCreateSamples.java | 4 +- ...tomAssessmentAutomationsDeleteSamples.java | 4 +- ...tAutomationsGetByResourceGroupSamples.java | 4 +- ...AutomationsListByResourceGroupSamples.java | 4 +- ...ustomAssessmentAutomationsListSamples.java | 4 +- ...omEntityStoreAssignmentsCreateSamples.java | 4 +- ...omEntityStoreAssignmentsDeleteSamples.java | 4 +- ...eAssignmentsGetByResourceGroupSamples.java | 4 +- ...AssignmentsListByResourceGroupSamples.java | 4 +- ...stomEntityStoreAssignmentsListSamples.java | 4 +- ...mRecommendationsCreateOrUpdateSamples.java | 94 + .../CustomRecommendationsDeleteSamples.java | 62 + .../CustomRecommendationsGetSamples.java | 62 + .../CustomRecommendationsListSamples.java | 60 + ...derForStorageCancelMalwareScanSamples.java | 30 + .../DefenderForStorageCreateSamples.java | 22 +- ...fenderForStorageGetMalwareScanSamples.java | 30 + .../DefenderForStorageGetSamples.java | 4 +- ...nderForStorageStartMalwareScanSamples.java | 30 + ...psConfigurationsCreateOrUpdateSamples.java | 12 +- .../DevOpsConfigurationsDeleteSamples.java | 4 +- .../DevOpsConfigurationsGetSamples.java | 8 +- .../DevOpsConfigurationsListSamples.java | 4 +- .../DevOpsConfigurationsUpdateSamples.java | 4 +- .../DevOpsOperationResultsGetSamples.java | 8 +- .../generated/DevOpsPoliciesGetSamples.java | 25 + .../generated/DevOpsPoliciesListSamples.java | 24 + ...olicyAssignmentsCreateOrUpdateSamples.java | 40 + .../DevOpsPolicyAssignmentsDeleteSamples.java | 26 + .../DevOpsPolicyAssignmentsGetSamples.java | 26 + .../DevOpsPolicyAssignmentsListSamples.java | 25 + .../DevOpsPolicyAssignmentsUpdateSamples.java | 42 + ...ceSecurityGroupsCreateOrUpdateSamples.java | 4 +- .../DeviceSecurityGroupsDeleteSamples.java | 4 +- .../DeviceSecurityGroupsGetSamples.java | 4 +- .../DeviceSecurityGroupsListSamples.java | 4 +- ...DiscoveredSecuritySolutionsGetSamples.java | 4 +- ...uritySolutionsListByHomeRegionSamples.java | 4 +- ...iscoveredSecuritySolutionsListSamples.java | 4 +- .../ExternalSecuritySolutionsGetSamples.java | 4 +- ...uritySolutionsListByHomeRegionSamples.java | 4 +- .../ExternalSecuritySolutionsListSamples.java | 4 +- .../generated/GitHubOwnersGetSamples.java | 4 +- .../GitHubOwnersListAvailableSamples.java | 4 +- .../generated/GitHubOwnersListSamples.java | 4 +- .../generated/GitHubReposGetSamples.java | 4 +- .../generated/GitHubReposListSamples.java | 4 +- .../generated/GitLabGroupsGetSamples.java | 4 +- .../GitLabGroupsListAvailableSamples.java | 4 +- .../generated/GitLabGroupsListSamples.java | 4 +- .../generated/GitLabProjectsGetSamples.java | 4 +- .../generated/GitLabProjectsListSamples.java | 4 +- .../generated/GitLabSubgroupsListSamples.java | 4 +- ...nanceAssignmentsCreateOrUpdateSamples.java | 4 +- .../GovernanceAssignmentsDeleteSamples.java | 4 +- .../GovernanceAssignmentsGetSamples.java | 4 +- .../GovernanceAssignmentsListSamples.java | 4 +- .../GovernanceRulesCreateOrUpdateSamples.java | 12 +- .../GovernanceRulesDeleteSamples.java | 12 +- .../GovernanceRulesExecuteSamples.java | 12 +- .../generated/GovernanceRulesGetSamples.java | 12 +- .../generated/GovernanceRulesListSamples.java | 12 +- ...overnanceRulesOperationResultsSamples.java | 12 +- .../generated/HealthReportsGetSamples.java | 4 +- .../generated/HealthReportsListSamples.java | 4 +- ...otectionPoliciesCreateOrUpdateSamples.java | 4 +- ...formationProtectionPoliciesGetSamples.java | 8 +- ...ormationProtectionPoliciesListSamples.java | 4 +- ...otSecuritySolutionAnalyticsGetSamples.java | 3 +- ...tSecuritySolutionAnalyticsListSamples.java | 3 +- ...SecuritySolutionCreateOrUpdateSamples.java | 4 +- .../IotSecuritySolutionDeleteSamples.java | 4 +- ...ritySolutionGetByResourceGroupSamples.java | 4 +- ...itySolutionListByResourceGroupSamples.java | 8 +- .../IotSecuritySolutionListSamples.java | 8 +- .../IotSecuritySolutionUpdateSamples.java | 4 +- ...nalyticsAggregatedAlertDismissSamples.java | 3 +- ...onsAnalyticsAggregatedAlertGetSamples.java | 3 +- ...nsAnalyticsAggregatedAlertListSamples.java | 3 +- ...ionsAnalyticsRecommendationGetSamples.java | 3 +- ...onsAnalyticsRecommendationListSamples.java | 3 +- ...rkAccessPoliciesCreateOrUpdateSamples.java | 4 +- ...JitNetworkAccessPoliciesDeleteSamples.java | 4 +- .../JitNetworkAccessPoliciesGetSamples.java | 4 +- ...tNetworkAccessPoliciesInitiateSamples.java | 4 +- ...workAccessPoliciesListByRegionSamples.java | 4 +- ...esListByResourceGroupAndRegionSamples.java | 4 +- ...essPoliciesListByResourceGroupSamples.java | 4 +- .../JitNetworkAccessPoliciesListSamples.java | 4 +- .../generated/LocationsGetSamples.java | 4 +- .../generated/LocationsListSamples.java | 4 +- .../generated/MdeOnboardingsGetSamples.java | 4 +- .../generated/MdeOnboardingsListSamples.java | 4 +- .../generated/OperationsListSamples.java | 25 + .../generated/PricingsDeleteSamples.java | 4 +- .../generated/PricingsGetSamples.java | 24 +- .../generated/PricingsListSamples.java | 12 +- .../generated/PricingsUpdateSamples.java | 16 +- ...latoryComplianceAssessmentsGetSamples.java | 4 +- ...atoryComplianceAssessmentsListSamples.java | 4 +- ...egulatoryComplianceControlsGetSamples.java | 4 +- ...gulatoryComplianceControlsListSamples.java | 4 +- ...gulatoryComplianceStandardsGetSamples.java | 4 +- ...ulatoryComplianceStandardsListSamples.java | 4 +- ...lDefinitionsListBySubscriptionSamples.java | 3 +- ...ureScoreControlDefinitionsListSamples.java | 3 +- ...ScoreControlsListBySecureScoreSamples.java | 8 +- .../SecureScoreControlsListSamples.java | 4 +- .../generated/SecureScoresGetSamples.java | 4 +- .../generated/SecureScoresListSamples.java | 4 +- ...icationOperationCreateOrUpdateSamples.java | 4 +- ...ctorApplicationOperationDeleteSamples.java | 4 +- ...nnectorApplicationOperationGetSamples.java | 4 +- ...urityConnectorApplicationsListSamples.java | 4 +- ...curityConnectorsCreateOrUpdateSamples.java | 4 +- .../SecurityConnectorsDeleteSamples.java | 4 +- ...tyConnectorsGetByResourceGroupSamples.java | 4 +- ...yConnectorsListByResourceGroupSamples.java | 4 +- .../SecurityConnectorsListSamples.java | 4 +- .../SecurityConnectorsUpdateSamples.java | 4 +- .../SecurityContactsCreateSamples.java | 4 +- .../SecurityContactsDeleteSamples.java | 4 +- .../generated/SecurityContactsGetSamples.java | 4 +- .../SecurityContactsListSamples.java | 4 +- ...ecurityOperatorsCreateOrUpdateSamples.java | 4 +- .../SecurityOperatorsDeleteSamples.java | 4 +- .../SecurityOperatorsGetSamples.java | 4 +- .../SecurityOperatorsListSamples.java | 4 +- .../SecuritySolutionsGetSamples.java | 4 +- .../SecuritySolutionsListSamples.java | 4 +- ...sReferenceDataListByHomeRegionSamples.java | 3 +- ...ritySolutionsReferenceDataListSamples.java | 3 +- ...ecurityStandardsCreateOrUpdateSamples.java | 88 + .../SecurityStandardsDeleteSamples.java | 62 + .../SecurityStandardsGetSamples.java | 62 + .../SecurityStandardsListSamples.java | 60 + ...sitivitySettingsCreateOrUpdateSamples.java | 4 +- .../SensitivitySettingsGetSamples.java | 4 +- .../SensitivitySettingsListSamples.java | 4 +- ...bilityAssessmentCreateOrUpdateSamples.java | 3 +- ...rVulnerabilityAssessmentDeleteSamples.java | 3 +- ...rverVulnerabilityAssessmentGetSamples.java | 3 +- ...sessmentListByExtendedResourceSamples.java | 3 +- ...essmentsSettingsCreateOrUpdateSamples.java | 3 +- ...ilityAssessmentsSettingsDeleteSamples.java | 3 +- ...rabilityAssessmentsSettingsGetSamples.java | 3 +- ...abilityAssessmentsSettingsListSamples.java | 3 +- .../generated/SettingsGetSamples.java | 4 +- .../generated/SettingsListSamples.java | 4 +- .../generated/SettingsUpdateSamples.java | 4 +- .../SoftwareInventoriesGetSamples.java | 4 +- ...entoriesListByExtendedResourceSamples.java | 4 +- .../SoftwareInventoriesListSamples.java | 4 +- ...lityAssessmentBaselineRulesAddSamples.java | 8 +- ...entBaselineRulesCreateOrUpdateSamples.java | 8 +- ...yAssessmentBaselineRulesDeleteSamples.java | 4 +- ...lityAssessmentBaselineRulesGetSamples.java | 4 +- ...ityAssessmentBaselineRulesListSamples.java | 4 +- ...bilityAssessmentScanResultsGetSamples.java | 8 +- ...ilityAssessmentScanResultsListSamples.java | 8 +- ...ulnerabilityAssessmentScansGetSamples.java | 8 +- ...lnerabilityAssessmentScansListSamples.java | 4 +- .../StandardAssignmentsCreateSamples.java | 68 + .../StandardAssignmentsDeleteSamples.java | 27 + .../StandardAssignmentsGetSamples.java | 26 + .../StandardAssignmentsListSamples.java | 27 + .../generated/SubAssessmentsGetSamples.java | 4 +- .../SubAssessmentsListAllSamples.java | 4 +- .../generated/SubAssessmentsListSamples.java | 4 +- ...TasksGetResourceGroupLevelTaskSamples.java | 4 +- .../TasksGetSubscriptionLevelTaskSamples.java | 4 +- .../TasksListByHomeRegionSamples.java | 4 +- .../TasksListByResourceGroupSamples.java | 4 +- .../security/generated/TasksListSamples.java | 4 +- ...ateResourceGroupLevelTaskStateSamples.java | 4 +- ...dateSubscriptionLevelTaskStateSamples.java | 4 +- .../generated/TopologyGetSamples.java | 4 +- .../TopologyListByHomeRegionSamples.java | 4 +- .../generated/TopologyListSamples.java | 4 +- .../WorkspaceSettingsCreateSamples.java | 4 +- .../WorkspaceSettingsDeleteSamples.java | 4 +- .../WorkspaceSettingsGetSamples.java | 4 +- .../WorkspaceSettingsListSamples.java | 4 +- .../WorkspaceSettingsUpdateSamples.java | 4 +- .../AadExternalSecuritySolutionTests.java | 22 +- .../generated/AadSolutionPropertiesTests.java | 20 +- .../generated/ActionableRemediationTests.java | 28 +- ...tiveConnectionsNotInAllowedRangeTests.java | 26 +- ...ptiveApplicationControlGroupDataTests.java | 150 - ...tiveApplicationControlGroupInnerTests.java | 112 - ...iveApplicationControlGroupsInnerTests.java | 249 -- ...veApplicationControlIssueSummaryTests.java | 31 - ...ationControlsGetWithResponseMockTests.java | 67 - ...tionControlsListWithResponseMockTests.java | 44 - ...ationControlsPutWithResponseMockTests.java | 142 - ...veNetworkHardeningEnforceRequestTests.java | 60 - .../AdaptiveNetworkHardeningInnerTests.java | 72 - ...aptiveNetworkHardeningPropertiesTests.java | 64 - ...tiveNetworkHardeningsEnforceMockTests.java | 63 - ...orkHardeningsGetWithResponseMockTests.java | 51 - ...eningsListByExtendedResourceMockTests.java | 51 - .../AdaptiveNetworkHardeningsListTests.java | 70 - .../AdditionalWorkspacesPropertiesTests.java | 15 +- ...vancedThreatProtectionPropertiesTests.java | 8 +- ...ncedThreatProtectionSettingInnerTests.java | 5 +- ...rotectionsCreateWithResponseMockTests.java | 9 +- ...atProtectionsGetWithResponseMockTests.java | 4 +- .../security/generated/AlertEntityTests.java | 5 +- ...lertPropertiesSupportingEvidenceTests.java | 8 +- ...imulatorBundlesRequestPropertiesTests.java | 10 +- .../AlertSimulatorRequestBodyTests.java | 5 +- .../AlertSimulatorRequestPropertiesTests.java | 4 +- .../AlertSyncSettingPropertiesTests.java | 8 +- .../generated/AlertSyncSettingsTests.java | 8 +- .../AlertsSuppressionRuleInnerTests.java | 43 +- .../AlertsSuppressionRulePropertiesTests.java | 38 +- ...ssionRulesDeleteWithResponseMockTests.java | 2 +- ...pressionRulesGetWithResponseMockTests.java | 14 +- .../AlertsSuppressionRulesListMockTests.java | 17 +- .../AlertsSuppressionRulesListTests.java | 60 +- ...ssionRulesUpdateWithResponseMockTests.java | 32 +- ...lStateToActivateWithResponseMockTests.java | 2 +- ...elStateToDismissWithResponseMockTests.java | 2 +- ...tateToInProgressWithResponseMockTests.java | 2 +- ...elStateToResolveWithResponseMockTests.java | 2 +- ...lStateToActivateWithResponseMockTests.java | 2 +- ...elStateToDismissWithResponseMockTests.java | 2 +- ...tateToInProgressWithResponseMockTests.java | 3 +- ...elStateToResolveWithResponseMockTests.java | 2 +- ...edConnectionsGetWithResponseMockTests.java | 4 +- ...dConnectionsListByHomeRegionMockTests.java | 4 +- .../AllowedConnectionsListMockTests.java | 2 +- .../AllowedConnectionsListTests.java | 2 +- .../AllowedConnectionsResourceInnerTests.java | 2 +- ...wedConnectionsResourcePropertiesTests.java | 2 +- .../AllowlistCustomAlertRuleTests.java | 8 +- ...AmqpC2DMessagesNotInAllowedRangeTests.java | 20 +- ...ejectedMessagesNotInAllowedRangeTests.java | 20 +- ...AmqpD2CMessagesNotInAllowedRangeTests.java | 20 +- .../generated/ApiCollectionInnerTests.java | 2 +- .../generated/ApiCollectionListTests.java | 2 +- .../ApiCollectionPropertiesTests.java | 2 +- ...anagementServiceWithResponseMockTests.java | 4 +- ...tByAzureApiManagementServiceMockTests.java | 4 +- ...llectionsListByResourceGroupMockTests.java | 4 +- .../ApiCollectionsListMockTests.java | 2 +- ...ApiManagementApiWithResponseMockTests.java | 3 +- ...OnboardAzureApiManagementApiMockTests.java | 5 +- .../generated/ApplicationInnerTests.java | 16 +- ...nsCreateOrUpdateWithResponseMockTests.java | 14 +- ...OperationsDeleteWithResponseMockTests.java | 2 +- ...ionOperationsGetWithResponseMockTests.java | 8 +- .../generated/ApplicationPropertiesTests.java | 16 +- .../generated/ApplicationsListMockTests.java | 6 +- .../generated/ApplicationsListTests.java | 2 +- .../ArcAutoProvisioningAwsTests.java | 25 +- ...ArcAutoProvisioningConfigurationTests.java | 12 +- .../ArcAutoProvisioningGcpTests.java | 21 +- .../generated/ArcAutoProvisioningTests.java | 13 +- .../generated/AssessmentLinksTests.java | 2 +- ...eByResourceGroupWithResponseMockTests.java | 2 +- ...teInSubscriptionWithResponseMockTests.java | 3 +- .../generated/AssignedStandardItemTests.java | 25 + .../AtaExternalSecuritySolutionTests.java | 28 +- .../generated/AtaSolutionPropertiesTests.java | 26 +- .../generated/AttestationEvidenceTests.java | 28 + .../AuthenticationDetailsPropertiesTests.java | 2 +- .../generated/AuthenticationTests.java | 22 + .../AutoProvisioningSettingInnerTests.java | 8 +- .../AutoProvisioningSettingListTests.java | 11 +- ...ngSettingsCreateWithResponseMockTests.java | 4 +- ...oningSettingsGetWithResponseMockTests.java | 9 +- ...AutoProvisioningSettingsListMockTests.java | 2 +- .../AutomationActionEventHubTests.java | 14 +- .../AutomationActionLogicAppTests.java | 13 +- .../AutomationActionWorkspaceTests.java | 8 +- .../generated/AutomationInnerTests.java | 72 +- .../generated/AutomationListTests.java | 163 +- .../generated/AutomationPropertiesTests.java | 75 +- .../generated/AutomationRuleSetTests.java | 36 +- .../generated/AutomationScopeTests.java | 15 +- .../generated/AutomationSourceTests.java | 77 +- .../AutomationTriggeringRuleTests.java | 20 +- .../generated/AutomationUpdateModelTests.java | 44 +- .../AutomationValidationStatusInnerTests.java | 12 +- ...eAuthenticationDetailsPropertiesTests.java | 14 +- .../generated/AwsEnvironmentDataTests.java | 14 +- .../AwsOrganizationalDataMasterTests.java | 14 +- .../AwsOrganizationalDataMemberTests.java | 12 +- .../generated/AzureDevOpsOrgInnerTests.java | 42 +- .../AzureDevOpsOrgListResponseInnerTests.java | 75 +- .../AzureDevOpsOrgPropertiesTests.java | 37 +- ...zureDevOpsOrgsCreateOrUpdateMockTests.java | 47 +- ...ureDevOpsOrgsGetWithResponseMockTests.java | 16 +- ...rgsListAvailableWithResponseMockTests.java | 11 +- .../AzureDevOpsOrgsListMockTests.java | 17 +- .../AzureDevOpsProjectInnerTests.java | 57 +- .../AzureDevOpsProjectListResponseTests.java | 98 +- .../AzureDevOpsProjectPropertiesTests.java | 58 +- ...DevOpsProjectsCreateOrUpdateMockTests.java | 38 +- ...evOpsProjectsGetWithResponseMockTests.java | 17 +- .../AzureDevOpsProjectsListMockTests.java | 21 +- ...ureDevOpsReposCreateOrUpdateMockTests.java | 47 +- ...reDevOpsReposGetWithResponseMockTests.java | 21 +- .../AzureDevOpsReposListMockTests.java | 20 +- .../AzureDevOpsRepositoryInnerTests.java | 62 +- ...zureDevOpsRepositoryListResponseTests.java | 83 +- .../AzureDevOpsRepositoryPropertiesTests.java | 71 +- .../generated/AzureResourceDetailsTests.java | 2 +- .../AzureResourceIdentifierTests.java | 2 +- .../generated/AzureResourceLinkTests.java | 2 +- .../generated/AzureServersSettingTests.java | 2 +- .../AzureTrackedResourceLocationTests.java | 8 +- .../BaselineAdjustedResultTests.java | 31 +- .../security/generated/BaselineTests.java | 17 +- .../generated/BenchmarkReferenceTests.java | 12 +- .../generated/BlobsScanSummaryTests.java | 35 + .../generated/BuiltInInfoTypeTests.java | 21 +- .../generated/CategoryConfigurationTests.java | 12 +- .../CefExternalSecuritySolutionTests.java | 40 +- .../generated/CefSolutionPropertiesTests.java | 38 +- .../generated/CloudOfferingTests.java | 5 +- .../generated/ComplianceInnerTests.java | 2 +- .../generated/ComplianceListTests.java | 5 +- .../generated/CompliancePropertiesTests.java | 2 +- .../generated/ComplianceResultInnerTests.java | 2 +- .../generated/ComplianceResultListTests.java | 2 +- .../ComplianceResultPropertiesTests.java | 4 +- ...lianceResultsGetWithResponseMockTests.java | 7 +- .../ComplianceResultsListMockTests.java | 4 +- .../generated/ComplianceSegmentTests.java | 5 +- .../CompliancesGetWithResponseMockTests.java | 7 +- .../generated/CompliancesListMockTests.java | 5 +- .../generated/ConnectableResourceTests.java | 2 +- .../generated/ConnectedResourceTests.java | 6 +- .../generated/ConnectedWorkspaceTests.java | 9 +- .../ConnectionFromIpNotAllowedTests.java | 14 +- .../ConnectionToIpNotAllowedTests.java | 14 +- ...ConnectorsDeleteWithResponseMockTests.java | 2 +- ...rRegistryVulnerabilityPropertiesTests.java | 2 +- ...AwsOfferingNativeCloudConnectionTests.java | 8 +- .../CspmMonitorAwsOfferingTests.java | 8 +- .../CspmMonitorAzureDevOpsOfferingTests.java | 2 +- .../CspmMonitorDockerHubOfferingTests.java | 23 + ...GcpOfferingNativeCloudConnectionTests.java | 18 +- .../CspmMonitorGcpOfferingTests.java | 14 +- .../CspmMonitorGitLabOfferingTests.java | 2 +- .../CspmMonitorGithubOfferingTests.java | 2 +- .../CspmMonitorJFrogOfferingTests.java | 23 + .../generated/CustomAlertRuleTests.java | 2 +- ...smentAutomationRequestPropertiesTests.java | 38 +- ...ustomAssessmentAutomationRequestTests.java | 38 +- ...eByResourceGroupWithResponseMockTests.java | 2 +- ...CustomEntityStoreAssignmentInnerTests.java | 14 +- ...mEntityStoreAssignmentPropertiesTests.java | 15 +- ...StoreAssignmentRequestPropertiesTests.java | 8 +- ...stomEntityStoreAssignmentRequestTests.java | 8 +- ...ssignmentsCreateWithResponseMockTests.java | 12 +- ...eByResourceGroupWithResponseMockTests.java | 2 +- ...tByResourceGroupWithResponseMockTests.java | 8 +- ...signmentsListByResourceGroupMockTests.java | 10 +- ...omEntityStoreAssignmentsListMockTests.java | 6 +- ...EntityStoreAssignmentsListResultTests.java | 8 +- ...ByResourceGroupWithResponseMockTests.java} | 6 +- .../security/generated/CveTests.java | 2 +- .../security/generated/CvssTests.java | 2 +- .../generated/DataExportSettingsTests.java | 8 +- ...nderCspmAwsOfferingCiemDiscoveryTests.java | 8 +- .../DefenderCspmAwsOfferingCiemOidcTests.java | 17 +- .../DefenderCspmAwsOfferingCiemTests.java | 20 +- ...OfferingDataSensitivityDiscoveryTests.java | 8 +- ...nderCspmAwsOfferingDatabasesDspmTests.java | 12 +- ...cContainersAgentlessDiscoveryK8STests.java | 14 +- ...ringMdcContainersImageAssessmentTests.java | 14 +- .../DefenderCspmAwsOfferingTests.java | 80 +- ...efenderCspmAwsOfferingVmScannersTests.java | 20 +- .../DefenderCspmDockerHubOfferingTests.java | 23 + ...nderCspmGcpOfferingCiemDiscoveryTests.java | 20 +- ...OfferingDataSensitivityDiscoveryTests.java | 20 +- ...cContainersAgentlessDiscoveryK8STests.java | 20 +- ...ringMdcContainersImageAssessmentTests.java | 23 +- .../DefenderCspmGcpOfferingTests.java | 82 +- ...efenderCspmGcpOfferingVmScannersTests.java | 8 +- ...ringMdcContainersImageAssessmentTests.java | 26 + .../DefenderCspmJFrogOfferingTests.java | 28 + ...esAwsOfferingArcAutoProvisioningTests.java | 18 +- ...atabasesAwsOfferingDatabasesDspmTests.java | 12 +- ...efenderFoDatabasesAwsOfferingRdsTests.java | 12 +- .../DefenderFoDatabasesAwsOfferingTests.java | 48 +- ...rsAwsOfferingCloudWatchToKinesisTests.java | 11 +- ...ContainersAwsOfferingKinesisToS3Tests.java | 11 +- ...OfferingKubernetesDataCollectionTests.java | 8 +- ...nersAwsOfferingKubernetesServiceTests.java | 8 +- ...cContainersAgentlessDiscoveryK8STests.java | 8 +- ...ringMdcContainersImageAssessmentTests.java | 14 +- ...DefenderForContainersAwsOfferingTests.java | 76 +- ...rContainersAwsOfferingVmScannersTests.java | 14 +- ...erForContainersDockerHubOfferingTests.java | 23 + ...ataPipelineNativeCloudConnectionTests.java | 15 +- ...cContainersAgentlessDiscoveryK8STests.java | 14 +- ...ringMdcContainersImageAssessmentTests.java | 20 +- ...GcpOfferingNativeCloudConnectionTests.java | 16 +- ...DefenderForContainersGcpOfferingTests.java | 81 +- ...rContainersGcpOfferingVmScannersTests.java | 14 +- ...fenderForContainersJFrogOfferingTests.java | 23 + ...esGcpOfferingArcAutoProvisioningTests.java | 20 +- ...rForDatabasesArcAutoProvisioningTests.java | 14 +- .../DefenderForDatabasesGcpOfferingTests.java | 34 +- ...rsAwsOfferingArcAutoProvisioningTests.java | 18 +- ...ersAwsOfferingDefenderForServersTests.java | 11 +- ...rsAwsOfferingMdeAutoProvisioningTests.java | 10 +- ...nderForServersAwsOfferingSubPlanTests.java | 8 +- .../DefenderForServersAwsOfferingTests.java | 53 +- ...gVaAutoProvisioningConfigurationTests.java | 11 +- ...ersAwsOfferingVaAutoProvisioningTests.java | 13 +- ...rForServersAwsOfferingVmScannersTests.java | 15 +- ...rsGcpOfferingArcAutoProvisioningTests.java | 18 +- ...ersGcpOfferingDefenderForServersTests.java | 15 +- ...rsGcpOfferingMdeAutoProvisioningTests.java | 5 +- .../DefenderForServersGcpOfferingTests.java | 59 +- ...ersGcpOfferingVaAutoProvisioningTests.java | 17 +- ...rForServersGcpOfferingVmScannersTests.java | 8 +- ...ancelMalwareScanWithResponseMockTests.java | 49 + ...esGetMalwareScanWithResponseMockTests.java | 51 + ...StartMalwareScanWithResponseMockTests.java | 50 + .../DenylistCustomAlertRuleTests.java | 10 +- .../generated/DevOpsCapabilityTests.java | 2 +- .../DevOpsConfigurationsDeleteMockTests.java | 2 +- ...rationResultsGetWithResponseMockTests.java | 59 - ...evOpsPoliciesGetWithResponseMockTests.java | 44 + .../DevOpsPoliciesListMockTests.java | 44 + .../DevOpsPolicyAssignmentInnerTests.java | 50 + ...vOpsPolicyAssignmentListResponseTests.java | 66 + ...DevOpsPolicyAssignmentPropertiesTests.java | 48 + ...icyAssignmentsCreateOrUpdateMockTests.java | 57 + ...cyAssignmentsGetWithResponseMockTests.java | 47 + .../DevOpsPolicyAssignmentsListMockTests.java | 50 + .../DevOpsPolicyDescriptorTests.java | 36 + .../generated/DevOpsPolicyInnerTests.java | 39 + .../DevOpsPolicyListResponseTests.java | 53 + .../DevOpsPolicyPropertiesTests.java | 37 + .../DeviceSecurityGroupInnerTests.java | 80 +- .../DeviceSecurityGroupListTests.java | 198 +- .../DeviceSecurityGroupPropertiesTests.java | 92 +- ...psCreateOrUpdateWithResponseMockTests.java | 72 +- ...eByResourceGroupWithResponseMockTests.java | 3 +- ...ecurityGroupsGetWithResponseMockTests.java | 20 +- .../DeviceSecurityGroupsListMockTests.java | 20 +- ...ctMethodInvokesNotInAllowedRangeTests.java | 26 +- .../DiscoveredSecuritySolutionInnerTests.java | 26 +- .../DiscoveredSecuritySolutionListTests.java | 36 +- ...overedSecuritySolutionPropertiesTests.java | 29 +- ...ritySolutionsGetWithResponseMockTests.java | 10 +- ...itySolutionsListByHomeRegionMockTests.java | 12 +- ...coveredSecuritySolutionsListMockTests.java | 10 +- .../DockerHubEnvironmentDataTests.java | 28 + .../EffectiveNetworkSecurityGroupsTests.java | 30 - .../generated/EnvironmentDetailsTests.java | 32 +- .../security/generated/EtagTests.java | 8 +- .../ExternalSecuritySolutionInnerTests.java | 2 +- .../ExternalSecuritySolutionListTests.java | 2 +- ...ternalSecuritySolutionPropertiesTests.java | 23 +- ...ritySolutionsGetWithResponseMockTests.java | 4 +- ...itySolutionsListByHomeRegionMockTests.java | 4 +- ...xternalSecuritySolutionsListMockTests.java | 2 +- ...iledLocalLoginsNotInAllowedRangeTests.java | 26 +- .../FileUploadsNotInAllowedRangeTests.java | 20 +- .../GcpOrganizationalDataMemberTests.java | 14 +- ...cpOrganizationalDataOrganizationTests.java | 22 +- .../generated/GcpProjectDetailsTests.java | 13 +- .../GcpProjectEnvironmentDataTests.java | 18 +- ...itivitySettingsListResponseInnerTests.java | 97 +- ...SensitivitySettingsResponseInnerTests.java | 94 +- ...ResponsePropertiesMipInformationTests.java | 98 +- ...tivitySettingsResponsePropertiesTests.java | 106 +- .../generated/GitHubOwnerInnerTests.java | 8 +- .../GitHubOwnerListResponseInnerTests.java | 37 +- .../generated/GitHubOwnerPropertiesTests.java | 12 +- .../GitHubOwnersGetWithResponseMockTests.java | 11 +- ...ersListAvailableWithResponseMockTests.java | 9 +- .../generated/GitHubOwnersListMockTests.java | 7 +- .../GitHubReposGetWithResponseMockTests.java | 8 +- .../generated/GitHubReposListMockTests.java | 13 +- .../generated/GitHubRepositoryInnerTests.java | 18 +- .../GitHubRepositoryListResponseTests.java | 33 +- .../GitHubRepositoryPropertiesTests.java | 18 +- .../generated/GitLabGroupInnerTests.java | 14 +- .../GitLabGroupListResponseInnerTests.java | 26 +- .../generated/GitLabGroupPropertiesTests.java | 13 +- .../GitLabGroupsGetWithResponseMockTests.java | 8 +- ...upsListAvailableWithResponseMockTests.java | 9 +- .../generated/GitLabGroupsListMockTests.java | 9 +- .../generated/GitLabProjectInnerTests.java | 12 +- .../GitLabProjectListResponseTests.java | 27 +- .../GitLabProjectPropertiesTests.java | 12 +- ...itLabProjectsGetWithResponseMockTests.java | 6 +- .../GitLabProjectsListMockTests.java | 10 +- ...LabSubgroupsListWithResponseMockTests.java | 11 +- ...vernanceAssignmentAdditionalDataTests.java | 20 +- .../GovernanceAssignmentInnerTests.java | 63 +- .../GovernanceAssignmentPropertiesTests.java | 59 +- ...tsCreateOrUpdateWithResponseMockTests.java | 39 +- ...ssignmentsDeleteWithResponseMockTests.java | 2 +- ...ceAssignmentsGetWithResponseMockTests.java | 22 +- .../GovernanceAssignmentsListMockTests.java | 22 +- .../GovernanceAssignmentsListTests.java | 2 +- .../GovernanceRuleEmailNotificationTests.java | 8 +- .../generated/GovernanceRuleInnerTests.java | 64 +- .../generated/GovernanceRuleListTests.java | 2 +- .../GovernanceRuleMetadataTests.java | 2 +- .../GovernanceRuleOwnerSourceTests.java | 14 +- .../GovernanceRulePropertiesTests.java | 62 +- ...esCreateOrUpdateWithResponseMockTests.java | 48 +- .../GovernanceRulesDeleteMockTests.java | 2 +- ...vernanceRulesGetWithResponseMockTests.java | 21 +- .../GovernanceRulesListMockTests.java | 18 +- ...OperationResultsWithResponseMockTests.java | 2 +- .../HealthDataClassificationTests.java | 16 +- ...HttpC2DMessagesNotInAllowedRangeTests.java | 20 +- ...ejectedMessagesNotInAllowedRangeTests.java | 20 +- ...HttpD2CMessagesNotInAllowedRangeTests.java | 26 +- .../security/generated/IdentityTests.java | 7 +- .../security/generated/InfoTypeTests.java | 23 +- .../InformationProtectionKeywordTests.java | 20 +- .../IoTSecurityAggregatedAlertInnerTests.java | 10 +- .../IoTSecurityAggregatedAlertListTests.java | 13 +- ...ecurityAggregatedAlertPropertiesTests.java | 2 +- ...lertPropertiesTopDevicesListItemTests.java | 2 +- ...ityAggregatedRecommendationInnerTests.java | 14 +- ...rityAggregatedRecommendationListTests.java | 15 +- ...gregatedRecommendationPropertiesTests.java | 8 +- .../IoTSecurityAlertedDeviceTests.java | 2 +- .../IoTSecurityDeviceAlertTests.java | 5 +- .../IoTSecurityDeviceRecommendationTests.java | 2 +- ...uritySolutionAnalyticsModelInnerTests.java | 9 +- ...ySolutionAnalyticsModelListInnerTests.java | 26 +- ...odelPropertiesDevicesMetricsItemTests.java | 26 +- ...SolutionAnalyticsModelPropertiesTests.java | 7 +- .../IoTSecuritySolutionModelInnerTests.java | 100 +- .../IoTSecuritySolutionPropertiesTests.java | 70 +- .../IoTSecuritySolutionsListTests.java | 156 +- .../generated/IoTSeverityMetricsTests.java | 20 +- ...tionAnalyticsGetWithResponseMockTests.java | 4 +- ...ionAnalyticsListWithResponseMockTests.java | 4 +- ...tedAlertsDismissWithResponseMockTests.java | 2 +- ...regatedAlertsGetWithResponseMockTests.java | 6 +- ...nalyticsAggregatedAlertsListMockTests.java | 6 +- ...commendationsGetWithResponseMockTests.java | 8 +- ...AnalyticsRecommendationsListMockTests.java | 8 +- ...nsCreateOrUpdateWithResponseMockTests.java | 96 +- ...eByResourceGroupWithResponseMockTests.java | 2 +- ...tByResourceGroupWithResponseMockTests.java | 28 +- ...SolutionsListByResourceGroupMockTests.java | 30 +- .../IotSecuritySolutionsListMockTests.java | 28 +- .../generated/JFrogEnvironmentDataTests.java | 26 + ...esCreateOrUpdateWithResponseMockTests.java | 80 +- ...ssPoliciesDeleteWithResponseMockTests.java | 2 +- ...ccessPoliciesGetWithResponseMockTests.java | 23 +- ...PoliciesInitiateWithResponseMockTests.java | 89 +- ...rkAccessPoliciesListByRegionMockTests.java | 25 +- ...ListByResourceGroupAndRegionMockTests.java | 23 +- ...sPoliciesListByResourceGroupMockTests.java | 25 +- ...JitNetworkAccessPoliciesListMockTests.java | 21 +- .../JitNetworkAccessPoliciesListTests.java | 202 +- ...tNetworkAccessPolicyInitiatePortTests.java | 20 +- ...tworkAccessPolicyInitiateRequestTests.java | 55 +- ...cessPolicyInitiateVirtualMachineTests.java | 35 +- .../JitNetworkAccessPolicyInnerTests.java | 361 +-- ...JitNetworkAccessPolicyPropertiesTests.java | 201 +- ...etworkAccessPolicyVirtualMachineTests.java | 64 +- .../JitNetworkAccessPortRuleTests.java | 32 +- .../JitNetworkAccessRequestInnerTests.java | 174 +- .../JitNetworkAccessRequestPortTests.java | 38 +- ...tworkAccessRequestVirtualMachineTests.java | 65 +- .../generated/KindAutoGeneratedTests.java | 9 +- .../security/generated/LabelTests.java | 20 +- .../generated/ListCustomAlertRuleTests.java | 8 +- .../generated/LocalUserNotAllowedTests.java | 14 +- .../security/generated/LocationTests.java | 2 +- .../LocationsGetWithResponseMockTests.java | 5 +- .../generated/LocationsListMockTests.java | 2 +- .../LogAnalyticsIdentifierTests.java | 2 +- .../generated/MalwareScanInnerTests.java | 60 + .../generated/MalwareScanPropertiesTests.java | 55 + .../MdeOnboardingDataInnerTests.java | 2 +- .../MdeOnboardingDataListInnerTests.java | 6 +- ...deOnboardingsGetWithResponseMockTests.java | 3 +- ...eOnboardingsListWithResponseMockTests.java | 2 +- ...MqttC2DMessagesNotInAllowedRangeTests.java | 20 +- ...ejectedMessagesNotInAllowedRangeTests.java | 20 +- ...MqttD2CMessagesNotInAllowedRangeTests.java | 26 +- .../NotificationsSourceAttackPathTests.java | 8 +- .../OnPremiseResourceDetailsTests.java | 26 +- .../OnPremiseSqlResourceDetailsTests.java | 38 +- .../generated/OnUploadPropertiesTests.java | 10 +- .../generated/OperationDisplayTests.java | 2 +- .../generated/OperationInnerTests.java | 2 +- .../generated/OperationListResultTests.java | 23 + .../generated/OperationListTests.java | 28 - ...perationResultAutoGeneratedInnerTests.java | 2 +- .../OperationStatusResultInnerTests.java | 113 - .../generated/OperationsListMockTests.java | 36 + .../generated/PathRecommendationTests.java | 74 - .../generated/PricingListInnerTests.java | 72 +- ...eByResourceGroupWithResponseMockTests.java | 2 +- .../PricingsListWithResponseMockTests.java | 10 +- .../generated/ProcessNotAllowedTests.java | 10 +- .../generated/ProtectionModeTests.java | 36 - .../generated/ProxyServerPropertiesTests.java | 12 +- .../generated/PublisherInfoTests.java | 35 - .../security/generated/QueryCheckTests.java | 23 +- .../QueuePurgesNotInAllowedRangeTests.java | 26 +- ...mendationConfigurationPropertiesTests.java | 17 +- ...ulatoryComplianceAssessmentInnerTests.java | 9 +- ...gulatoryComplianceAssessmentListTests.java | 11 +- ...ryComplianceAssessmentPropertiesTests.java | 8 +- ...ceAssessmentsGetWithResponseMockTests.java | 6 +- ...oryComplianceAssessmentsListMockTests.java | 6 +- ...RegulatoryComplianceControlInnerTests.java | 8 +- .../RegulatoryComplianceControlListTests.java | 11 +- ...atoryComplianceControlPropertiesTests.java | 2 +- ...ianceControlsGetWithResponseMockTests.java | 6 +- ...latoryComplianceControlsListMockTests.java | 8 +- ...egulatoryComplianceStandardInnerTests.java | 8 +- ...RegulatoryComplianceStandardListTests.java | 11 +- ...toryComplianceStandardPropertiesTests.java | 8 +- ...anceStandardsGetWithResponseMockTests.java | 9 +- ...atoryComplianceStandardsListMockTests.java | 6 +- .../generated/RemediationEtaTests.java | 17 +- .../security/generated/RemediationTests.java | 20 +- .../ResourceDetailsAutoGeneratedTests.java | 8 +- .../generated/RuleResultsInnerTests.java | 12 +- .../generated/RuleResultsInputTests.java | 11 +- .../generated/RuleResultsPropertiesTests.java | 15 +- .../security/generated/RuleTests.java | 41 - .../generated/RulesResultsInnerTests.java | 17 +- .../generated/RulesResultsInputTests.java | 24 +- .../security/generated/ScanInnerTests.java | 86 +- .../generated/ScanPropertiesTests.java | 80 +- .../generated/ScanResultInnerTests.java | 154 +- .../generated/ScanResultPropertiesTests.java | 145 +- .../generated/ScanResultsInnerTests.java | 181 +- .../security/generated/ScanSummaryTests.java | 39 + .../security/generated/ScansInnerTests.java | 102 +- .../security/generated/ScopeElementTests.java | 8 +- .../security/generated/ScoreDetailsTests.java | 2 +- ...eScoreControlDefinitionItemInnerTests.java | 2 +- ...eControlDefinitionItemPropertiesTests.java | 2 +- ...SecureScoreControlDefinitionListTests.java | 2 +- ...cureScoreControlDefinitionSourceTests.java | 8 +- ...efinitionsListBySubscriptionMockTests.java | 2 +- ...eScoreControlDefinitionsListMockTests.java | 2 +- .../SecureScoreControlDetailsInnerTests.java | 2 +- .../SecureScoreControlListTests.java | 2 +- ...ureScoreControlScoreDetailsInnerTests.java | 2 +- ...oreControlsListBySecureScoreMockTests.java | 4 +- .../SecureScoreControlsListMockTests.java | 2 +- .../generated/SecureScoreItemInnerTests.java | 2 +- .../SecureScoreItemPropertiesTests.java | 2 +- .../SecureScoresGetWithResponseMockTests.java | 4 +- .../generated/SecureScoresListMockTests.java | 2 +- .../generated/SecureScoresListTests.java | 2 +- ...taPropertiesResponsePublishDatesTests.java | 14 +- ...nsCreateOrUpdateWithResponseMockTests.java | 15 +- ...OperationsDeleteWithResponseMockTests.java | 2 +- ...ionOperationsGetWithResponseMockTests.java | 8 +- ...ityConnectorApplicationsListMockTests.java | 8 +- .../SecurityConnectorInnerTests.java | 29 +- .../SecurityConnectorPropertiesTests.java | 16 +- ...rsCreateOrUpdateWithResponseMockTests.java | 6 +- ...tByResourceGroupWithResponseMockTests.java | 4 +- ...onnectorsListByResourceGroupMockTests.java | 4 +- .../SecurityConnectorsListMockTests.java | 4 +- .../SecurityConnectorsListTests.java | 68 +- .../generated/SecurityContactInnerTests.java | 29 +- .../generated/SecurityContactListTests.java | 56 +- ...actPropertiesNotificationsByRoleTests.java | 16 +- .../SecurityContactPropertiesTests.java | 30 +- .../generated/SecurityOperatorInnerTests.java | 2 +- .../SecurityOperatorListInnerTests.java | 2 +- ...rsCreateOrUpdateWithResponseMockTests.java | 4 +- ...eByResourceGroupWithResponseMockTests.java | 2 +- ...rityOperatorsGetWithResponseMockTests.java | 4 +- ...ityOperatorsListWithResponseMockTests.java | 4 +- .../generated/SecuritySolutionInnerTests.java | 20 +- .../generated/SecuritySolutionListTests.java | 30 +- .../SecuritySolutionPropertiesTests.java | 20 +- ...ritySolutionsGetWithResponseMockTests.java | 12 +- .../SecuritySolutionsListMockTests.java | 8 +- ...ySolutionsReferenceDataListInnerTests.java | 64 +- ...SolutionsReferenceDataPropertiesTests.java | 44 +- .../SecuritySolutionsReferenceDataTests.java | 44 +- ...ListByHomeRegionWithResponseMockTests.java | 18 +- ...ferenceDatasListWithResponseMockTests.java | 14 +- ...eByResourceGroupWithResponseMockTests.java | 34 + .../generated/SecurityTaskInnerTests.java | 4 +- .../generated/SecurityTaskListTests.java | 2 +- .../SecurityTaskParametersTests.java | 5 +- .../SecurityTaskPropertiesTests.java | 6 +- .../generated/SensitivityLabelTests.java | 26 +- ...gsCreateOrUpdateWithResponseMockTests.java | 40 +- ...ivitySettingsGetWithResponseMockTests.java | 12 +- ...vitySettingsListWithResponseMockTests.java | 6 +- ...rverVulnerabilityAssessmentInnerTests.java | 2 +- ...ulnerabilityAssessmentPropertiesTests.java | 5 +- ...tsCreateOrUpdateWithResponseMockTests.java | 5 +- ...lnerabilityAssessmentsDeleteMockTests.java | 3 +- ...tyAssessmentsGetWithResponseMockTests.java | 4 +- ...ExtendedResourceWithResponseMockTests.java | 4 +- ...ulnerabilityAssessmentsListInnerTests.java | 2 +- ...erabilityAssessmentsSettingInnerTests.java | 2 +- ...gsCreateOrUpdateWithResponseMockTests.java | 2 +- ...mentsSettingsGetWithResponseMockTests.java | 2 +- ...ilityAssessmentsSettingsListMockTests.java | 2 +- ...erabilityAssessmentsSettingsListTests.java | 2 +- .../ServerVulnerabilityPropertiesTests.java | 2 +- .../security/generated/SettingInnerTests.java | 3 +- .../SettingsGetWithResponseMockTests.java | 3 +- .../generated/SettingsListMockTests.java | 2 +- .../security/generated/SettingsListTests.java | 4 +- .../SettingsUpdateWithResponseMockTests.java | 6 +- .../generated/SoftwareInnerTests.java | 56 +- ...reInventoriesGetWithResponseMockTests.java | 22 +- ...toriesListByExtendedResourceMockTests.java | 20 +- .../SoftwareInventoriesListMockTests.java | 20 +- .../generated/SoftwarePropertiesTests.java | 50 +- .../generated/SoftwaresListTests.java | 69 +- ...SqlServerVulnerabilityPropertiesTests.java | 2 +- ...BaselineRulesAddWithResponseMockTests.java | 20 +- ...esCreateOrUpdateWithResponseMockTests.java | 18 +- ...elineRulesDeleteWithResponseMockTests.java | 2 +- ...BaselineRulesGetWithResponseMockTests.java | 6 +- ...aselineRulesListWithResponseMockTests.java | 6 +- ...ntScanResultsGetWithResponseMockTests.java | 49 +- ...tScanResultsListWithResponseMockTests.java | 36 +- ...sessmentScansGetWithResponseMockTests.java | 30 +- ...essmentScansListWithResponseMockTests.java | 32 +- .../StandardAssignmentMetadataTests.java | 23 + ...eByResourceGroupWithResponseMockTests.java | 34 + .../generated/StandardMetadataTests.java | 23 + .../SuppressionAlertsScopeTests.java | 12 +- .../security/generated/TagsResourceTests.java | 13 +- .../security/generated/TagsTests.java | 10 +- .../TargetBranchConfigurationTests.java | 20 +- ...ceGroupLevelTaskWithResponseMockTests.java | 4 +- ...riptionLevelTaskWithResponseMockTests.java | 4 +- .../TasksListByHomeRegionMockTests.java | 4 +- .../TasksListByResourceGroupMockTests.java | 4 +- .../generated/TasksListMockTests.java | 4 +- ...upLevelTaskStateWithResponseMockTests.java | 4 +- ...onLevelTaskStateWithResponseMockTests.java | 2 +- .../ThresholdCustomAlertRuleTests.java | 20 +- .../TimeWindowCustomAlertRuleTests.java | 26 +- .../TopologiesGetWithResponseMockTests.java | 4 +- .../TopologiesListByHomeRegionMockTests.java | 4 +- .../generated/TopologiesListMockTests.java | 2 +- .../security/generated/TopologyListTests.java | 2 +- .../generated/TopologyResourceInnerTests.java | 2 +- .../TopologyResourcePropertiesTests.java | 2 +- .../TopologySingleResourceChildTests.java | 2 +- .../TopologySingleResourceParentTests.java | 2 +- .../TopologySingleResourceTests.java | 2 +- .../generated/TrackedResourceTests.java | 27 +- .../TwinUpdatesNotInAllowedRangeTests.java | 26 +- ...rizedOperationsNotInAllowedRangeTests.java | 20 +- ...ateIoTSecuritySolutionPropertiesTests.java | 20 +- .../UpdateIotSecuritySolutionDataTests.java | 43 +- ...UpdateSensitivitySettingsRequestTests.java | 23 +- .../UserDefinedResourcesPropertiesTests.java | 18 +- .../generated/UserRecommendationTests.java | 29 - .../security/generated/VaRuleTests.java | 76 +- .../generated/VendorReferenceTests.java | 2 +- .../generated/VmRecommendationTests.java | 38 - .../generated/VmScannersAwsTests.java | 14 +- .../VmScannersBaseConfigurationTests.java | 12 +- .../generated/VmScannersBaseTests.java | 15 +- .../generated/VmScannersGcpTests.java | 15 +- .../generated/WorkspaceSettingInnerTests.java | 13 +- .../generated/WorkspaceSettingListTests.java | 14 +- .../WorkspaceSettingPropertiesTests.java | 12 +- ...ceSettingsCreateWithResponseMockTests.java | 12 +- ...ceSettingsDeleteWithResponseMockTests.java | 2 +- ...spaceSettingsGetWithResponseMockTests.java | 8 +- .../WorkspaceSettingsListMockTests.java | 6 +- 1612 files changed, 55094 insertions(+), 22360 deletions(-) delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveApplicationControlsClient.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveNetworkHardeningsClient.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomRecommendationsClient.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsPoliciesClient.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsPolicyAssignmentsClient.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityStandardsClient.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/StandardAssignmentsClient.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupData.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupInner.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupsInner.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningInner.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningProperties.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomRecommendationInner.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomRecommendationProperties.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingProperties.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsPolicyAssignmentInner.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsPolicyInner.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanInner.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanningProperties.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityStandardInner.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SensitiveDataDiscoveryProperties.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardAssignmentInner.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardAssignmentProperties.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardProperties.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupImpl.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupsImpl.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsClientImpl.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsImpl.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningImpl.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsClientImpl.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationsClientImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationsImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPoliciesClientImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPoliciesImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentsClientImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentsImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MalwareScanImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardsClientImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardsImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentsClientImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentsImpl.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AccessTokenAuthentication.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroup.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroups.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssue.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssueSummary.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardening.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningEnforceRequest.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardenings.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningsList.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedAssessmentItem.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedStandardItem.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AttestationComplianceState.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AttestationEvidence.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authentication.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobsScanSummary.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConfigurationStatus.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorDockerHubOffering.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorJFrogOffering.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendation.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendations.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendationsList.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmDockerHubOffering.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOffering.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOfferingMdcContainersImageAssessment.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersDockerHubOffering.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersJFrogOffering.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSettingProperties.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DescendantBehavior.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicies.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicy.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignment.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignmentListResponse.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignmentProperties.java rename sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/{AdaptiveApplicationControls.java => DevOpsPolicyAssignments.java} (51%) create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyDescriptor.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyListResponse.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyProperties.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicySource.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyType.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Direction.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DockerHubEnvironmentData.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Effect.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EffectiveNetworkSecurityGroups.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementMode.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementSupport.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExemptionCategory.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileType.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/JFrogEnvironmentData.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MalwareScan.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MalwareScanProperties.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/MalwareScanningProperties.java rename sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/{fluent => }/models/OnUploadProperties.java (51%) delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OperationList.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/OperationListResult.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Origin.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PartialAssessmentProperties.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PathRecommendation.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ProtectionMode.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/PublisherInfo.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationAction.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationStatus.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/RecommendationSupportedClouds.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Rule.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ScanSummary.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityIssue.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityStandard.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityStandardList.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SecurityStandards.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SensitiveDataDiscoveryProperties.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/SourceSystem.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardAssignment.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardAssignmentMetadata.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardAssignmentPropertiesAttestationData.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardAssignmentPropertiesExemptionData.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardAssignments.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardAssignmentsList.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardMetadata.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardSupportedCloud.java create mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/StandardType.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/TransportProtocol.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/UserRecommendation.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/VmRecommendation.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlsDeleteSamples.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlsGetSamples.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlsListSamples.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlsPutSamples.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningsEnforceSamples.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningsGetSamples.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningsListByExtendedResourceSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/CustomRecommendationsCreateOrUpdateSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/CustomRecommendationsDeleteSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/CustomRecommendationsGetSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/CustomRecommendationsListSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DefenderForStorageCancelMalwareScanSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DefenderForStorageGetMalwareScanSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DefenderForStorageStartMalwareScanSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DevOpsPoliciesGetSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DevOpsPoliciesListSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentsCreateOrUpdateSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentsDeleteSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentsGetSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentsListSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentsUpdateSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/OperationsListSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/SecurityStandardsCreateOrUpdateSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/SecurityStandardsDeleteSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/SecurityStandardsGetSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/SecurityStandardsListSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/StandardAssignmentsCreateSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/StandardAssignmentsDeleteSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/StandardAssignmentsGetSamples.java create mode 100644 sdk/security/azure-resourcemanager-security/src/samples/java/com/azure/resourcemanager/security/generated/StandardAssignmentsListSamples.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlGroupDataTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlGroupInnerTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlGroupsInnerTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlIssueSummaryTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlsGetWithResponseMockTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlsListWithResponseMockTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveApplicationControlsPutWithResponseMockTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningEnforceRequestTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningInnerTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningPropertiesTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningsEnforceMockTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningsGetWithResponseMockTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningsListByExtendedResourceMockTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AdaptiveNetworkHardeningsListTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AssignedStandardItemTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AttestationEvidenceTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/AuthenticationTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/BlobsScanSummaryTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/CspmMonitorDockerHubOfferingTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/CspmMonitorJFrogOfferingTests.java rename sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/{AdaptiveApplicationControlsDeleteByResourceGroupWithResponseMockTests.java => CustomRecommendationsDeleteByResourceGroupWithResponseMockTests.java} (83%) create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DefenderCspmDockerHubOfferingTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DefenderCspmJFrogOfferingMdcContainersImageAssessmentTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DefenderCspmJFrogOfferingTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DefenderForContainersDockerHubOfferingTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DefenderForContainersJFrogOfferingTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DefenderForStoragesCancelMalwareScanWithResponseMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DefenderForStoragesGetMalwareScanWithResponseMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DefenderForStoragesStartMalwareScanWithResponseMockTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsOperationResultsGetWithResponseMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPoliciesGetWithResponseMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPoliciesListMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentInnerTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentListResponseTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentPropertiesTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentsCreateOrUpdateMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentsGetWithResponseMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyAssignmentsListMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyDescriptorTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyInnerTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyListResponseTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DevOpsPolicyPropertiesTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/DockerHubEnvironmentDataTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/EffectiveNetworkSecurityGroupsTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/JFrogEnvironmentDataTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/MalwareScanInnerTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/MalwareScanPropertiesTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/OperationListResultTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/OperationListTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/OperationStatusResultInnerTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/OperationsListMockTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/PathRecommendationTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/ProtectionModeTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/PublisherInfoTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/RuleTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/ScanSummaryTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/SecurityStandardsDeleteByResourceGroupWithResponseMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/StandardAssignmentMetadataTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/StandardAssignmentsDeleteByResourceGroupWithResponseMockTests.java create mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/StandardMetadataTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/UserRecommendationTests.java delete mode 100644 sdk/security/azure-resourcemanager-security/src/test/java/com/azure/resourcemanager/security/generated/VmRecommendationTests.java diff --git a/sdk/security/azure-resourcemanager-security/CHANGELOG.md b/sdk/security/azure-resourcemanager-security/CHANGELOG.md index f7685e9194cb..b2d68950e132 100644 --- a/sdk/security/azure-resourcemanager-security/CHANGELOG.md +++ b/sdk/security/azure-resourcemanager-security/CHANGELOG.md @@ -1,14 +1,350 @@ # Release History -## 1.0.0-beta.8 (Unreleased) +## 1.0.0-beta.8 (2024-12-23) -### Features Added +- Azure Resource Manager Security client library for Java. This package contains Microsoft Azure SDK for Security Management SDK. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### Serialization/Deserialization change + +- `Jackson` is removed from dependency and no longer supported. + +##### Migration Guide + +If you are using `Jackson`/`ObjectMapper` for manual serialization/deserialization, configure your `ObjectMapper` for backward compatibility: +```java +objectMapper.registerModule(com.azure.core.serializer.json.jackson.JacksonJsonProvider.getJsonSerializableDatabindModule()); +``` + +#### `models.EffectiveNetworkSecurityGroups` was removed + +#### `models.RecommendationAction` was removed + +#### `models.Direction` was removed + +#### `models.AdaptiveApplicationControlIssueSummary` was removed + +#### `models.Rule` was removed + +#### `models.RecommendationStatus` was removed + +#### `models.AdaptiveApplicationControlGroup$Definition` was removed + +#### `models.FileType` was removed + +#### `models.SourceSystem` was removed + +#### `models.AdaptiveApplicationControlGroup$UpdateStages` was removed + +#### `models.AdaptiveApplicationControls` was removed + +#### `models.AdaptiveApplicationControlGroups` was removed + +#### `models.AdaptiveNetworkHardeningEnforceRequest` was removed + +#### `models.AdaptiveApplicationControlGroup` was removed + +#### `models.AdaptiveNetworkHardening` was removed + +#### `models.ProtectionMode` was removed + +#### `models.EnforcementMode` was removed + +#### `models.AdaptiveNetworkHardenings` was removed + +#### `models.EnforcementSupport` was removed + +#### `models.PathRecommendation` was removed + +#### `models.AdaptiveNetworkHardeningsList` was removed + +#### `models.AdaptiveApplicationControlGroup$Update` was removed + +#### `models.UserRecommendation` was removed + +#### `models.OperationList` was removed + +#### `models.VmRecommendation` was removed + +#### `models.AdaptiveApplicationControlGroup$DefinitionStages` was removed + +#### `models.TransportProtocol` was removed + +#### `models.AdaptiveApplicationControlIssue` was removed + +#### `models.ConfigurationStatus` was removed + +#### `models.PublisherInfo` was removed + +#### `models.DefenderForStorageSetting$Definition` was modified + +* `withCapGBPerMonth(java.lang.Integer)` was removed +* `withIsEnabled(java.lang.Boolean)` was removed +* `withIsEnabledSensitiveDataDiscoveryIsEnabled(java.lang.Boolean)` was removed +* `withScanResultsEventGridTopicResourceId(java.lang.String)` was removed +* `withIsEnabledMalwareScanningIsEnabled(java.lang.Boolean)` was removed +* `withOverrideSubscriptionLevelSettings(java.lang.Boolean)` was removed + +#### `models.Operation` was modified + +* `java.lang.String origin()` -> `models.Origin origin()` + +#### `SecurityManager` was modified + +* `adaptiveApplicationControls()` was removed +* `adaptiveNetworkHardenings()` was removed + +#### `models.DefenderForStorageSetting` was modified + +* `isEnabledSensitiveDataDiscoveryIsEnabled()` was removed +* `isEnabledMalwareScanningIsEnabled()` was removed +* `overrideSubscriptionLevelSettings()` was removed +* `operationStatusSensitiveDataDiscoveryOperationStatus()` was removed +* `operationStatus()` was removed +* `isEnabled()` was removed +* `capGBPerMonth()` was removed +* `scanResultsEventGridTopicResourceId()` was removed + +### Features Added + +* `models.StandardAssignmentsList` was added + +* `models.CustomRecommendation$Update` was added + +* `models.StandardAssignmentPropertiesExemptionData` was added + +* `models.ScanSummary` was added + +* `models.DevOpsPolicyAssignment$UpdateStages` was added + +* `models.DockerHubEnvironmentData` was added + +* `models.CspmMonitorDockerHubOffering` was added + +* `models.CustomRecommendations` was added + +* `models.DevOpsPolicyProperties` was added + +* `models.ExemptionCategory` was added + +* `models.AttestationComplianceState` was added + +* `models.StandardAssignment` was added + +* `models.DevOpsPolicyAssignment$DefinitionStages` was added + +* `models.MalwareScanProperties` was added + +* `models.DescendantBehavior` was added + +* `models.OnUploadProperties` was added + +* `models.SecurityStandard$DefinitionStages` was added + +* `models.DevOpsPolicies` was added + +* `models.CspmMonitorJFrogOffering` was added + +* `models.DevOpsPolicyAssignment$Update` was added + +* `models.AssignedAssessmentItem` was added + +* `models.Authentication` was added + +* `models.SecurityStandardList` was added + +* `models.Effect` was added + +* `models.MalwareScan` was added + +* `models.DefenderCspmJFrogOfferingMdcContainersImageAssessment` was added + +* `models.DevOpsPolicy` was added + +* `models.OperationListResult` was added + +* `models.DevOpsPolicyAssignmentProperties` was added + +* `models.CustomRecommendation$UpdateStages` was added + +* `models.StandardAssignment$DefinitionStages` was added + +* `models.StandardAssignments` was added + +* `models.CustomRecommendationsList` was added + +* `models.SecurityStandard` was added + +* `models.DevOpsPolicyAssignment` was added + +* `models.DevOpsPolicyAssignmentListResponse` was added + +* `models.DefenderForStorageSettingProperties` was added + +* `models.PartialAssessmentProperties` was added + +* `models.MalwareScanningProperties` was added + +* `models.DevOpsPolicySource` was added + +* `models.SecurityStandard$UpdateStages` was added + +* `models.StandardType` was added + +* `models.DefenderForContainersJFrogOffering` was added + +* `models.RecommendationSupportedClouds` was added + +* `models.SensitiveDataDiscoveryProperties` was added + +* `models.AssignedStandardItem` was added + +* `models.JFrogEnvironmentData` was added + +* `models.CustomRecommendation` was added + +* `models.SecurityIssue` was added + +* `models.StandardAssignment$Definition` was added + +* `models.StandardAssignmentMetadata` was added + +* `models.StandardAssignmentPropertiesAttestationData` was added + +* `models.DevOpsPolicyAssignment$Definition` was added + +* `models.Origin` was added + +* `models.StandardSupportedCloud` was added + +* `models.CustomRecommendation$Definition` was added + +* `models.StandardMetadata` was added + +* `models.DevOpsPolicyType` was added + +* `models.AttestationEvidence` was added + +* `models.DevOpsPolicyListResponse` was added + +* `models.AccessTokenAuthentication` was added + +* `models.DevOpsPolicyDescriptor` was added + +* `models.SecurityStandards` was added + +* `models.DefenderCspmDockerHubOffering` was added + +* `models.DefenderForContainersDockerHubOffering` was added + +* `models.SecurityStandard$Update` was added + +* `models.BlobsScanSummary` was added + +* `models.CustomRecommendation$DefinitionStages` was added + +* `models.DevOpsPolicyAssignments` was added + +* `models.DefenderCspmJFrogOffering` was added + +* `models.SecurityStandard$Definition` was added + +#### `models.DefenderForStorageSetting$Definition` was modified + +* `withProperties(models.DefenderForStorageSettingProperties)` was added + +#### `models.Operation` was modified + +* `isDataAction()` was added +* `actionType()` was added + +#### `models.CustomAssessmentAutomationRequest` was modified + +* `name()` was added +* `type()` was added +* `id()` was added + +#### `models.SecuritySolutionsReferenceData` was modified + +* `name()` was added +* `id()` was added +* `type()` was added + +#### `models.AzureServersSetting` was modified + +* `systemData()` was added +* `id()` was added +* `type()` was added +* `name()` was added + +#### `models.AtaExternalSecuritySolution` was modified + +* `type()` was added +* `name()` was added +* `id()` was added +* `location()` was added + +#### `models.AlertSyncSettings` was modified + +* `name()` was added +* `id()` was added +* `type()` was added + +#### `models.CefExternalSecuritySolution` was modified + +* `type()` was added +* `name()` was added +* `location()` was added +* `id()` was added + +#### `SecurityManager` was modified + +* `securityStandards()` was added +* `devOpsPolicies()` was added +* `customRecommendations()` was added +* `devOpsPolicyAssignments()` was added +* `standardAssignments()` was added + +#### `models.DefenderForStorages` was modified + +* `getMalwareScanWithResponse(java.lang.String,models.SettingName,java.lang.String,com.azure.core.util.Context)` was added +* `cancelMalwareScanWithResponse(java.lang.String,models.SettingName,java.lang.String,com.azure.core.util.Context)` was added +* `cancelMalwareScan(java.lang.String,models.SettingName,java.lang.String)` was added +* `startMalwareScan(java.lang.String,models.SettingName)` was added +* `getMalwareScan(java.lang.String,models.SettingName,java.lang.String)` was added +* `startMalwareScanWithResponse(java.lang.String,models.SettingName,com.azure.core.util.Context)` was added + +#### `models.SecurityAssessment` was modified + +* `id()` was added +* `type()` was added +* `name()` was added + +#### `models.DataExportSettings` was modified + +* `id()` was added +* `type()` was added +* `name()` was added + +#### `models.AadExternalSecuritySolution` was modified + +* `type()` was added +* `name()` was added +* `location()` was added +* `id()` was added + +#### `models.TrackedResource` was modified + +* `type()` was added +* `id()` was added +* `name()` was added + +#### `models.DefenderForStorageSetting` was modified -### Other Changes +* `startMalwareScan()` was added +* `startMalwareScanWithResponse(com.azure.core.util.Context)` was added +* `properties()` was added ## 1.0.0-beta.7 (2024-05-15) diff --git a/sdk/security/azure-resourcemanager-security/README.md b/sdk/security/azure-resourcemanager-security/README.md index 3d2043c180e5..837645e4ec5d 100644 --- a/sdk/security/azure-resourcemanager-security/README.md +++ b/sdk/security/azure-resourcemanager-security/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-security - 1.0.0-beta.7 + 1.0.0-beta.8 ``` [//]: # ({x-version-update-end}) @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. -- `AZURE_CLIENT_ID` for Azure client ID. -- `AZURE_TENANT_ID` for Azure tenant ID. -- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. - -With above configuration, `azure` client can be authenticated using the following code: +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -97,6 +93,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty [authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md [design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/security/azure-resourcemanager-security/SAMPLE.md b/sdk/security/azure-resourcemanager-security/SAMPLE.md index 33308ce3ada8..e095850a8212 100644 --- a/sdk/security/azure-resourcemanager-security/SAMPLE.md +++ b/sdk/security/azure-resourcemanager-security/SAMPLE.md @@ -1,19 +1,6 @@ # Code snippets and samples -## AdaptiveApplicationControls - -- [Delete](#adaptiveapplicationcontrols_delete) -- [Get](#adaptiveapplicationcontrols_get) -- [List](#adaptiveapplicationcontrols_list) -- [Put](#adaptiveapplicationcontrols_put) - -## AdaptiveNetworkHardenings - -- [Enforce](#adaptivenetworkhardenings_enforce) -- [Get](#adaptivenetworkhardenings_get) -- [ListByExtendedResource](#adaptivenetworkhardenings_listbyextendedresource) - ## AdvancedThreatProtection - [Create](#advancedthreatprotection_create) @@ -156,10 +143,20 @@ - [List](#customentitystoreassignments_list) - [ListByResourceGroup](#customentitystoreassignments_listbyresourcegroup) +## CustomRecommendations + +- [CreateOrUpdate](#customrecommendations_createorupdate) +- [Delete](#customrecommendations_delete) +- [Get](#customrecommendations_get) +- [List](#customrecommendations_list) + ## DefenderForStorage +- [CancelMalwareScan](#defenderforstorage_cancelmalwarescan) - [Create](#defenderforstorage_create) - [Get](#defenderforstorage_get) +- [GetMalwareScan](#defenderforstorage_getmalwarescan) +- [StartMalwareScan](#defenderforstorage_startmalwarescan) ## DevOpsConfigurations @@ -173,6 +170,19 @@ - [Get](#devopsoperationresults_get) +## DevOpsPolicies + +- [Get](#devopspolicies_get) +- [List](#devopspolicies_list) + +## DevOpsPolicyAssignments + +- [CreateOrUpdate](#devopspolicyassignments_createorupdate) +- [Delete](#devopspolicyassignments_delete) +- [Get](#devopspolicyassignments_get) +- [List](#devopspolicyassignments_list) +- [Update](#devopspolicyassignments_update) + ## DeviceSecurityGroups - [CreateOrUpdate](#devicesecuritygroups_createorupdate) @@ -291,6 +301,10 @@ - [Get](#mdeonboardings_get) - [List](#mdeonboardings_list) +## Operations + +- [List](#operations_list) + ## Pricings - [Delete](#pricings_delete) @@ -371,6 +385,13 @@ - [List](#securitysolutionsreferencedata_list) - [ListByHomeRegion](#securitysolutionsreferencedata_listbyhomeregion) +## SecurityStandards + +- [CreateOrUpdate](#securitystandards_createorupdate) +- [Delete](#securitystandards_delete) +- [Get](#securitystandards_get) +- [List](#securitystandards_list) + ## SensitivitySettings - [CreateOrUpdate](#sensitivitysettings_createorupdate) @@ -421,6 +442,13 @@ - [Get](#sqlvulnerabilityassessmentscans_get) - [List](#sqlvulnerabilityassessmentscans_list) +## StandardAssignments + +- [Create](#standardassignments_create) +- [Delete](#standardassignments_delete) +- [Get](#standardassignments_get) +- [List](#standardassignments_list) + ## SubAssessments - [Get](#subassessments_get) @@ -450,274 +478,6 @@ - [Get](#workspacesettings_get) - [List](#workspacesettings_list) - [Update](#workspacesettings_update) -### AdaptiveApplicationControls_Delete - -```java -/** - * Samples for AdaptiveApplicationControls Delete. - */ -public final class AdaptiveApplicationControlsDeleteSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ApplicationWhitelistings/DeleteAdaptiveApplicationControls_example.json - */ - /** - * Sample code: Delete an application control machine group. - * - * @param manager Entry point to SecurityManager. - */ - public static void - deleteAnApplicationControlMachineGroup(com.azure.resourcemanager.security.SecurityManager manager) { - manager.adaptiveApplicationControls() - .deleteByResourceGroupWithResponse("centralus", "GROUP1", com.azure.core.util.Context.NONE); - } -} -``` - -### AdaptiveApplicationControls_Get - -```java -/** - * Samples for AdaptiveApplicationControls Get. - */ -public final class AdaptiveApplicationControlsGetSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ApplicationWhitelistings/GetAdaptiveApplicationControlsGroup_example.json - */ - /** - * Sample code: Gets a configured application control VM/server group. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getsAConfiguredApplicationControlVMServerGroup(com.azure.resourcemanager.security.SecurityManager manager) { - manager.adaptiveApplicationControls() - .getWithResponse("centralus", "ERELGROUP1", com.azure.core.util.Context.NONE); - } -} -``` - -### AdaptiveApplicationControls_List - -```java -/** - * Samples for AdaptiveApplicationControls List. - */ -public final class AdaptiveApplicationControlsListSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ApplicationWhitelistings/GetAdaptiveApplicationControlsSubscription_example.json - */ - /** - * Sample code: Gets a list of application control groups of machines for the subscription. - * - * @param manager Entry point to SecurityManager. - */ - public static void getsAListOfApplicationControlGroupsOfMachinesForTheSubscription( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.adaptiveApplicationControls().listWithResponse(true, false, com.azure.core.util.Context.NONE); - } -} -``` - -### AdaptiveApplicationControls_Put - -```java -import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroup; -import com.azure.resourcemanager.security.models.ConfigurationStatus; -import com.azure.resourcemanager.security.models.EnforcementMode; -import com.azure.resourcemanager.security.models.EnforcementSupport; -import com.azure.resourcemanager.security.models.FileType; -import com.azure.resourcemanager.security.models.PathRecommendation; -import com.azure.resourcemanager.security.models.ProtectionMode; -import com.azure.resourcemanager.security.models.PublisherInfo; -import com.azure.resourcemanager.security.models.RecommendationAction; -import com.azure.resourcemanager.security.models.RecommendationType; -import com.azure.resourcemanager.security.models.UserRecommendation; -import com.azure.resourcemanager.security.models.VmRecommendation; -import java.util.Arrays; - -/** - * Samples for AdaptiveApplicationControls Put. - */ -public final class AdaptiveApplicationControlsPutSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ApplicationWhitelistings/PutAdaptiveApplicationControls_example.json - */ - /** - * Sample code: Update an application control machine group by adding a new application. - * - * @param manager Entry point to SecurityManager. - */ - public static void updateAnApplicationControlMachineGroupByAddingANewApplication( - com.azure.resourcemanager.security.SecurityManager manager) { - AdaptiveApplicationControlGroup resource = manager.adaptiveApplicationControls() - .getWithResponse("centralus", "ERELGROUP1", com.azure.core.util.Context.NONE) - .getValue(); - resource.update() - .withEnforcementMode(EnforcementMode.AUDIT) - .withProtectionMode(new ProtectionMode().withExe(EnforcementMode.AUDIT) - .withMsi(EnforcementMode.NONE) - .withScript(EnforcementMode.NONE)) - .withVmRecommendations(Arrays.asList(new VmRecommendation() - .withConfigurationStatus(ConfigurationStatus.CONFIGURED) - .withRecommendationAction(RecommendationAction.RECOMMENDED) - .withResourceId( - "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/erelh-stable/providers/microsoft.compute/virtualmachines/erelh-16090") - .withEnforcementSupport(EnforcementSupport.SUPPORTED), - new VmRecommendation().withConfigurationStatus(ConfigurationStatus.CONFIGURED) - .withRecommendationAction(RecommendationAction.RECOMMENDED) - .withResourceId( - "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/matanvs/providers/microsoft.compute/virtualmachines/matanvs19") - .withEnforcementSupport(EnforcementSupport.SUPPORTED))) - .withPathRecommendations( - Arrays.asList( - new PathRecommendation() - .withPath("[Exe] O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US\\*\\*\\0.0.0.0") - .withAction(RecommendationAction.RECOMMENDED) - .withType(RecommendationType.fromString("PublisherSignature")) - .withPublisherInfo(new PublisherInfo() - .withPublisherName("O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US") - .withProductName("*") - .withBinaryName("*") - .withVersion("0.0.0.0")) - .withCommon(true) - .withUserSids(Arrays.asList("S-1-1-0")) - .withUsernames(Arrays - .asList(new UserRecommendation().withUsername("Everyone") - .withRecommendationAction(RecommendationAction.RECOMMENDED))) - .withFileType(FileType.EXE) - .withConfigurationStatus(ConfigurationStatus.CONFIGURED), - new PathRecommendation().withPath("%OSDRIVE%\\WINDOWSAZURE\\SECAGENT\\WASECAGENTPROV.EXE") - .withAction(RecommendationAction.RECOMMENDED) - .withType(RecommendationType.fromString("ProductSignature")) - .withPublisherInfo( - new PublisherInfo().withPublisherName("CN=MICROSOFT AZURE DEPENDENCY CODE SIGN") - .withProductName("MICROSOFT® COREXT") - .withBinaryName("*") - .withVersion("0.0.0.0")) - .withCommon(true) - .withUserSids(Arrays.asList("S-1-1-0")) - .withUsernames(Arrays - .asList(new UserRecommendation().withUsername("NT AUTHORITY\\SYSTEM") - .withRecommendationAction(RecommendationAction.RECOMMENDED))) - .withFileType(FileType.EXE) - .withConfigurationStatus(ConfigurationStatus.CONFIGURED), - new PathRecommendation() - .withPath("%OSDRIVE%\\WINDOWSAZURE\\PACKAGES_201973_7415\\COLLECTGUESTLOGS.EXE") - .withAction(RecommendationAction.RECOMMENDED) - .withType(RecommendationType.fromString("PublisherSignature")) - .withPublisherInfo( - new PublisherInfo().withPublisherName("CN=MICROSOFT AZURE DEPENDENCY CODE SIGN") - .withProductName("*") - .withBinaryName("*") - .withVersion("0.0.0.0")) - .withCommon(true) - .withUserSids(Arrays.asList("S-1-1-0")) - .withUsernames(Arrays.asList(new UserRecommendation().withUsername("NT AUTHORITY\\SYSTEM") - .withRecommendationAction(RecommendationAction.RECOMMENDED))) - .withFileType(FileType.EXE) - .withConfigurationStatus(ConfigurationStatus.CONFIGURED), - new PathRecommendation().withPath("C:\\directory\\file.exe") - .withAction(RecommendationAction.ADD) - .withType(RecommendationType.fromString("File")) - .withCommon(true))) - .apply(); - } -} -``` - -### AdaptiveNetworkHardenings_Enforce - -```java -import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningEnforceRequest; -import com.azure.resourcemanager.security.models.Direction; -import com.azure.resourcemanager.security.models.Rule; -import com.azure.resourcemanager.security.models.TransportProtocol; -import java.util.Arrays; - -/** - * Samples for AdaptiveNetworkHardenings Enforce. - */ -public final class AdaptiveNetworkHardeningsEnforceSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AdaptiveNetworkHardenings/EnforceAdaptiveNetworkHardeningRules_example.json - */ - /** - * Sample code: Enforces the given rules on the NSG(s) listed in the request. - * - * @param manager Entry point to SecurityManager. - */ - public static void - enforcesTheGivenRulesOnTheNSGSListedInTheRequest(com.azure.resourcemanager.security.SecurityManager manager) { - manager.adaptiveNetworkHardenings() - .enforce("rg1", "Microsoft.Compute", "virtualMachines", "vm1", "default", - new AdaptiveNetworkHardeningEnforceRequest() - .withRules(Arrays.asList( - new Rule().withName("rule1") - .withDirection(Direction.INBOUND) - .withDestinationPort(3389) - .withProtocols(Arrays.asList(TransportProtocol.TCP)) - .withIpAddresses(Arrays.asList("100.10.1.1", "200.20.2.2", "81.199.3.0/24")), - new Rule().withName("rule2") - .withDirection(Direction.INBOUND) - .withDestinationPort(22) - .withProtocols(Arrays.asList(TransportProtocol.TCP)) - .withIpAddresses(Arrays.asList()))) - .withNetworkSecurityGroups(Arrays.asList( - "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1", - "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg2")), - com.azure.core.util.Context.NONE); - } -} -``` - -### AdaptiveNetworkHardenings_Get - -```java -/** - * Samples for AdaptiveNetworkHardenings Get. - */ -public final class AdaptiveNetworkHardeningsGetSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AdaptiveNetworkHardenings/GetAdaptiveNetworkHardening_example.json - */ - /** - * Sample code: Get a single Adaptive Network Hardening resource. - * - * @param manager Entry point to SecurityManager. - */ - public static void - getASingleAdaptiveNetworkHardeningResource(com.azure.resourcemanager.security.SecurityManager manager) { - manager.adaptiveNetworkHardenings() - .getWithResponse("rg1", "Microsoft.Compute", "virtualMachines", "vm1", "default", - com.azure.core.util.Context.NONE); - } -} -``` - -### AdaptiveNetworkHardenings_ListByExtendedResource - -```java -/** - * Samples for AdaptiveNetworkHardenings ListByExtendedResource. - */ -public final class AdaptiveNetworkHardeningsListByExtendedResourceSamples { - /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AdaptiveNetworkHardenings/ListByExtendedResourceAdaptiveNetworkHardenings_example.json - */ - /** - * Sample code: List Adaptive Network Hardenings resources of an extended resource. - * - * @param manager Entry point to SecurityManager. - */ - public static void listAdaptiveNetworkHardeningsResourcesOfAnExtendedResource( - com.azure.resourcemanager.security.SecurityManager manager) { - manager.adaptiveNetworkHardenings() - .listByExtendedResource("rg1", "Microsoft.Compute", "virtualMachines", "vm1", - com.azure.core.util.Context.NONE); - } -} -``` - ### AdvancedThreatProtection_Create ```java @@ -726,7 +486,9 @@ public final class AdaptiveNetworkHardeningsListByExtendedResourceSamples { */ public final class AdvancedThreatProtectionCreateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/PutAdvancedThreatProtectionSettings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/ + * PutAdvancedThreatProtectionSettings_example.json */ /** * Sample code: Creates or updates the Advanced Threat Protection settings on a specified resource. @@ -753,7 +515,9 @@ public final class AdvancedThreatProtectionCreateSamples { */ public final class AdvancedThreatProtectionGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/GetAdvancedThreatProtectionSettings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/ + * GetAdvancedThreatProtectionSettings_example.json */ /** * Sample code: Gets the Advanced Threat Protection settings for the specified resource. @@ -778,7 +542,8 @@ public final class AdvancedThreatProtectionGetSamples { */ public final class AlertsGetResourceGroupLevelSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertResourceGroupLocation_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * GetAlertResourceGroupLocation_example.json */ /** * Sample code: Get security alert on a resource group from a security data location. @@ -802,7 +567,8 @@ public final class AlertsGetResourceGroupLevelSamples { */ public final class AlertsGetSubscriptionLevelSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertSubscriptionLocation_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * GetAlertSubscriptionLocation_example.json */ /** * Sample code: Get security alert on a subscription from a security data location. @@ -826,7 +592,8 @@ public final class AlertsGetSubscriptionLevelSamples { */ public final class AlertsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertsSubscription_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * GetAlertsSubscription_example.json */ /** * Sample code: Get security alerts on a subscription. @@ -847,7 +614,8 @@ public final class AlertsListSamples { */ public final class AlertsListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertsResourceGroup_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * GetAlertsResourceGroup_example.json */ /** * Sample code: Get security alerts on a resource group. @@ -868,7 +636,8 @@ public final class AlertsListByResourceGroupSamples { */ public final class AlertsListResourceGroupLevelByRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertsResourceGroupLocation_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * GetAlertsResourceGroupLocation_example.json */ /** * Sample code: Get security alerts on a resource group from a security data location. @@ -890,7 +659,8 @@ public final class AlertsListResourceGroupLevelByRegionSamples { */ public final class AlertsListSubscriptionLevelByRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/GetAlertsSubscriptionsLocation_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * GetAlertsSubscriptionsLocation_example.json */ /** * Sample code: Get security alerts on a subscription from a security data location. @@ -917,7 +687,8 @@ import java.util.Arrays; */ public final class AlertsSimulateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/SimulateAlerts_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * SimulateAlerts_example.json */ /** * Sample code: Simulate security alerts on a subscription. @@ -945,7 +716,8 @@ public final class AlertsSimulateSamples { */ public final class AlertsUpdateResourceGroupLevelStateToActivateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertResourceGroupLocation_activate_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertResourceGroupLocation_activate_example.json */ /** * Sample code: Update security alert state on a resource group from a security data location. @@ -969,7 +741,8 @@ public final class AlertsUpdateResourceGroupLevelStateToActivateSamples { */ public final class AlertsUpdateResourceGroupLevelStateToDismissSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertResourceGroupLocation_dismiss_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertResourceGroupLocation_dismiss_example.json */ /** * Sample code: Update security alert state on a resource group from a security data location. @@ -993,7 +766,8 @@ public final class AlertsUpdateResourceGroupLevelStateToDismissSamples { */ public final class AlertsUpdateResourceGroupLevelStateToInProgressSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertResourceGroupLocation_inProgress_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertResourceGroupLocation_inProgress_example.json */ /** * Sample code: Update security alert state on a resource group from a security data location. @@ -1017,7 +791,8 @@ public final class AlertsUpdateResourceGroupLevelStateToInProgressSamples { */ public final class AlertsUpdateResourceGroupLevelStateToResolveSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertResourceGroupLocation_resolve_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertResourceGroupLocation_resolve_example.json */ /** * Sample code: Update security alert state on a resource group from a security data location. @@ -1041,7 +816,8 @@ public final class AlertsUpdateResourceGroupLevelStateToResolveSamples { */ public final class AlertsUpdateSubscriptionLevelStateToActivateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertSubscriptionLocation_activate_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertSubscriptionLocation_activate_example.json */ /** * Sample code: Update security alert state on a subscription from a security data location. @@ -1065,7 +841,8 @@ public final class AlertsUpdateSubscriptionLevelStateToActivateSamples { */ public final class AlertsUpdateSubscriptionLevelStateToDismissSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertSubscriptionLocation_dismiss_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertSubscriptionLocation_dismiss_example.json */ /** * Sample code: Update security alert state on a subscription from a security data location. @@ -1089,7 +866,8 @@ public final class AlertsUpdateSubscriptionLevelStateToDismissSamples { */ public final class AlertsUpdateSubscriptionLevelStateToInProgressSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertSubscriptionLocation_inProgress_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertSubscriptionLocation_inProgress_example.json */ /** * Sample code: Update security alert state on a subscription from a security data location. @@ -1113,7 +891,8 @@ public final class AlertsUpdateSubscriptionLevelStateToInProgressSamples { */ public final class AlertsUpdateSubscriptionLevelStateToResolveSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/UpdateAlertSubscriptionLocation_resolve_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-01-01/examples/Alerts/ + * UpdateAlertSubscriptionLocation_resolve_example.json */ /** * Sample code: Update security alert state on a subscription from a security data location. @@ -1137,7 +916,9 @@ public final class AlertsUpdateSubscriptionLevelStateToResolveSamples { */ public final class AlertsSuppressionRulesDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/DeleteAlertsSuppressionRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/DeleteAlertsSuppressionRule_example.json */ /** * Sample code: Delete suppression rule data for a subscription. @@ -1159,7 +940,9 @@ public final class AlertsSuppressionRulesDeleteSamples { */ public final class AlertsSuppressionRulesGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/GetAlertsSuppressionRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/GetAlertsSuppressionRule_example.json */ /** * Sample code: Get suppression alert rule for subscription. @@ -1181,7 +964,9 @@ public final class AlertsSuppressionRulesGetSamples { */ public final class AlertsSuppressionRulesListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/GetAlertsSuppressionRules_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/GetAlertsSuppressionRules_example.json */ /** * Sample code: Get suppression rules for subscription. @@ -1193,7 +978,9 @@ public final class AlertsSuppressionRulesListSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/GetAlertsSuppressionRulesWithAlertType_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/GetAlertsSuppressionRulesWithAlertType_example.json */ /** * Sample code: Get suppression alert rule for subscription, filtered by AlertType. @@ -1227,7 +1014,9 @@ import java.util.Map; */ public final class AlertsSuppressionRulesUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/PutAlertsSuppressionRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * AlertsSuppressionRules/PutAlertsSuppressionRule_example.json */ /** * Sample code: Update or create suppression rule for subscription. @@ -1275,7 +1064,9 @@ import com.azure.resourcemanager.security.models.ConnectionType; */ public final class AllowedConnectionsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/GetAllowedConnections_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/ + * GetAllowedConnections_example.json */ /** * Sample code: Get allowed connections. @@ -1297,7 +1088,9 @@ public final class AllowedConnectionsGetSamples { */ public final class AllowedConnectionsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/GetAllowedConnectionsSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/ + * GetAllowedConnectionsSubscription_example.json */ /** * Sample code: Get allowed connections on a subscription. @@ -1319,7 +1112,9 @@ public final class AllowedConnectionsListSamples { */ public final class AllowedConnectionsListByHomeRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/GetAllowedConnectionsSubscriptionLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/ + * GetAllowedConnectionsSubscriptionLocation_example.json */ /** * Sample code: Get allowed connections on a subscription from security data location. @@ -1341,7 +1136,9 @@ public final class AllowedConnectionsListByHomeRegionSamples { */ public final class ApiCollectionsGetByAzureApiManagementServiceSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_GetByAzureApiManagementService_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_GetByAzureApiManagementService_example.json */ /** * Sample code: Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. @@ -1365,7 +1162,9 @@ public final class ApiCollectionsGetByAzureApiManagementServiceSamples { */ public final class ApiCollectionsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_ListBySubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_ListBySubscription_example.json */ /** * Sample code: Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender @@ -1388,7 +1187,9 @@ public final class ApiCollectionsListSamples { */ public final class ApiCollectionsListByAzureApiManagementServiceSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_ListByAzureApiManagementService_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_ListByAzureApiManagementService_example.json */ /** * Sample code: Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. @@ -1411,7 +1212,9 @@ public final class ApiCollectionsListByAzureApiManagementServiceSamples { */ public final class ApiCollectionsListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_ListByResourceGroup_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_ListByResourceGroup_example.json */ /** * Sample code: Gets a list of API collections within a resource group that have been onboarded to Microsoft @@ -1434,7 +1237,9 @@ public final class ApiCollectionsListByResourceGroupSamples { */ public final class ApiCollectionsOffboardAzureApiManagementApiSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_OffboardAzureApiManagementApi_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_OffboardAzureApiManagementApi_example.json */ /** * Sample code: Offboard an Azure API Management API from Microsoft Defender for APIs. @@ -1458,7 +1263,9 @@ public final class ApiCollectionsOffboardAzureApiManagementApiSamples { */ public final class ApiCollectionsOnboardAzureApiManagementApiSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/APICollections_OnboardAzureApiManagementApi_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2023-11-15/examples/ApiCollections/ + * APICollections_OnboardAzureApiManagementApi_example.json */ /** * Sample code: Onboard an Azure API Management API to Microsoft Defender for APIs. @@ -1487,7 +1294,9 @@ import java.util.Arrays; */ public final class ApplicationOperationCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/PutApplication_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * PutApplication_example.json */ /** * Sample code: Create application. @@ -1517,7 +1326,9 @@ public final class ApplicationOperationCreateOrUpdateSamples { */ public final class ApplicationOperationDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/DeleteApplication_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * DeleteApplication_example.json */ /** * Sample code: Delete security Application. @@ -1539,7 +1350,9 @@ public final class ApplicationOperationDeleteSamples { */ public final class ApplicationOperationGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/GetApplication_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * GetApplication_example.json */ /** * Sample code: Get security application by specific applicationId. @@ -1562,7 +1375,9 @@ public final class ApplicationOperationGetSamples { */ public final class ApplicationsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ListBySubscriptionApplications_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * ListBySubscriptionApplications_example.json */ /** * Sample code: List applications security by subscription level scope. @@ -1588,7 +1403,9 @@ import com.azure.resourcemanager.security.models.AzureResourceDetails; */ public final class AssessmentsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/PutAssessment_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ + * PutAssessment_example.json */ /** * Sample code: Create security recommendation task on a resource. @@ -1616,7 +1433,9 @@ public final class AssessmentsCreateOrUpdateSamples { */ public final class AssessmentsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/DeleteAssessment_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ + * DeleteAssessment_example.json */ /** * Sample code: Delete a security recommendation task on a resource. @@ -1643,7 +1462,9 @@ import com.azure.resourcemanager.security.models.ExpandEnum; */ public final class AssessmentsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/GetAssessmentWithExpand_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ + * GetAssessmentWithExpand_example.json */ /** * Sample code: Get security recommendation task from security data location with expand parameter. @@ -1659,7 +1480,9 @@ public final class AssessmentsGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/GetAssessment_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ + * GetAssessment_example.json */ /** * Sample code: Get security recommendation task from security data location. @@ -1684,7 +1507,9 @@ public final class AssessmentsGetSamples { */ public final class AssessmentsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ListAssessments_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ + * ListAssessments_example.json */ /** * Sample code: List security assessments. @@ -1714,7 +1539,9 @@ import java.util.Arrays; */ public final class AssessmentsMetadataCreateInSubscriptionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/CreateAssessmentsMetadata_subscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ + * CreateAssessmentsMetadata_subscription_example.json */ /** * Sample code: Create security assessment metadata for subscription. @@ -1749,7 +1576,9 @@ public final class AssessmentsMetadataCreateInSubscriptionSamples { */ public final class AssessmentsMetadataDeleteInSubscriptionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/DeleteAssessmentsMetadata_subscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ + * DeleteAssessmentsMetadata_subscription_example.json */ /** * Sample code: Delete a security assessment metadata for subscription. @@ -1772,7 +1601,9 @@ public final class AssessmentsMetadataDeleteInSubscriptionSamples { */ public final class AssessmentsMetadataGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/GetAssessmentsMetadata_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ + * GetAssessmentsMetadata_example.json */ /** * Sample code: Get security assessment metadata. @@ -1794,7 +1625,9 @@ public final class AssessmentsMetadataGetSamples { */ public final class AssessmentsMetadataGetInSubscriptionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/GetAssessmentsMetadata_subscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ + * GetAssessmentsMetadata_subscription_example.json */ /** * Sample code: Get security assessment metadata for subscription. @@ -1817,7 +1650,9 @@ public final class AssessmentsMetadataGetInSubscriptionSamples { */ public final class AssessmentsMetadataListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ListAssessmentsMetadata_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ + * ListAssessmentsMetadata_example.json */ /** * Sample code: List security assessment metadata. @@ -1838,7 +1673,9 @@ public final class AssessmentsMetadataListSamples { */ public final class AssessmentsMetadataListBySubscriptionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ListAssessmentsMetadata_subscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ + * ListAssessmentsMetadata_subscription_example.json */ /** * Sample code: List security assessment metadata for subscription. @@ -1862,7 +1699,9 @@ import com.azure.resourcemanager.security.models.AutoProvision; */ public final class AutoProvisioningSettingsCreateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/AutoProvisioningSettings/CreateAutoProvisioningSettingsSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * AutoProvisioningSettings/CreateAutoProvisioningSettingsSubscription_example.json */ /** * Sample code: Create auto provisioning settings for subscription. @@ -1884,7 +1723,9 @@ public final class AutoProvisioningSettingsCreateSamples { */ public final class AutoProvisioningSettingsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/AutoProvisioningSettings/GetAutoProvisioningSettingSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * AutoProvisioningSettings/GetAutoProvisioningSettingSubscription_example.json */ /** * Sample code: Get an auto provisioning setting for subscription. @@ -1906,7 +1747,9 @@ public final class AutoProvisioningSettingsGetSamples { */ public final class AutoProvisioningSettingsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/AutoProvisioningSettings/GetAutoProvisioningSettingsSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * AutoProvisioningSettings/GetAutoProvisioningSettingsSubscription_example.json */ /** * Sample code: Get auto provisioning settings for subscription. @@ -1940,7 +1783,9 @@ import java.util.Map; */ public final class AutomationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/PutAutomationAllAssessments_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * PutAutomationAllAssessments_example.json */ /** * Sample code: Create or update a security automation for all assessments (including all severities). @@ -1968,7 +1813,9 @@ public final class AutomationsCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/PutDisableAutomation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * PutDisableAutomation_example.json */ /** * Sample code: Disable or enable a security automation. @@ -2000,7 +1847,9 @@ public final class AutomationsCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/PutAutomationHighSeverityAssessments_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * PutAutomationHighSeverityAssessments_example.json */ /** * Sample code: Create or update a security automation for all high severity assessments. @@ -2054,7 +1903,9 @@ public final class AutomationsCreateOrUpdateSamples { */ public final class AutomationsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/DeleteAutomation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * DeleteAutomation_example.json */ /** * Sample code: Delete a security automation. @@ -2076,7 +1927,9 @@ public final class AutomationsDeleteSamples { */ public final class AutomationsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/GetAutomationResourceGroup_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * GetAutomationResourceGroup_example.json */ /** * Sample code: Retrieve a security automation. @@ -2099,7 +1952,9 @@ public final class AutomationsGetByResourceGroupSamples { */ public final class AutomationsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/GetAutomationsSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * GetAutomationsSubscription_example.json */ /** * Sample code: List all security automations of a specified subscription. @@ -2121,7 +1976,9 @@ public final class AutomationsListSamples { */ public final class AutomationsListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/GetAutomationsResourceGroup_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * GetAutomationsResourceGroup_example.json */ /** * Sample code: List all security automations of a specified resource group. @@ -2152,7 +2009,9 @@ import java.util.Map; */ public final class AutomationsUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/PatchAutomation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * PatchAutomation_example.json */ /** * Sample code: Update a security automation. @@ -2213,7 +2072,9 @@ import java.util.Map; */ public final class AutomationsValidateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ValidateAutomation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/Automations/ + * ValidateAutomation_example.json */ /** * Sample code: Validate the security automation model before create or update. @@ -2272,7 +2133,9 @@ import com.azure.resourcemanager.security.models.OnboardingState; */ public final class AzureDevOpsOrgsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsOrgs_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsOrgs_example.json */ /** * Sample code: CreateOrUpdate_AzureDevOpsOrgs. @@ -2298,7 +2161,9 @@ public final class AzureDevOpsOrgsCreateOrUpdateSamples { */ public final class AzureDevOpsOrgsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetAzureDevOpsOrgs_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetAzureDevOpsOrgs_example.json */ /** * Sample code: Get_AzureDevOpsOrgs. @@ -2320,7 +2185,9 @@ public final class AzureDevOpsOrgsGetSamples { */ public final class AzureDevOpsOrgsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListAzureDevOpsOrgs_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListAzureDevOpsOrgs_example.json */ /** * Sample code: List_AzureDevOpsOrgs. @@ -2341,7 +2208,9 @@ public final class AzureDevOpsOrgsListSamples { */ public final class AzureDevOpsOrgsListAvailableSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListAvailableAzureDevOpsOrgs_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListAvailableAzureDevOpsOrgs_example.json */ /** * Sample code: ListAvailable_AzureDevOpsOrgs. @@ -2369,7 +2238,9 @@ import com.azure.resourcemanager.security.models.OnboardingState; */ public final class AzureDevOpsOrgsUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/UpdateAzureDevOpsOrgs_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/UpdateAzureDevOpsOrgs_example.json */ /** * Sample code: Update_AzureDevOpsOrgs. @@ -2401,7 +2272,9 @@ import com.azure.resourcemanager.security.models.OnboardingState; */ public final class AzureDevOpsProjectsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsProjects_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsProjects_example.json */ /** * Sample code: CreateOrUpdate_AzureDevOpsProjects. @@ -2427,7 +2300,9 @@ public final class AzureDevOpsProjectsCreateOrUpdateSamples { */ public final class AzureDevOpsProjectsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetAzureDevOpsProjects_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetAzureDevOpsProjects_example.json */ /** * Sample code: Get_AzureDevOpsProjects. @@ -2450,7 +2325,9 @@ public final class AzureDevOpsProjectsGetSamples { */ public final class AzureDevOpsProjectsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListAzureDevOpsProjects_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListAzureDevOpsProjects_example.json */ /** * Sample code: List_AzureDevOpsProjects. @@ -2478,7 +2355,9 @@ import com.azure.resourcemanager.security.models.OnboardingState; */ public final class AzureDevOpsProjectsUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/UpdateAzureDevOpsProjects_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/UpdateAzureDevOpsProjects_example.json */ /** * Sample code: Update_AzureDevOpsProjects. @@ -2511,7 +2390,9 @@ import com.azure.resourcemanager.security.models.OnboardingState; */ public final class AzureDevOpsReposCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsRepos_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/CreateOrUpdateAzureDevOpsRepos_example.json */ /** * Sample code: CreateOrUpdate_AzureDevOpsRepos. @@ -2537,7 +2418,9 @@ public final class AzureDevOpsReposCreateOrUpdateSamples { */ public final class AzureDevOpsReposGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetAzureDevOpsRepos_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetAzureDevOpsRepos_example.json */ /** * Sample code: Get_AzureDevOpsRepos. @@ -2560,7 +2443,9 @@ public final class AzureDevOpsReposGetSamples { */ public final class AzureDevOpsReposListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListAzureDevOpsRepos_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListAzureDevOpsRepos_example.json */ /** * Sample code: List_AzureDevOpsRepos. @@ -2589,7 +2474,9 @@ import com.azure.resourcemanager.security.models.OnboardingState; */ public final class AzureDevOpsReposUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/UpdateAzureDevOpsRepos_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/UpdateAzureDevOpsRepos_example.json */ /** * Sample code: Update_AzureDevOpsRepos. @@ -2617,7 +2504,9 @@ public final class AzureDevOpsReposUpdateSamples { */ public final class ComplianceResultsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/GetComplianceResults_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/ + * GetComplianceResults_example.json */ /** * Sample code: Get compliance results on subscription. @@ -2640,7 +2529,9 @@ public final class ComplianceResultsGetSamples { */ public final class ComplianceResultsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/ListComplianceResults_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/ + * ListComplianceResults_example.json */ /** * Sample code: Get compliance results on subscription. @@ -2662,7 +2553,9 @@ public final class ComplianceResultsListSamples { */ public final class CompliancesGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/GetCompliance_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/ + * GetCompliance_example.json */ /** * Sample code: Get security compliance data for a day. @@ -2685,7 +2578,9 @@ public final class CompliancesGetSamples { */ public final class CompliancesListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/GetCompliances_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/ + * GetCompliances_example.json */ /** * Sample code: Get security compliance data over time. @@ -2715,7 +2610,9 @@ import com.azure.resourcemanager.security.models.ServicePrincipalProperties; */ public final class ConnectorsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/CreateUpdateGcpCredentialsConnectorSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * CreateUpdateGcpCredentialsConnectorSubscription_example.json */ /** * Sample code: gcpCredentials - Create a cloud account connector for a subscription. @@ -2743,7 +2640,9 @@ public final class ConnectorsCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/CreateUpdateAwsCredConnectorSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * CreateUpdateAwsCredConnectorSubscription_example.json */ /** * Sample code: AwsCred - Create a cloud account connector for a subscription. @@ -2768,7 +2667,9 @@ public final class ConnectorsCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/CreateUpdateAwsAssumeRoleConnectorSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * CreateUpdateAwsAssumeRoleConnectorSubscription_example.json */ /** * Sample code: AwsAssumeRole - Create a cloud account connector for a subscription. @@ -2802,7 +2703,9 @@ public final class ConnectorsCreateOrUpdateSamples { */ public final class ConnectorsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/DeleteConnectorSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * DeleteConnectorSubscription_example.json */ /** * Sample code: Delete a cloud account connector from a subscription. @@ -2824,7 +2727,9 @@ public final class ConnectorsDeleteSamples { */ public final class ConnectorsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/GetConnectorSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * GetConnectorSubscription_example.json */ /** * Sample code: Details of a specific cloud account connector. @@ -2846,7 +2751,9 @@ public final class ConnectorsGetSamples { */ public final class ConnectorsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/GetListConnectorSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/ + * GetListConnectorSubscription_example.json */ /** * Sample code: Get all cloud accounts connectors of a subscription. @@ -2871,7 +2778,9 @@ import com.azure.resourcemanager.security.models.SupportedCloudEnum; */ public final class CustomAssessmentAutomationsCreateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationCreate_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationCreate_example.json */ /** * Sample code: Create a Custom Assessment Automation. @@ -2902,7 +2811,9 @@ public final class CustomAssessmentAutomationsCreateSamples { */ public final class CustomAssessmentAutomationsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationDelete_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationDelete_example.json */ /** * Sample code: Delete a Custom Assessment Automation. @@ -2925,7 +2836,9 @@ public final class CustomAssessmentAutomationsDeleteSamples { */ public final class CustomAssessmentAutomationsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationGet_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationGet_example.json */ /** * Sample code: Get a Custom Assessment Automation. @@ -2948,7 +2861,9 @@ public final class CustomAssessmentAutomationsGetByResourceGroupSamples { */ public final class CustomAssessmentAutomationsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationListBySubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationListBySubscription_example.json */ /** * Sample code: List Custom Assessment Automations in a subscription. @@ -2970,7 +2885,9 @@ public final class CustomAssessmentAutomationsListSamples { */ public final class CustomAssessmentAutomationsListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationListByResourceGroup_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomAssessmentAutomations/customAssessmentAutomationListByResourceGroup_example.json */ /** * Sample code: List Custom Assessment Automations in a subscription and a resource group. @@ -2993,7 +2910,9 @@ public final class CustomAssessmentAutomationsListByResourceGroupSamples { */ public final class CustomEntityStoreAssignmentsCreateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentCreate_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentCreate_example.json */ /** * Sample code: Create a custom entity store assignment. @@ -3018,7 +2937,9 @@ public final class CustomEntityStoreAssignmentsCreateSamples { */ public final class CustomEntityStoreAssignmentsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentDelete_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentDelete_example.json */ /** * Sample code: Delete a custom entity store assignment. @@ -3041,7 +2962,9 @@ public final class CustomEntityStoreAssignmentsDeleteSamples { */ public final class CustomEntityStoreAssignmentsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentGet_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentGet_example.json */ /** * Sample code: Get a custom entity store assignment. @@ -3064,7 +2987,9 @@ public final class CustomEntityStoreAssignmentsGetByResourceGroupSamples { */ public final class CustomEntityStoreAssignmentsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentListBySubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentListBySubscription_example.json */ /** * Sample code: List custom entity store assignments in a subscription. @@ -3086,7 +3011,9 @@ public final class CustomEntityStoreAssignmentsListSamples { */ public final class CustomEntityStoreAssignmentsListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentListByResourceGroup_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/ + * CustomEntityStoreAssignments/customEntityStoreAssignmentListByResourceGroup_example.json */ /** * Sample code: List custom entity store assignments in a subscription and a resource group. @@ -3101,9 +3028,316 @@ public final class CustomEntityStoreAssignmentsListByResourceGroupSamples { } ``` +### CustomRecommendations_CreateOrUpdate + +```java +import com.azure.resourcemanager.security.models.RecommendationSupportedClouds; +import com.azure.resourcemanager.security.models.SecurityIssue; +import com.azure.resourcemanager.security.models.SeverityEnum; +import java.util.Arrays; + +/** + * Samples for CustomRecommendations CreateOrUpdate. + */ +public final class CustomRecommendationsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * PutBySecurityConnectorCustomRecommendation_example.json + */ + /** + * Sample code: Create or update custom recommendation over security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateCustomRecommendationOverSecurityConnectorScope( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .define("33e7cc6e-a139-4723-a0e5-76993aee0771") + .withExistingScope( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector") + .withQuery( + "RawEntityMetadata | where Environment == 'GCP' and Identifiers.Type == 'compute.firewalls' | extend IslogConfigEnabled = tobool(Record.logConfig.enable) | extend HealthStatus = iff(IslogConfigEnabled, 'HEALTHY', 'UNHEALTHY')") + .withCloudProviders(Arrays.asList(RecommendationSupportedClouds.AWS)) + .withSeverity(SeverityEnum.MEDIUM) + .withSecurityIssue(SecurityIssue.VULNERABILITY) + .withDisplayName("Password Policy") + .withDescription("organization passwords policy") + .withRemediationDescription("Change password policy to...") + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * PutBySubscriptionCustomRecommendation_example.json + */ + /** + * Sample code: Create or update custom recommendation over subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateCustomRecommendationOverSubscriptionScope( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .define("33e7cc6e-a139-4723-a0e5-76993aee0771") + .withExistingScope("subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b") + .withQuery( + "RawEntityMetadata | where Environment == 'GCP' and Identifiers.Type == 'compute.firewalls' | extend IslogConfigEnabled = tobool(Record.logConfig.enable) | extend HealthStatus = iff(IslogConfigEnabled, 'HEALTHY', 'UNHEALTHY')") + .withCloudProviders(Arrays.asList(RecommendationSupportedClouds.AWS)) + .withSeverity(SeverityEnum.MEDIUM) + .withSecurityIssue(SecurityIssue.VULNERABILITY) + .withDisplayName("Password Policy") + .withDescription("organization passwords policy") + .withRemediationDescription("Change password policy to...") + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * PutByManagementGroupCustomRecommendation_example.json + */ + /** + * Sample code: Create or update custom recommendation over management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateCustomRecommendationOverManagementGroupScope( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .define("33e7cc6e-a139-4723-a0e5-76993aee0771") + .withExistingScope("providers/Microsoft.Management/managementGroups/contoso") + .withQuery( + "RawEntityMetadata | where Environment == 'GCP' and Identifiers.Type == 'compute.firewalls' | extend IslogConfigEnabled = tobool(Record.logConfig.enable) | extend HealthStatus = iff(IslogConfigEnabled, 'HEALTHY', 'UNHEALTHY')") + .withCloudProviders(Arrays.asList(RecommendationSupportedClouds.AWS)) + .withSeverity(SeverityEnum.MEDIUM) + .withSecurityIssue(SecurityIssue.VULNERABILITY) + .withDisplayName("Password Policy") + .withDescription("organization passwords policy") + .withRemediationDescription("Change password policy to...") + .create(); + } +} +``` + +### CustomRecommendations_Delete + +```java +/** + * Samples for CustomRecommendations Delete. + */ +public final class CustomRecommendationsDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * DeleteBySecurityConnectorCustomRecommendation_example.json + */ + /** + * Sample code: Delete a custom recommendation over security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void deleteACustomRecommendationOverSecurityConnectorScope( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .deleteByResourceGroupWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * DeleteBySubscriptionCustomRecommendation_example.json + */ + /** + * Sample code: Delete a custom recommendation over subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + deleteACustomRecommendationOverSubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .deleteByResourceGroupWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "1f3afdf9-d0c9-4c3d-847f-89da613e70a8", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * DeleteByManagementGroupCustomRecommendation_example.json + */ + /** + * Sample code: Delete a custom recommendation over management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void deleteACustomRecommendationOverManagementGroupScope( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .deleteByResourceGroupWithResponse("providers/Microsoft.Management/managementGroups/contoso", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); + } +} +``` + +### CustomRecommendations_Get + +```java +/** + * Samples for CustomRecommendations Get. + */ +public final class CustomRecommendationsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * GetByManagementGroupCustomRecommendation_example.json + */ + /** + * Sample code: Get a custom recommendation over management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getACustomRecommendationOverManagementGroupScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .getWithResponse("providers/Microsoft.Management/managementGroups/contoso", + "1f3afdf9-d0c9-4c3d-847f-89da613e70a8", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * GetBySecurityConnectorCustomRecommendation_example.json + */ + /** + * Sample code: Get a custom recommendation over security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getACustomRecommendationOverSecurityConnectorScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + "1f3afdf9-d0c9-4c3d-847f-89da613e70a8", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * GetBySubscriptionCustomRecommendation_example.json + */ + /** + * Sample code: Get a custom recommendation over subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getACustomRecommendationOverSubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "1f3afdf9-d0c9-4c3d-847f-89da613e70a8", com.azure.core.util.Context.NONE); + } +} +``` + +### CustomRecommendations_List + +```java +/** + * Samples for CustomRecommendations List. + */ +public final class CustomRecommendationsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * ListByManagementGroupCustomRecommendations_example.json + */ + /** + * Sample code: List custom recommendations by management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listCustomRecommendationsByManagementGroupScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .list("providers/Microsoft.Management/managementGroups/contoso", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * ListBySubscriptionCustomRecommendations_example.json + */ + /** + * Sample code: List custom recommendations by subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listCustomRecommendationsBySubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/CustomRecommendations/ + * ListBySecurityConnectorCustomRecommendations_example.json + */ + /** + * Sample code: List custom recommendations by security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listCustomRecommendationsBySecurityConnectorScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.customRecommendations() + .list( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + com.azure.core.util.Context.NONE); + } +} +``` + +### DefenderForStorage_CancelMalwareScan + +```java +import com.azure.resourcemanager.security.models.SettingName; + +/** + * Samples for DefenderForStorage CancelMalwareScan. + */ +public final class DefenderForStorageCancelMalwareScanSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-10-01-preview/examples/DefenderForStorage + * /CancelMalwareScan_example.json + */ + /** + * Sample code: Cancel a Defender for Storage malware scan for the specified storage resource. + * + * @param manager Entry point to SecurityManager. + */ + public static void cancelADefenderForStorageMalwareScanForTheSpecifiedStorageResource( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.defenderForStorages() + .cancelMalwareScanWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + SettingName.CURRENT, "latest", com.azure.core.util.Context.NONE); + } +} +``` + ### DefenderForStorage_Create ```java +import com.azure.resourcemanager.security.models.DefenderForStorageSettingProperties; +import com.azure.resourcemanager.security.models.MalwareScanningProperties; +import com.azure.resourcemanager.security.models.OnUploadProperties; +import com.azure.resourcemanager.security.models.SensitiveDataDiscoveryProperties; import com.azure.resourcemanager.security.models.SettingName; /** @@ -3111,7 +3345,9 @@ import com.azure.resourcemanager.security.models.SettingName; */ public final class DefenderForStorageCreateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-12-01-preview/examples/DefenderForStorage/PutDefenderForStorageSettings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-10-01-preview/examples/DefenderForStorage + * /PutDefenderForStorageSettings_example.json */ /** * Sample code: Creates or updates the Defender for Storage settings on a specified resource. @@ -3124,13 +3360,13 @@ public final class DefenderForStorageCreateSamples { .define(SettingName.CURRENT) .withExistingResourceId( "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount") - .withIsEnabled(true) - .withOverrideSubscriptionLevelSettings(true) - .withScanResultsEventGridTopicResourceId( - "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic") - .withIsEnabledMalwareScanningIsEnabled(true) - .withCapGBPerMonth(-1) - .withIsEnabledSensitiveDataDiscoveryIsEnabled(true) + .withProperties(new DefenderForStorageSettingProperties().withIsEnabled(true) + .withMalwareScanning(new MalwareScanningProperties() + .withOnUpload(new OnUploadProperties().withIsEnabled(true).withCapGBPerMonth(-1)) + .withScanResultsEventGridTopicResourceId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic")) + .withSensitiveDataDiscovery(new SensitiveDataDiscoveryProperties().withIsEnabled(true)) + .withOverrideSubscriptionLevelSettings(true)) .create(); } } @@ -3146,7 +3382,9 @@ import com.azure.resourcemanager.security.models.SettingName; */ public final class DefenderForStorageGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-12-01-preview/examples/DefenderForStorage/GetDefenderForStorageSettings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-10-01-preview/examples/DefenderForStorage + * /GetDefenderForStorageSettings_example.json */ /** * Sample code: Gets the Defender for Storage settings for the specified resource. @@ -3163,6 +3401,64 @@ public final class DefenderForStorageGetSamples { } ``` +### DefenderForStorage_GetMalwareScan + +```java +import com.azure.resourcemanager.security.models.SettingName; + +/** + * Samples for DefenderForStorage GetMalwareScan. + */ +public final class DefenderForStorageGetMalwareScanSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-10-01-preview/examples/DefenderForStorage + * /GetMalwareScan_example.json + */ + /** + * Sample code: Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param manager Entry point to SecurityManager. + */ + public static void getsTheDefenderForStorageMalwareScanForTheSpecifiedStorageResource( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.defenderForStorages() + .getMalwareScanWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + SettingName.CURRENT, "latest", com.azure.core.util.Context.NONE); + } +} +``` + +### DefenderForStorage_StartMalwareScan + +```java +import com.azure.resourcemanager.security.models.SettingName; + +/** + * Samples for DefenderForStorage StartMalwareScan. + */ +public final class DefenderForStorageStartMalwareScanSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-10-01-preview/examples/DefenderForStorage + * /StartMalwareScan_example.json + */ + /** + * Sample code: Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param manager Entry point to SecurityManager. + */ + public static void initiateADefenderForStorageMalwareScanForTheSpecifiedStorageAccount( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.defenderForStorages() + .startMalwareScanWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", + SettingName.CURRENT, com.azure.core.util.Context.NONE); + } +} +``` + ### DevOpsConfigurations_CreateOrUpdate ```java @@ -3177,7 +3473,9 @@ import java.util.Arrays; */ public final class DevOpsConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardCurrentAndFuture_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardCurrentAndFuture_example.json */ /** * Sample code: CreateOrUpdate_DevOpsConfigurations_OnboardCurrentAndFuture. @@ -3195,7 +3493,9 @@ public final class DevOpsConfigurationsCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardCurrentOnly_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardCurrentOnly_example.json */ /** * Sample code: CreateOrUpdate_DevOpsConfigurations_OnboardCurrentOnly. @@ -3213,7 +3513,9 @@ public final class DevOpsConfigurationsCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardSelected_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/CreateOrUpdateDevOpsConfigurationsOnboardSelected_example.json */ /** * Sample code: CreateOrUpdate_DevOpsConfigurations_OnboardSelected. @@ -3241,7 +3543,9 @@ public final class DevOpsConfigurationsCreateOrUpdateSamples { */ public final class DevOpsConfigurationsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/DeleteDevOpsConfigurations_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/DeleteDevOpsConfigurations_example.json */ /** * Sample code: Delete_DevOpsConfigurations. @@ -3262,7 +3566,9 @@ public final class DevOpsConfigurationsDeleteSamples { */ public final class DevOpsConfigurationsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetDevOpsConfigurationsWithCapabilities_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetDevOpsConfigurationsWithCapabilities_example.json */ /** * Sample code: Get_DevOpsConfigurations_WithCapabilities. @@ -3276,7 +3582,9 @@ public final class DevOpsConfigurationsGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetDevOpsConfigurations_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetDevOpsConfigurations_example.json */ /** * Sample code: Get_DevOpsConfigurations. @@ -3298,7 +3606,9 @@ public final class DevOpsConfigurationsGetSamples { */ public final class DevOpsConfigurationsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListDevOpsConfigurations_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListDevOpsConfigurations_example.json */ /** * Sample code: List_DevOpsConfigurations. @@ -3323,7 +3633,9 @@ import com.azure.resourcemanager.security.models.DevOpsConfigurationProperties; */ public final class DevOpsConfigurationsUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/UpdateDevOpsConfigurations_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/UpdateDevOpsConfigurations_example.json */ /** * Sample code: Update_DevOpsConfigurations. @@ -3348,7 +3660,9 @@ public final class DevOpsConfigurationsUpdateSamples { */ public final class DevOpsOperationResultsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetDevOpsOperationResultsFailed_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetDevOpsOperationResultsFailed_example.json */ /** * Sample code: Get_DevOpsOperationResults_Failed. @@ -3362,7 +3676,9 @@ public final class DevOpsOperationResultsGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetDevOpsOperationResultsSucceeded_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetDevOpsOperationResultsSucceeded_example.json */ /** * Sample code: Get_DevOpsOperationResults_Succeeded. @@ -3377,6 +3693,207 @@ public final class DevOpsOperationResultsGetSamples { } ``` +### DevOpsPolicies_Get + +```java +/** + * Samples for DevOpsPolicies Get. + */ +public final class DevOpsPoliciesGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetDevOpsPolicies_example.json + */ + /** + * Sample code: Get_DevOpsPolicies. + * + * @param manager Entry point to SecurityManager. + */ + public static void getDevOpsPolicies(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsPolicies() + .getWithResponse("myRg", "mySecurityConnectorName", "myDevOpsPolicy", com.azure.core.util.Context.NONE); + } +} +``` + +### DevOpsPolicies_List + +```java +/** + * Samples for DevOpsPolicies List. + */ +public final class DevOpsPoliciesListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListDevOpsPolicies_example.json + */ + /** + * Sample code: List_DevOpsPolicies. + * + * @param manager Entry point to SecurityManager. + */ + public static void listDevOpsPolicies(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsPolicies().list("myRg", "mySecurityConnectorName", null, com.azure.core.util.Context.NONE); + } +} +``` + +### DevOpsPolicyAssignments_CreateOrUpdate + +```java +import com.azure.resourcemanager.security.models.DescendantBehavior; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignmentProperties; +import com.azure.resourcemanager.security.models.DevOpsPolicyDescriptor; +import com.azure.resourcemanager.security.models.DevOpsPolicyType; + +/** + * Samples for DevOpsPolicyAssignments CreateOrUpdate. + */ +public final class DevOpsPolicyAssignmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/CreateOrUpdateDevOpsPolicyAssignments_example.json + */ + /** + * Sample code: CreateOrUpdate_DevOpsPolicyAssignments. + * + * @param manager Entry point to SecurityManager. + */ + public static void + createOrUpdateDevOpsPolicyAssignments(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsPolicyAssignments() + .define("5ec87f43-62d8-437b-8f46-4c8d4032cf6d") + .withExistingSecurityConnector("myRg", "mySecurityConnectorName") + .withProperties(new DevOpsPolicyAssignmentProperties().withResourceId( + "/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourcegroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/Contoso") + .withDescendantBehavior(DescendantBehavior.OVERRIDE) + .withPolicy(new DevOpsPolicyDescriptor().withPolicyName("myDevOpsPolicy") + .withPolicyId("00000000-0000-0000-0000-000000000000") + .withPolicyVersion("1.0") + .withPolicyType(DevOpsPolicyType.PIPELINE))) + .create(); + } +} +``` + +### DevOpsPolicyAssignments_Delete + +```java +/** + * Samples for DevOpsPolicyAssignments Delete. + */ +public final class DevOpsPolicyAssignmentsDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/DeleteDevOpsPolicyAssignments_example.json + */ + /** + * Sample code: Delete_DevOpsPolicyAssignments. + * + * @param manager Entry point to SecurityManager. + */ + public static void deleteDevOpsPolicyAssignments(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsPolicyAssignments() + .delete("myRg", "mySecurityConnectorName", "5ec87f43-62d8-437b-8f46-4c8d4032cf6d", + com.azure.core.util.Context.NONE); + } +} +``` + +### DevOpsPolicyAssignments_Get + +```java +/** + * Samples for DevOpsPolicyAssignments Get. + */ +public final class DevOpsPolicyAssignmentsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetDevOpsPolicyAssignments_example.json + */ + /** + * Sample code: Get_DevOpsPolicyAssignments. + * + * @param manager Entry point to SecurityManager. + */ + public static void getDevOpsPolicyAssignments(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsPolicyAssignments() + .getWithResponse("myRg", "mySecurityConnectorName", "5ec87f43-62d8-437b-8f46-4c8d4032cf6d", + com.azure.core.util.Context.NONE); + } +} +``` + +### DevOpsPolicyAssignments_List + +```java +/** + * Samples for DevOpsPolicyAssignments List. + */ +public final class DevOpsPolicyAssignmentsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListDevOpsPolicyAssignments_example.json + */ + /** + * Sample code: List_DevOpsPolicyAssignments. + * + * @param manager Entry point to SecurityManager. + */ + public static void listDevOpsPolicyAssignments(com.azure.resourcemanager.security.SecurityManager manager) { + manager.devOpsPolicyAssignments() + .list("myRg", "mySecurityConnectorName", null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### DevOpsPolicyAssignments_Update + +```java +import com.azure.resourcemanager.security.models.DescendantBehavior; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignment; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignmentProperties; +import com.azure.resourcemanager.security.models.DevOpsPolicyDescriptor; +import com.azure.resourcemanager.security.models.DevOpsPolicyType; + +/** + * Samples for DevOpsPolicyAssignments Update. + */ +public final class DevOpsPolicyAssignmentsUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/UpdateDevOpsPolicyAssignments_example.json + */ + /** + * Sample code: Update_DevOpsPolicyAssignments. + * + * @param manager Entry point to SecurityManager. + */ + public static void updateDevOpsPolicyAssignments(com.azure.resourcemanager.security.SecurityManager manager) { + DevOpsPolicyAssignment resource = manager.devOpsPolicyAssignments() + .getWithResponse("myRg", "mySecurityConnectorName", "5ec87f43-62d8-437b-8f46-4c8d4032cf6d", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new DevOpsPolicyAssignmentProperties().withResourceId( + "/subscriptions/0806e1cd-cfda-4ff8-b99c-2b0af42cffd3/resourcegroups/myRg/providers/Microsoft.Security/securityConnectors/mySecurityConnectorName/devops/default/azureDevOpsOrgs/Contoso") + .withDescendantBehavior(DescendantBehavior.OVERRIDE) + .withPolicy(new DevOpsPolicyDescriptor().withPolicyName("myDevOpsPolicy") + .withPolicyId("00000000-0000-0000-0000-000000000000") + .withPolicyVersion("1.0") + .withPolicyType(DevOpsPolicyType.PIPELINE))) + .apply(); + } +} +``` + ### DeviceSecurityGroups_CreateOrUpdate ```java @@ -3389,7 +3906,9 @@ import java.util.Arrays; */ public final class DeviceSecurityGroupsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/PutDeviceSecurityGroups_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ + * PutDeviceSecurityGroups_example.json */ /** * Sample code: Create or update a device security group for the specified IoT hub resource. @@ -3419,7 +3938,9 @@ public final class DeviceSecurityGroupsCreateOrUpdateSamples { */ public final class DeviceSecurityGroupsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/DeleteDeviceSecurityGroups_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ + * DeleteDeviceSecurityGroups_example.json */ /** * Sample code: Delete a device security group for the specified IoT Hub resource. @@ -3444,7 +3965,9 @@ public final class DeviceSecurityGroupsDeleteSamples { */ public final class DeviceSecurityGroupsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/GetDeviceSecurityGroups_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ + * GetDeviceSecurityGroups_example.json */ /** * Sample code: Get a device security group for the specified IoT Hub resource. @@ -3469,7 +3992,9 @@ public final class DeviceSecurityGroupsGetSamples { */ public final class DeviceSecurityGroupsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ListDeviceSecurityGroups_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ + * ListDeviceSecurityGroups_example.json */ /** * Sample code: List all device security groups for the specified IoT Hub resource. @@ -3494,7 +4019,9 @@ public final class DeviceSecurityGroupsListSamples { */ public final class DiscoveredSecuritySolutionsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionResourceGroupLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions + * /GetDiscoveredSecuritySolutionResourceGroupLocation_example.json */ /** * Sample code: Get discovered security solution from a security data location. @@ -3517,7 +4044,9 @@ public final class DiscoveredSecuritySolutionsGetSamples { */ public final class DiscoveredSecuritySolutionsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionsSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions + * /GetDiscoveredSecuritySolutionsSubscription_example.json */ /** * Sample code: Get discovered security solutions. @@ -3538,7 +4067,9 @@ public final class DiscoveredSecuritySolutionsListSamples { */ public final class DiscoveredSecuritySolutionsListByHomeRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionsSubscriptionLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions + * /GetDiscoveredSecuritySolutionsSubscriptionLocation_example.json */ /** * Sample code: Get discovered security solutions from a security data location. @@ -3560,7 +4091,9 @@ public final class DiscoveredSecuritySolutionsListByHomeRegionSamples { */ public final class ExternalSecuritySolutionsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/GetExternalSecuritySolution_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/ + * GetExternalSecuritySolution_example.json */ /** * Sample code: Get external security solution. @@ -3583,7 +4116,9 @@ public final class ExternalSecuritySolutionsGetSamples { */ public final class ExternalSecuritySolutionsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/GetExternalSecuritySolutionsSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/ + * GetExternalSecuritySolutionsSubscription_example.json */ /** * Sample code: Get external security solutions on a subscription. @@ -3605,7 +4140,9 @@ public final class ExternalSecuritySolutionsListSamples { */ public final class ExternalSecuritySolutionsListByHomeRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/GetExternalSecuritySolutionsSubscriptionLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/ + * GetExternalSecuritySolutionsSubscriptionLocation_example.json */ /** * Sample code: Get external security solutions on a subscription from security data location. @@ -3627,7 +4164,9 @@ public final class ExternalSecuritySolutionsListByHomeRegionSamples { */ public final class GitHubOwnersGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetGitHubOwners_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetGitHubOwners_example.json */ /** * Sample code: Get_GitHubOwners. @@ -3649,7 +4188,9 @@ public final class GitHubOwnersGetSamples { */ public final class GitHubOwnersListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListGitHubOwners_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListGitHubOwners_example.json */ /** * Sample code: List_GitHubOwners. @@ -3670,7 +4211,9 @@ public final class GitHubOwnersListSamples { */ public final class GitHubOwnersListAvailableSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListAvailableGitHubOwners_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListAvailableGitHubOwners_example.json */ /** * Sample code: ListAvailable_GitHubOwners. @@ -3692,7 +4235,9 @@ public final class GitHubOwnersListAvailableSamples { */ public final class GitHubReposGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetGitHubRepos_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetGitHubRepos_example.json */ /** * Sample code: Get_GitHubRepos. @@ -3715,7 +4260,9 @@ public final class GitHubReposGetSamples { */ public final class GitHubReposListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListGitHubRepos_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListGitHubRepos_example.json */ /** * Sample code: List_GitHubRepos. @@ -3737,7 +4284,9 @@ public final class GitHubReposListSamples { */ public final class GitLabGroupsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetGitLabGroups_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetGitLabGroups_example.json */ /** * Sample code: Get_GitLabGroups. @@ -3760,7 +4309,9 @@ public final class GitLabGroupsGetSamples { */ public final class GitLabGroupsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListGitLabGroups_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListGitLabGroups_example.json */ /** * Sample code: List_GitLabGroups. @@ -3781,7 +4332,9 @@ public final class GitLabGroupsListSamples { */ public final class GitLabGroupsListAvailableSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListAvailableGitLabGroups_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListAvailableGitLabGroups_example.json */ /** * Sample code: ListAvailable_GitLabGroups. @@ -3803,7 +4356,9 @@ public final class GitLabGroupsListAvailableSamples { */ public final class GitLabProjectsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/GetGitLabProjects_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/GetGitLabProjects_example.json */ /** * Sample code: Get_GitLabProjects. @@ -3826,7 +4381,9 @@ public final class GitLabProjectsGetSamples { */ public final class GitLabProjectsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListGitLabProjects_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListGitLabProjects_example.json */ /** * Sample code: List_GitLabProjects. @@ -3848,7 +4405,9 @@ public final class GitLabProjectsListSamples { */ public final class GitLabSubgroupsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-04-01/examples/SecurityConnectorsDevOps/ListGitLabSubgroups_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-05-15-preview/examples/ + * SecurityConnectorsDevOps/ListGitLabSubgroups_example.json */ /** * Sample code: List_GitLabSubgroups. @@ -3875,7 +4434,9 @@ import java.time.OffsetDateTime; */ public final class GovernanceAssignmentsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceAssignments/PutGovernanceAssignment_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/ + * GovernanceAssignments/PutGovernanceAssignment_example.json */ /** * Sample code: Create Governance assignment. @@ -3912,7 +4473,9 @@ public final class GovernanceAssignmentsCreateOrUpdateSamples { */ public final class GovernanceAssignmentsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceAssignments/DeleteGovernanceAssignment_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/ + * GovernanceAssignments/DeleteGovernanceAssignment_example.json */ /** * Sample code: Delete security assignment. @@ -3937,7 +4500,9 @@ public final class GovernanceAssignmentsDeleteSamples { */ public final class GovernanceAssignmentsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceAssignments/GetGovernanceAssignment_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/ + * GovernanceAssignments/GetGovernanceAssignment_example.json */ /** * Sample code: Get governanceAssignment by specific governanceAssignmentKey. @@ -3963,7 +4528,9 @@ public final class GovernanceAssignmentsGetSamples { */ public final class GovernanceAssignmentsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceAssignments/ListGovernanceAssignments_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/ + * GovernanceAssignments/ListGovernanceAssignments_example.json */ /** * Sample code: List governance assignments. @@ -3996,7 +4563,9 @@ import java.util.Arrays; */ public final class GovernanceRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PutManagementGroupGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PutManagementGroupGovernanceRule_example.json */ /** * Sample code: Create or update governance rule over management group scope. @@ -4030,7 +4599,9 @@ public final class GovernanceRulesCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PutSecurityConnectorGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PutSecurityConnectorGovernanceRule_example.json */ /** * Sample code: Create or update governance rule over security connector scope. @@ -4064,7 +4635,9 @@ public final class GovernanceRulesCreateOrUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PutGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PutGovernanceRule_example.json */ /** * Sample code: Create or update governance rule over subscription scope. @@ -4106,7 +4679,9 @@ public final class GovernanceRulesCreateOrUpdateSamples { */ public final class GovernanceRulesDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/DeleteManagementGroupGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * DeleteManagementGroupGovernanceRule_example.json */ /** * Sample code: Delete a Governance rule over management group scope. @@ -4121,7 +4696,9 @@ public final class GovernanceRulesDeleteSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/DeleteGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * DeleteGovernanceRule_example.json */ /** * Sample code: Delete a Governance rule over subscription scope. @@ -4136,7 +4713,9 @@ public final class GovernanceRulesDeleteSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/DeleteSecurityConnectorGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * DeleteSecurityConnectorGovernanceRule_example.json */ /** * Sample code: Delete a Governance rule over security connector scope. @@ -4162,7 +4741,9 @@ public final class GovernanceRulesDeleteSamples { */ public final class GovernanceRulesExecuteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PostSecurityConnectorGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PostSecurityConnectorGovernanceRule_example.json */ /** * Sample code: Execute governance rule over security connector scope. @@ -4178,7 +4759,9 @@ public final class GovernanceRulesExecuteSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PostGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PostGovernanceRule_example.json */ /** * Sample code: Execute Governance rule over subscription scope. @@ -4193,7 +4776,9 @@ public final class GovernanceRulesExecuteSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/PostManagementGroupGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * PostManagementGroupGovernanceRule_example.json */ /** * Sample code: Execute governance rule over management group scope. @@ -4217,7 +4802,9 @@ public final class GovernanceRulesExecuteSamples { */ public final class GovernanceRulesGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetManagementGroupGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetManagementGroupGovernanceRule_example.json */ /** * Sample code: Get a governance rule over management group scope. @@ -4232,7 +4819,9 @@ public final class GovernanceRulesGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetGovernanceRule_example.json */ /** * Sample code: Get a governance rule over subscription scope. @@ -4247,7 +4836,9 @@ public final class GovernanceRulesGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetSecurityConnectorGovernanceRule_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetSecurityConnectorGovernanceRule_example.json */ /** * Sample code: Get a governance rule over security connector scope. @@ -4272,7 +4863,9 @@ public final class GovernanceRulesGetSamples { */ public final class GovernanceRulesListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ListBySubscriptionGovernanceRules_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * ListBySubscriptionGovernanceRules_example.json */ /** * Sample code: List governance rules by subscription scope. @@ -4286,7 +4879,9 @@ public final class GovernanceRulesListSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ListBySecurityConnectorGovernanceRules_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * ListBySecurityConnectorGovernanceRules_example.json */ /** * Sample code: List governance rules by security connector scope. @@ -4302,7 +4897,9 @@ public final class GovernanceRulesListSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ListByManagementGroupGovernanceRules_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * ListByManagementGroupGovernanceRules_example.json */ /** * Sample code: List governance rules by management group scope. @@ -4325,7 +4922,9 @@ public final class GovernanceRulesListSamples { */ public final class GovernanceRulesOperationResultsSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetManagementGroupGovernanceRuleExecuteStatus_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetManagementGroupGovernanceRuleExecuteStatus_example.json */ /** * Sample code: Get governance rules long run operation result over management group. @@ -4341,7 +4940,9 @@ public final class GovernanceRulesOperationResultsSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetSecurityConnectorGovernanceRuleExecuteStatus_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetSecurityConnectorGovernanceRuleExecuteStatus_example.json */ /** * Sample code: Get governance rules long run operation result over security connector. @@ -4358,7 +4959,9 @@ public final class GovernanceRulesOperationResultsSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/GetGovernanceRuleExecuteStatus_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-01-01-preview/examples/GovernanceRules/ + * GetGovernanceRuleExecuteStatus_example.json */ /** * Sample code: Get governance rules long run operation result over subscription. @@ -4383,7 +4986,9 @@ public final class GovernanceRulesOperationResultsSamples { */ public final class HealthReportsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-05-01-preview/examples/HealthReports/GetHealthReports_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-05-01-preview/examples/HealthReports/ + * GetHealthReports_example.json */ /** * Sample code: Get health report of resource. @@ -4407,7 +5012,9 @@ public final class HealthReportsGetSamples { */ public final class HealthReportsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-05-01-preview/examples/HealthReports/ListHealthReports_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-05-01-preview/examples/HealthReports/ + * ListHealthReports_example.json */ /** * Sample code: List health reports. @@ -4438,7 +5045,9 @@ import java.util.UUID; */ public final class InformationProtectionPoliciesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/CreateOrUpdateInformationProtectionPolicy_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * InformationProtectionPolicies/CreateOrUpdateInformationProtectionPolicy_example.json */ /** * Sample code: Create or update an information protection policy for a management group. @@ -4501,7 +5110,9 @@ import com.azure.resourcemanager.security.models.InformationProtectionPolicyName */ public final class InformationProtectionPoliciesGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/GetCustomInformationProtectionPolicy_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * InformationProtectionPolicies/GetCustomInformationProtectionPolicy_example.json */ /** * Sample code: Get the customized information protection policy for a management group. @@ -4516,7 +5127,9 @@ public final class InformationProtectionPoliciesGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/GetEffectiveInformationProtectionPolicy_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * InformationProtectionPolicies/GetEffectiveInformationProtectionPolicy_example.json */ /** * Sample code: Get the effective information protection policy for a management group. @@ -4540,7 +5153,9 @@ public final class InformationProtectionPoliciesGetSamples { */ public final class InformationProtectionPoliciesListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/ListInformationProtectionPolicies_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/ + * InformationProtectionPolicies/ListInformationProtectionPolicies_example.json */ /** * Sample code: Get information protection policies. @@ -4573,7 +5188,9 @@ import java.util.Map; */ public final class IotSecuritySolutionCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/CreateIoTSecuritySolution.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * CreateIoTSecuritySolution.json */ /** * Sample code: Create or update a IoT security solution. @@ -4629,7 +5246,9 @@ public final class IotSecuritySolutionCreateOrUpdateSamples { */ public final class IotSecuritySolutionDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/DeleteIoTSecuritySolution.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * DeleteIoTSecuritySolution.json */ /** * Sample code: Delete an IoT security solution. @@ -4651,7 +5270,9 @@ public final class IotSecuritySolutionDeleteSamples { */ public final class IotSecuritySolutionGetByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolution.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * GetIoTSecuritySolution.json */ /** * Sample code: Get a IoT security solution. @@ -4673,7 +5294,9 @@ public final class IotSecuritySolutionGetByResourceGroupSamples { */ public final class IotSecuritySolutionListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsList.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * GetIoTSecuritySolutionsList.json */ /** * Sample code: List IoT Security solutions by subscription. @@ -4686,7 +5309,9 @@ public final class IotSecuritySolutionListSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsListByIotHub.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * GetIoTSecuritySolutionsListByIotHub.json */ /** * Sample code: List IoT Security solutions by IoT Hub. @@ -4710,7 +5335,9 @@ public final class IotSecuritySolutionListSamples { */ public final class IotSecuritySolutionListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsListByIotHubAndRg.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * GetIoTSecuritySolutionsListByIotHubAndRg.json */ /** * Sample code: List IoT Security solutions by resource group and IoT Hub. @@ -4726,7 +5353,9 @@ public final class IotSecuritySolutionListByResourceGroupSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsListByRg.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * GetIoTSecuritySolutionsListByRg.json */ /** * Sample code: List IoT Security solutions by resource group. @@ -4757,7 +5386,9 @@ import java.util.Map; */ public final class IotSecuritySolutionUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/UpdateIoTSecuritySolution.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/ + * UpdateIoTSecuritySolution.json */ /** * Sample code: Use this method to update existing IoT Security solution. @@ -4805,7 +5436,8 @@ public final class IotSecuritySolutionUpdateSamples { */ public final class IotSecuritySolutionAnalyticsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalytics.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalytics.json */ /** * Sample code: Get Security Solution Analytics. @@ -4826,7 +5458,8 @@ public final class IotSecuritySolutionAnalyticsGetSamples { */ public final class IotSecuritySolutionAnalyticsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalyticsList.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalyticsList.json */ /** * Sample code: Get Security Solution Analytics. @@ -4847,7 +5480,8 @@ public final class IotSecuritySolutionAnalyticsListSamples { */ public final class IotSecuritySolutionsAnalyticsAggregatedAlertDismissSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/PostIoTSecuritySolutionsSecurityAggregatedAlertDismiss.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/PostIoTSecuritySolutionsSecurityAggregatedAlertDismiss.json */ /** * Sample code: Dismiss an aggregated IoT Security Solution Alert. @@ -4871,7 +5505,8 @@ public final class IotSecuritySolutionsAnalyticsAggregatedAlertDismissSamples { */ public final class IotSecuritySolutionsAnalyticsAggregatedAlertGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlert.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlert.json */ /** * Sample code: Get the aggregated security analytics alert of yours IoT Security solution. This aggregation is @@ -4896,7 +5531,8 @@ public final class IotSecuritySolutionsAnalyticsAggregatedAlertGetSamples { */ public final class IotSecuritySolutionsAnalyticsAggregatedAlertListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlertList.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlertList.json */ /** * Sample code: Get the aggregated alert list of yours IoT Security solution. @@ -4919,7 +5555,8 @@ public final class IotSecuritySolutionsAnalyticsAggregatedAlertListSamples { */ public final class IotSecuritySolutionsAnalyticsRecommendationGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendation.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendation.json */ /** * Sample code: Get the aggregated security analytics recommendation of yours IoT Security solution. @@ -4942,7 +5579,8 @@ public final class IotSecuritySolutionsAnalyticsRecommendationGetSamples { */ public final class IotSecuritySolutionsAnalyticsRecommendationListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendationList.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/ + * IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendationList.json */ /** * Sample code: Get the list of aggregated security analytics recommendations of yours IoT Security solution. @@ -4976,7 +5614,9 @@ import java.util.Arrays; */ public final class JitNetworkAccessPoliciesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/CreateJitNetworkAccessPolicy_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * CreateJitNetworkAccessPolicy_example.json */ /** * Sample code: Create JIT network access policy. @@ -5022,7 +5662,9 @@ public final class JitNetworkAccessPoliciesCreateOrUpdateSamples { */ public final class JitNetworkAccessPoliciesDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/DeleteJitNetworkAccessPolicy_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * DeleteJitNetworkAccessPolicy_example.json */ /** * Sample code: Delete a JIT network access policy. @@ -5044,7 +5686,9 @@ public final class JitNetworkAccessPoliciesDeleteSamples { */ public final class JitNetworkAccessPoliciesGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPolicy_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * GetJitNetworkAccessPolicy_example.json */ /** * Sample code: Get JIT network access policy. @@ -5071,7 +5715,9 @@ import java.util.Arrays; */ public final class JitNetworkAccessPoliciesInitiateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/InitiateJitNetworkAccessPolicy_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * InitiateJitNetworkAccessPolicy_example.json */ /** * Sample code: Initiate an action on a JIT network access policy. @@ -5099,7 +5745,9 @@ public final class JitNetworkAccessPoliciesInitiateSamples { */ public final class JitNetworkAccessPoliciesListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * GetJitNetworkAccessPoliciesSubscription_example.json */ /** * Sample code: Get JIT network access policies on a subscription. @@ -5121,7 +5769,9 @@ public final class JitNetworkAccessPoliciesListSamples { */ public final class JitNetworkAccessPoliciesListByRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesSubscriptionLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * GetJitNetworkAccessPoliciesSubscriptionLocation_example.json */ /** * Sample code: Get JIT network access policies on a subscription from a security data location. @@ -5143,7 +5793,9 @@ public final class JitNetworkAccessPoliciesListByRegionSamples { */ public final class JitNetworkAccessPoliciesListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesResourceGroup_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * GetJitNetworkAccessPoliciesResourceGroup_example.json */ /** * Sample code: Get JIT network access policies on a resource group. @@ -5165,7 +5817,9 @@ public final class JitNetworkAccessPoliciesListByResourceGroupSamples { */ public final class JitNetworkAccessPoliciesListByResourceGroupAndRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesResourceGroupLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/ + * GetJitNetworkAccessPoliciesResourceGroupLocation_example.json */ /** * Sample code: Get JIT network access policies on a resource group from a security data location. @@ -5188,7 +5842,9 @@ public final class JitNetworkAccessPoliciesListByResourceGroupAndRegionSamples { */ public final class LocationsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/GetLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/ + * GetLocation_example.json */ /** * Sample code: Get security data location. @@ -5209,7 +5865,9 @@ public final class LocationsGetSamples { */ public final class LocationsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/GetLocations_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/ + * GetLocations_example.json */ /** * Sample code: Get security data locations. @@ -5230,7 +5888,9 @@ public final class LocationsListSamples { */ public final class MdeOnboardingsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/GetMdeOnboardings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/ + * GetMdeOnboardings_example.json */ /** * Sample code: The default configuration or data needed to onboard the machine to MDE. @@ -5252,7 +5912,9 @@ public final class MdeOnboardingsGetSamples { */ public final class MdeOnboardingsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/ListMdeOnboardings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/ + * ListMdeOnboardings_example.json */ /** * Sample code: The configuration or data needed to onboard the machine to MDE. @@ -5266,6 +5928,30 @@ public final class MdeOnboardingsListSamples { } ``` +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-10-01-preview/examples/Operations/ + * ListOperations_example.json + */ + /** + * Sample code: List the operations for the Microsoft.Security (Microsoft Defender for Cloud) resource provider. + * + * @param manager Entry point to SecurityManager. + */ + public static void listTheOperationsForTheMicrosoftSecurityMicrosoftDefenderForCloudResourceProvider( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + ### Pricings_Delete ```java @@ -5274,7 +5960,9 @@ public final class MdeOnboardingsListSamples { */ public final class PricingsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/DeleteResourcePricing_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * DeleteResourcePricing_example.json */ /** * Sample code: Delete a pricing on resource. @@ -5298,7 +5986,9 @@ public final class PricingsDeleteSamples { */ public final class PricingsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetResourcePricingByNameVirtualMachines_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * GetResourcePricingByNameVirtualMachines_example.json */ /** * Sample code: Get pricings on resource - VirtualMachines plan. @@ -5314,7 +6004,9 @@ public final class PricingsGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameCloudPosture_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * GetPricingByNameCloudPosture_example.json */ /** * Sample code: Get pricings on subscription - CloudPosture plan. @@ -5329,7 +6021,9 @@ public final class PricingsGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameDns_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * GetPricingByNameDns_example.json */ /** * Sample code: Get pricings on subscription - Dns plan. @@ -5343,7 +6037,9 @@ public final class PricingsGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameContainers_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * GetPricingByNameContainers_example.json */ /** * Sample code: Get pricings on subscription - Containers plan. @@ -5358,7 +6054,9 @@ public final class PricingsGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameStorageAccounts_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * GetPricingByNameStorageAccounts_example.json */ /** * Sample code: Get pricings on subscription - StorageAccounts plan. @@ -5373,7 +6071,9 @@ public final class PricingsGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/GetPricingByNameVirtualMachines_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * GetPricingByNameVirtualMachines_example.json */ /** * Sample code: Get pricings on subscription - VirtualMachines plan. @@ -5397,7 +6097,9 @@ public final class PricingsGetSamples { */ public final class PricingsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ListPricingsWithPlanFilter_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * ListPricingsWithPlanFilter_example.json */ /** * Sample code: Get pricings on subscription with plans filter. @@ -5412,7 +6114,9 @@ public final class PricingsListSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ListPricings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * ListPricings_example.json */ /** * Sample code: Get pricings on subscription. @@ -5426,7 +6130,9 @@ public final class PricingsListSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ListResourcePricings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * ListResourcePricings_example.json */ /** * Sample code: Get pricings on resource. @@ -5454,7 +6160,9 @@ import com.azure.resourcemanager.security.models.PricingTier; */ public final class PricingsUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/PutPricingByName_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * PutPricingByName_example.json */ /** * Sample code: Update pricing on subscription (example for CloudPosture plan). @@ -5469,7 +6177,9 @@ public final class PricingsUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/PutPricingByNamePartialSuccess_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * PutPricingByNamePartialSuccess_example.json */ /** * Sample code: Update pricing on subscription (example for CloudPosture plan) - partial success. @@ -5484,7 +6194,9 @@ public final class PricingsUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/PutPricingVMsByName_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * PutPricingVMsByName_example.json */ /** * Sample code: Update pricing on subscription (example for VirtualMachines plan). @@ -5500,7 +6212,9 @@ public final class PricingsUpdateSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/PutResourcePricingByNameVirtualMachines_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-01-01/examples/Pricings/ + * PutResourcePricingByNameVirtualMachines_example.json */ /** * Sample code: Update pricing on resource (example for VirtualMachines plan). @@ -5526,7 +6240,9 @@ public final class PricingsUpdateSamples { */ public final class RegulatoryComplianceAssessmentsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceAssessment_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceAssessment_example.json */ /** * Sample code: Get selected regulatory compliance assessment details and state. @@ -5550,7 +6266,9 @@ public final class RegulatoryComplianceAssessmentsGetSamples { */ public final class RegulatoryComplianceAssessmentsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceAssessmentList_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceAssessmentList_example.json */ /** * Sample code: Get all assessments mapped to selected regulatory compliance control. @@ -5572,7 +6290,9 @@ public final class RegulatoryComplianceAssessmentsListSamples { */ public final class RegulatoryComplianceControlsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceControl_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceControl_example.json */ /** * Sample code: Get selected regulatory compliance control details and state. @@ -5594,7 +6314,9 @@ public final class RegulatoryComplianceControlsGetSamples { */ public final class RegulatoryComplianceControlsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceControlList_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceControlList_example.json */ /** * Sample code: Get all regulatory compliance controls details and state for selected standard. @@ -5616,7 +6338,9 @@ public final class RegulatoryComplianceControlsListSamples { */ public final class RegulatoryComplianceStandardsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceStandard_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceStandard_example.json */ /** * Sample code: Get selected regulatory compliance standard details and state. @@ -5638,7 +6362,9 @@ public final class RegulatoryComplianceStandardsGetSamples { */ public final class RegulatoryComplianceStandardsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceStandardList_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/ + * RegulatoryCompliance/getRegulatoryComplianceStandardList_example.json */ /** * Sample code: Get all supported regulatory compliance standards details and state. @@ -5660,7 +6386,8 @@ public final class RegulatoryComplianceStandardsListSamples { */ public final class SecureScoreControlDefinitionsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScoreControlDefinitions/ListSecureScoreControlDefinitions_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * secureScoreControlDefinitions/ListSecureScoreControlDefinitions_example.json */ /** * Sample code: List security controls definition. @@ -5681,7 +6408,8 @@ public final class SecureScoreControlDefinitionsListSamples { */ public final class SecureScoreControlDefinitionsListBySubscriptionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScoreControlDefinitions/ListSecureScoreControlDefinitions_subscription_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * secureScoreControlDefinitions/ListSecureScoreControlDefinitions_subscription_example.json */ /** * Sample code: List security controls definition by subscription. @@ -5704,7 +6432,9 @@ public final class SecureScoreControlDefinitionsListBySubscriptionSamples { */ public final class SecureScoreControlsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ListSecureScoreControls_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ + * ListSecureScoreControls_example.json */ /** * Sample code: List all secure scores controls. @@ -5727,7 +6457,9 @@ import com.azure.resourcemanager.security.models.ExpandControlsEnum; */ public final class SecureScoreControlsListBySecureScoreSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ListSecureScoreControlsForNameWithExpand_builtin_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ + * ListSecureScoreControlsForNameWithExpand_builtin_example.json */ /** * Sample code: Get security controls and their current score for the specified initiative with the expand @@ -5742,7 +6474,9 @@ public final class SecureScoreControlsListBySecureScoreSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ListSecureScoreControlsForName_builtin_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ + * ListSecureScoreControlsForName_builtin_example.json */ /** * Sample code: Get security controls and their current score for the specified initiative. @@ -5764,7 +6498,9 @@ public final class SecureScoreControlsListBySecureScoreSamples { */ public final class SecureScoresGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/GetSecureScoresSingle_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ + * GetSecureScoresSingle_example.json */ /** * Sample code: Get single secure score. @@ -5785,7 +6521,9 @@ public final class SecureScoresGetSamples { */ public final class SecureScoresListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ListSecureScores_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ + * ListSecureScores_example.json */ /** * Sample code: List secure scores. @@ -5813,7 +6551,9 @@ import java.util.Arrays; */ public final class SecurityConnectorApplicationOperationCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/PutSecurityConnectorApplication_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * PutSecurityConnectorApplication_example.json */ /** * Sample code: Create Application. @@ -5844,7 +6584,9 @@ public final class SecurityConnectorApplicationOperationCreateOrUpdateSamples { */ public final class SecurityConnectorApplicationOperationDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/DeleteSecurityConnectorApplication_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * DeleteSecurityConnectorApplication_example.json */ /** * Sample code: Delete security Application. @@ -5867,7 +6609,9 @@ public final class SecurityConnectorApplicationOperationDeleteSamples { */ public final class SecurityConnectorApplicationOperationGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/GetSecurityConnectorApplication_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * GetSecurityConnectorApplication_example.json */ /** * Sample code: Get security applications by specific applicationId. @@ -5891,7 +6635,9 @@ public final class SecurityConnectorApplicationOperationGetSamples { */ public final class SecurityConnectorApplicationsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ListBySecurityConnectorApplications_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2022-07-01-preview/examples/Applications/ + * ListBySecurityConnectorApplications_example.json */ /** * Sample code: List security applications by security connector level scope. @@ -5922,7 +6668,9 @@ import java.util.Map; */ public final class SecurityConnectorsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2024-03-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /PutSecurityConnector_example.json */ /** * Sample code: Create or update a security connector. @@ -5966,7 +6714,9 @@ public final class SecurityConnectorsCreateOrUpdateSamples { */ public final class SecurityConnectorsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2024-03-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /DeleteSecurityConnector_example.json */ /** * Sample code: Delete a security connector. @@ -5988,7 +6738,9 @@ public final class SecurityConnectorsDeleteSamples { */ public final class SecurityConnectorsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2024-03-01-preview/examples/SecurityConnectors/GetSecurityConnectorSingleResource_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /GetSecurityConnectorSingleResource_example.json */ /** * Sample code: Retrieve a security connector. @@ -6011,7 +6763,9 @@ public final class SecurityConnectorsGetByResourceGroupSamples { */ public final class SecurityConnectorsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2024-03-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /GetSecurityConnectorsSubscription_example.json */ /** * Sample code: List all security connectors of a specified subscription. @@ -6033,7 +6787,9 @@ public final class SecurityConnectorsListSamples { */ public final class SecurityConnectorsListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2024-03-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /GetSecurityConnectorsResourceGroup_example.json */ /** * Sample code: List all security connectors of a specified resource group. @@ -6064,7 +6820,9 @@ import java.util.Map; */ public final class SecurityConnectorsUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2024-03-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2024-08-01-preview/examples/SecurityConnectors + * /PatchSecurityConnector_example.json */ /** * Sample code: Update a security connector. @@ -6119,7 +6877,9 @@ import java.util.Arrays; */ public final class SecurityContactsCreateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/CreateSecurityContact_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/ + * CreateSecurityContact_example.json */ /** * Sample code: Create security contact data. @@ -6153,7 +6913,9 @@ import com.azure.resourcemanager.security.models.SecurityContactName; */ public final class SecurityContactsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/DeleteSecurityContact_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/ + * DeleteSecurityContact_example.json */ /** * Sample code: Deletes a security contact data. @@ -6176,7 +6938,9 @@ import com.azure.resourcemanager.security.models.SecurityContactName; */ public final class SecurityContactsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/GetSecurityContact_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/ + * GetSecurityContact_example.json */ /** * Sample code: Get a security contact. @@ -6197,7 +6961,9 @@ public final class SecurityContactsGetSamples { */ public final class SecurityContactsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/GetSecurityContactsSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-12-01-preview/examples/SecurityContacts/ + * GetSecurityContactsSubscription_example.json */ /** * Sample code: List security contact data. @@ -6218,7 +6984,9 @@ public final class SecurityContactsListSamples { */ public final class SecurityOperatorsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/PutSecurityOperatorByName_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ + * PutSecurityOperatorByName_example.json */ /** * Sample code: Create a security operator on the given scope. @@ -6242,7 +7010,9 @@ public final class SecurityOperatorsCreateOrUpdateSamples { */ public final class SecurityOperatorsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/DeleteSecurityOperatorByName_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ + * DeleteSecurityOperatorByName_example.json */ /** * Sample code: Delete SecurityOperator on subscription. @@ -6266,7 +7036,9 @@ public final class SecurityOperatorsDeleteSamples { */ public final class SecurityOperatorsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/GetSecurityOperatorByName_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ + * GetSecurityOperatorByName_example.json */ /** * Sample code: Get a specific security operator by scope and securityOperatorName. @@ -6289,7 +7061,9 @@ public final class SecurityOperatorsGetSamples { */ public final class SecurityOperatorsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ListSecurityOperators_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-01-01-preview/examples/SecurityOperators/ + * ListSecurityOperators_example.json */ /** * Sample code: List SecurityOperators. @@ -6310,7 +7084,9 @@ public final class SecurityOperatorsListSamples { */ public final class SecuritySolutionsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/GetSecuritySolutionsResourceGroupLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/ + * GetSecuritySolutionsResourceGroupLocation_example.json */ /** * Sample code: Get a security solution from a security data location. @@ -6333,7 +7109,9 @@ public final class SecuritySolutionsGetSamples { */ public final class SecuritySolutionsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/GetSecuritySolutionsSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/ + * GetSecuritySolutionsSubscription_example.json */ /** * Sample code: Get security solutions. @@ -6354,7 +7132,8 @@ public final class SecuritySolutionsListSamples { */ public final class SecuritySolutionsReferenceDataListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscription_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscription_example.json */ /** * Sample code: Get security solutions. @@ -6375,7 +7154,8 @@ public final class SecuritySolutionsReferenceDataListSamples { */ public final class SecuritySolutionsReferenceDataListByHomeRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscriptionLocation_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscriptionLocation_example.json */ /** * Sample code: Get security solutions from a security data location. @@ -6390,6 +7170,274 @@ public final class SecuritySolutionsReferenceDataListByHomeRegionSamples { } ``` +### SecurityStandards_CreateOrUpdate + +```java +import com.azure.resourcemanager.security.models.PartialAssessmentProperties; +import com.azure.resourcemanager.security.models.StandardSupportedCloud; +import java.util.Arrays; + +/** + * Samples for SecurityStandards CreateOrUpdate. + */ +public final class SecurityStandardsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * PutBySubscriptionSecurityStandard_example.json + */ + /** + * Sample code: Create or update security standard over subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateSecurityStandardOverSubscriptionScope( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .define("8bb8be0a-6010-4789-812f-e4d661c4ed0e") + .withExistingScope("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23") + .withDisplayName("Azure Test Security Standard 1") + .withDescription("description of Azure Test Security Standard 1") + .withAssessments(Arrays.asList(new PartialAssessmentProperties().withAssessmentKey("fakeTokenPlaceholder"), + new PartialAssessmentProperties().withAssessmentKey("fakeTokenPlaceholder"))) + .withCloudProviders(Arrays.asList(StandardSupportedCloud.GCP)) + .withPolicySetDefinitionId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Authorization/policySetDefinitions/patchorchestration-applicationversions") + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * PutBySecurityConnectorSecurityStandard_example.json + */ + /** + * Sample code: Create or update security standard over security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateSecurityStandardOverSecurityConnectorScope( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .define("8bb8be0a-6010-4789-812f-e4d661c4ed0e") + .withExistingScope( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector") + .withDisplayName("Azure Test Security Standard 1") + .withDescription("description of Azure Test Security Standard 1") + .withAssessments(Arrays.asList(new PartialAssessmentProperties().withAssessmentKey("fakeTokenPlaceholder"), + new PartialAssessmentProperties().withAssessmentKey("fakeTokenPlaceholder"))) + .withCloudProviders(Arrays.asList(StandardSupportedCloud.GCP)) + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * PutByManagementGroupSecurityStandard_example.json + */ + /** + * Sample code: Create or update security standard over management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void createOrUpdateSecurityStandardOverManagementGroupScope( + com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .define("8bb8be0a-6010-4789-812f-e4d661c4ed0e") + .withExistingScope("providers/Microsoft.Management/managementGroups/contoso") + .withDisplayName("Azure Test Security Standard 1") + .withDescription("description of Azure Test Security Standard 1") + .withAssessments(Arrays.asList(new PartialAssessmentProperties().withAssessmentKey("fakeTokenPlaceholder"), + new PartialAssessmentProperties().withAssessmentKey("fakeTokenPlaceholder"))) + .withCloudProviders(Arrays.asList(StandardSupportedCloud.GCP)) + .withPolicySetDefinitionId( + "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Authorization/policySetDefinitions/patchorchestration-applicationversions") + .create(); + } +} +``` + +### SecurityStandards_Delete + +```java +/** + * Samples for SecurityStandards Delete. + */ +public final class SecurityStandardsDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * DeleteBySecurityConnectorSecurityStandard_example.json + */ + /** + * Sample code: Delete a security standard over security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + deleteASecurityStandardOverSecurityConnectorScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .deleteByResourceGroupWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * DeleteByManagementGroupSecurityStandard_example.json + */ + /** + * Sample code: Delete a security standard over management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + deleteASecurityStandardOverManagementGroupScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .deleteByResourceGroupWithResponse("providers/Microsoft.Management/managementGroups/contoso", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * DeleteBySubscriptionSecurityStandard_example.json + */ + /** + * Sample code: Delete a security standard over subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + deleteASecurityStandardOverSubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .deleteByResourceGroupWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityStandards_Get + +```java +/** + * Samples for SecurityStandards Get. + */ +public final class SecurityStandardsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * GetBySecurityConnectorSecurityStandard_example.json + */ + /** + * Sample code: Get a security standard over security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getASecurityStandardOverSecurityConnectorScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .getWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + "1f3afdf9-d0c9-4c3d-847f-89da613e70a8", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * GetByManagementGroupSecurityStandard_example.json + */ + /** + * Sample code: Get a security standard over management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getASecurityStandardOverManagementGroupScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .getWithResponse("providers/Microsoft.Management/managementGroups/contoso", + "1f3afdf9-d0c9-4c3d-847f-89da613e70a8", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * GetBySubscriptionSecurityStandard_example.json + */ + /** + * Sample code: Get a security standard over subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + getASecurityStandardOverSubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .getWithResponse("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "1f3afdf9-d0c9-4c3d-847f-89da613e70a8", com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityStandards_List + +```java +/** + * Samples for SecurityStandards List. + */ +public final class SecurityStandardsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * ListByManagementGroupSecurityStandards_example.json + */ + /** + * Sample code: List security standards by management group scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listSecurityStandardsByManagementGroupScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .list("providers/Microsoft.Management/managementGroups/contoso", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * ListBySubscriptionSecurityStandards_example.json + */ + /** + * Sample code: List security standards by subscription scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listSecurityStandardsBySubscriptionScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .list("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/SecurityStandards/ + * ListBySecurityConnectorSecurityStandards_example.json + */ + /** + * Sample code: List security standards by security connector scope. + * + * @param manager Entry point to SecurityManager. + */ + public static void + listSecurityStandardsBySecurityConnectorScope(com.azure.resourcemanager.security.SecurityManager manager) { + manager.securityStandards() + .list( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + com.azure.core.util.Context.NONE); + } +} +``` + ### SensitivitySettings_CreateOrUpdate ```java @@ -6402,7 +7450,9 @@ import java.util.UUID; */ public final class SensitivitySettingsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/SensitivitySettings/PutSensitivitySettings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/ + * SensitivitySettings/PutSensitivitySettings_example.json */ /** * Sample code: Update sensitivity settings. @@ -6431,7 +7481,9 @@ public final class SensitivitySettingsCreateOrUpdateSamples { */ public final class SensitivitySettingsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/SensitivitySettings/GetSensitivitySettings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/ + * SensitivitySettings/GetSensitivitySettings_example.json */ /** * Sample code: Get sensitivity settings. @@ -6452,7 +7504,9 @@ public final class SensitivitySettingsGetSamples { */ public final class SensitivitySettingsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/SensitivitySettings/GetSensitivitySettingsList_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-15-preview/examples/ + * SensitivitySettings/GetSensitivitySettingsList_example.json */ /** * Sample code: Get sensitivity settings list. @@ -6473,7 +7527,8 @@ public final class SensitivitySettingsListSamples { */ public final class ServerVulnerabilityAssessmentCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/CreateServerVulnerabilityAssessments_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * ServerVulnerabilityAssessments/CreateServerVulnerabilityAssessments_example.json */ /** * Sample code: Create a server vulnerability assessments on a resource. Only 'default' resource is supported. Once @@ -6499,7 +7554,8 @@ public final class ServerVulnerabilityAssessmentCreateOrUpdateSamples { */ public final class ServerVulnerabilityAssessmentDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/DeleteServerVulnerabilityAssessments_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * ServerVulnerabilityAssessments/DeleteServerVulnerabilityAssessments_example.json */ /** * Sample code: Delete a server vulnerability assessments on a resource. Only 'default' resource is supported. Once @@ -6524,7 +7580,8 @@ public final class ServerVulnerabilityAssessmentDeleteSamples { */ public final class ServerVulnerabilityAssessmentGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/GetServerVulnerabilityAssessments_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * ServerVulnerabilityAssessments/GetServerVulnerabilityAssessments_example.json */ /** * Sample code: Get a server vulnerability assessments onboarding status on a resource. Currently Microsoft.Security @@ -6549,7 +7606,8 @@ public final class ServerVulnerabilityAssessmentGetSamples { */ public final class ServerVulnerabilityAssessmentListByExtendedResourceSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/ListByExtendedResourceServerVulnerabilityAssessments_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ + * ServerVulnerabilityAssessments/ListByExtendedResourceServerVulnerabilityAssessments_example.json */ /** * Sample code: Get a list of server vulnerability assessments on a resource. Though this API returns a list, @@ -6579,7 +7637,8 @@ import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsS */ public final class ServerVulnerabilityAssessmentsSettingsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ + * ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json */ /** * Sample code: Set a server vulnerability assessments setting of the kind settingKind on the subscription. @@ -6607,7 +7666,8 @@ import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsS */ public final class ServerVulnerabilityAssessmentsSettingsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/DeleteServerVulnerabilityAssessmentsSetting_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ + * ServerVulnerabilityAssessmentsSettings/DeleteServerVulnerabilityAssessmentsSetting_example.json */ /** * Sample code: Delete the server vulnerability assessments setting of the kind settingKind from the subscription. @@ -6633,7 +7693,8 @@ import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsS */ public final class ServerVulnerabilityAssessmentsSettingsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/GetServerVulnerabilityAssessmentsSetting_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ + * ServerVulnerabilityAssessmentsSettings/GetServerVulnerabilityAssessmentsSetting_example.json */ /** * Sample code: Get the server vulnerability assessments setting of the kind settingKind that is set on the @@ -6658,7 +7719,8 @@ public final class ServerVulnerabilityAssessmentsSettingsGetSamples { */ public final class ServerVulnerabilityAssessmentsSettingsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/ListServerVulnerabilityAssessmentsSettings_example.json + * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ + * ServerVulnerabilityAssessmentsSettings/ListServerVulnerabilityAssessmentsSettings_example.json */ /** * Sample code: List the server vulnerability assessments settings set on the subscription. @@ -6682,7 +7744,9 @@ import com.azure.resourcemanager.security.models.SettingNameAutoGenerated; */ public final class SettingsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/GetSetting_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/GetSetting_example + * .json */ /** * Sample code: Get a setting on subscription. @@ -6703,7 +7767,9 @@ public final class SettingsGetSamples { */ public final class SettingsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/GetSettings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/ + * GetSettings_example.json */ /** * Sample code: Get settings of subscription. @@ -6727,7 +7793,9 @@ import com.azure.resourcemanager.security.models.SettingNameAutoGenerated; */ public final class SettingsUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/UpdateSetting_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2022-05-01/examples/Settings/ + * UpdateSetting_example.json */ /** * Sample code: Update a setting for subscription. @@ -6750,7 +7818,9 @@ public final class SettingsUpdateSamples { */ public final class SoftwareInventoriesGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/GetSoftware_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/ + * SoftwareInventories/GetSoftware_example.json */ /** * Sample code: Gets a single software data of the virtual machine. @@ -6774,7 +7844,9 @@ public final class SoftwareInventoriesGetSamples { */ public final class SoftwareInventoriesListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/ListBySubscriptionSoftwareInventories_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/ + * SoftwareInventories/ListBySubscriptionSoftwareInventories_example.json */ /** * Sample code: Gets the software inventory of all virtual machines in the subscriptions. @@ -6796,7 +7868,9 @@ public final class SoftwareInventoriesListSamples { */ public final class SoftwareInventoriesListByExtendedResourceSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/ListByExtendedResourceSoftwareInventories_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/ + * SoftwareInventories/ListByExtendedResourceSoftwareInventories_example.json */ /** * Sample code: Gets the software inventory of the virtual machine. @@ -6825,7 +7899,9 @@ import java.util.Map; */ public final class SqlVulnerabilityAssessmentBaselineRulesAddSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Add.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Add.json */ /** * Sample code: Create a baseline for all rules. @@ -6844,7 +7920,9 @@ public final class SqlVulnerabilityAssessmentBaselineRulesAddSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_AddLatest.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_AddLatest.json */ /** * Sample code: Create a baseline for all rules using the latest scan results. @@ -6883,7 +7961,9 @@ import java.util.Arrays; */ public final class SqlVulnerabilityAssessmentBaselineRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_PutLatest.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_PutLatest.json */ /** * Sample code: Create a baseline using the latest scan results. @@ -6903,7 +7983,9 @@ public final class SqlVulnerabilityAssessmentBaselineRulesCreateOrUpdateSamples } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Put.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Put.json */ /** * Sample code: Create a baseline. @@ -6931,7 +8013,9 @@ public final class SqlVulnerabilityAssessmentBaselineRulesCreateOrUpdateSamples */ public final class SqlVulnerabilityAssessmentBaselineRulesDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Delete.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Delete.json */ /** * Sample code: Delete the baseline. @@ -6955,7 +8039,9 @@ public final class SqlVulnerabilityAssessmentBaselineRulesDeleteSamples { */ public final class SqlVulnerabilityAssessmentBaselineRulesGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Get.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Get.json */ /** * Sample code: Get the baseline. @@ -6979,7 +8065,9 @@ public final class SqlVulnerabilityAssessmentBaselineRulesGetSamples { */ public final class SqlVulnerabilityAssessmentBaselineRulesListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_List.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_List.json */ /** * Sample code: List baseline for all rules. @@ -7003,7 +8091,9 @@ public final class SqlVulnerabilityAssessmentBaselineRulesListSamples { */ public final class SqlVulnerabilityAssessmentScanResultsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_Get.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_Get.json */ /** * Sample code: Get scan details of a scan record. @@ -7018,7 +8108,9 @@ public final class SqlVulnerabilityAssessmentScanResultsGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_GetLatest.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_GetLatest.json */ /** * Sample code: Get scan details of the latest scan record. @@ -7042,7 +8134,9 @@ public final class SqlVulnerabilityAssessmentScanResultsGetSamples { */ public final class SqlVulnerabilityAssessmentScanResultsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_ListLatest.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_ListLatest.json */ /** * Sample code: List scan results of the latest scan. @@ -7057,7 +8151,9 @@ public final class SqlVulnerabilityAssessmentScanResultsListSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_List.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_List.json */ /** * Sample code: List scan results. @@ -7081,7 +8177,9 @@ public final class SqlVulnerabilityAssessmentScanResultsListSamples { */ public final class SqlVulnerabilityAssessmentScansGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_Get.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_Get.json */ /** * Sample code: Get scan details of a scan record. @@ -7096,7 +8194,9 @@ public final class SqlVulnerabilityAssessmentScansGetSamples { } /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_GetLatest.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_GetLatest.json */ /** * Sample code: Get scan details of the latest scan record. @@ -7120,7 +8220,9 @@ public final class SqlVulnerabilityAssessmentScansGetSamples { */ public final class SqlVulnerabilityAssessmentScansListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_List.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2023-02-01-preview/examples/ + * sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_List.json */ /** * Sample code: List scan details. @@ -7136,6 +8238,150 @@ public final class SqlVulnerabilityAssessmentScansListSamples { } ``` +### StandardAssignments_Create + +```java +import com.azure.resourcemanager.security.models.AssignedAssessmentItem; +import com.azure.resourcemanager.security.models.AssignedStandardItem; +import com.azure.resourcemanager.security.models.Effect; +import com.azure.resourcemanager.security.models.ExemptionCategory; +import com.azure.resourcemanager.security.models.StandardAssignmentPropertiesExemptionData; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for StandardAssignments Create. + */ +public final class StandardAssignmentsCreateSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ + * PutStandardAssignment.json + */ + /** + * Sample code: Put an audit standard assignment. + * + * @param manager Entry point to SecurityManager. + */ + public static void putAnAuditStandardAssignment(com.azure.resourcemanager.security.SecurityManager manager) { + manager.standardAssignments() + .define("1f3afdf9-d0c9-4c3d-847f-89da613e70a8") + .withExistingResourceId("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23") + .withDisplayName("ASC Default") + .withDescription("Set of policies monitored by Azure Security Center for cross cloud") + .withAssignedStandard(new AssignedStandardItem() + .withId("/providers/Microsoft.Security/securityStandards/1f3afdf9-d0c9-4c3d-847f-89da613e70a8")) + .withEffect(Effect.AUDIT) + .withExcludedScopes(Arrays.asList()) + .create(); + } + + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ + * PutExemptionStandardAssignment.json + */ + /** + * Sample code: Put exemption standard assignment. + * + * @param manager Entry point to SecurityManager. + */ + public static void putExemptionStandardAssignment(com.azure.resourcemanager.security.SecurityManager manager) { + manager.standardAssignments() + .define("1f3afdf9-d0c9-4c3d-847f-89da613e70a8") + .withExistingResourceId( + "subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/ANAT_TEST_RG/providers/Microsoft.Compute/virtualMachines/anatTestE2LA") + .withDisplayName("Test exemption") + .withDescription("Exemption description") + .withAssignedStandard(new AssignedStandardItem() + .withId("/providers/Microsoft.Security/securityStandards/1f3afdf9-d0c9-4c3d-847f-89da613e70a8")) + .withEffect(Effect.EXEMPT) + .withExpiresOn(OffsetDateTime.parse("2022-05-01T19:50:47.083633Z")) + .withExemptionData( + new StandardAssignmentPropertiesExemptionData().withExemptionCategory(ExemptionCategory.WAIVER) + .withAssignedAssessment(new AssignedAssessmentItem().withAssessmentKey("fakeTokenPlaceholder"))) + .create(); + } +} +``` + +### StandardAssignments_Delete + +```java +/** + * Samples for StandardAssignments Delete. + */ +public final class StandardAssignmentsDeleteSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ + * DeleteStandardAssignment.json + */ + /** + * Sample code: Delete a standard assignment. + * + * @param manager Entry point to SecurityManager. + */ + public static void deleteAStandardAssignment(com.azure.resourcemanager.security.SecurityManager manager) { + manager.standardAssignments() + .deleteByResourceGroupWithResponse( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + "ad9a8e26-29d9-4829-bb30-e597a58cdbb8", com.azure.core.util.Context.NONE); + } +} +``` + +### StandardAssignments_Get + +```java +/** + * Samples for StandardAssignments Get. + */ +public final class StandardAssignmentsGetSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ + * GetStandardAssignment.json + */ + /** + * Sample code: Retrieve a standard assignment. + * + * @param manager Entry point to SecurityManager. + */ + public static void retrieveAStandardAssignment(com.azure.resourcemanager.security.SecurityManager manager) { + manager.standardAssignments() + .getWithResponse("providers/Microsoft.Management/managementGroups/contoso", + "1f3afdf9-d0c9-4c3d-847f-89da613e70a8", com.azure.core.util.Context.NONE); + } +} +``` + +### StandardAssignments_List + +```java +/** + * Samples for StandardAssignments List. + */ +public final class StandardAssignmentsListSamples { + /* + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2024-08-01/examples/StandardAssignments/ + * ListStandardAssignments.json + */ + /** + * Sample code: List standard assignments. + * + * @param manager Entry point to SecurityManager. + */ + public static void listStandardAssignments(com.azure.resourcemanager.security.SecurityManager manager) { + manager.standardAssignments() + .list( + "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/gcpResourceGroup/providers/Microsoft.Security/securityConnectors/gcpconnector", + com.azure.core.util.Context.NONE); + } +} +``` + ### SubAssessments_Get ```java @@ -7144,7 +8390,9 @@ public final class SqlVulnerabilityAssessmentScansListSamples { */ public final class SubAssessmentsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/GetSubAssessment_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ + * GetSubAssessment_example.json */ /** * Sample code: Get security recommendation task from security data location. @@ -7170,7 +8418,9 @@ public final class SubAssessmentsGetSamples { */ public final class SubAssessmentsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ListSubAssessments_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ + * ListSubAssessments_example.json */ /** * Sample code: List security sub-assessments. @@ -7193,7 +8443,9 @@ public final class SubAssessmentsListSamples { */ public final class SubAssessmentsListAllSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ListSubscriptionSubAssessments_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ + * ListSubscriptionSubAssessments_example.json */ /** * Sample code: List security sub-assessments. @@ -7215,7 +8467,9 @@ public final class SubAssessmentsListAllSamples { */ public final class TasksGetResourceGroupLevelTaskSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTaskResourceGroupLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTaskResourceGroupLocation_example.json */ /** * Sample code: Get security recommendation task in a resource group. @@ -7239,7 +8493,9 @@ public final class TasksGetResourceGroupLevelTaskSamples { */ public final class TasksGetSubscriptionLevelTaskSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTaskSubscriptionLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTaskSubscriptionLocation_example.json */ /** * Sample code: Get security recommendation task from security data location. @@ -7263,7 +8519,9 @@ public final class TasksGetSubscriptionLevelTaskSamples { */ public final class TasksListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksSubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTasksSubscription_example.json */ /** * Sample code: Get security recommendations tasks. @@ -7284,7 +8542,9 @@ public final class TasksListSamples { */ public final class TasksListByHomeRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksSubscriptionLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTasksSubscriptionLocation_example.json */ /** * Sample code: Get security recommendations tasks from security data location. @@ -7306,7 +8566,9 @@ public final class TasksListByHomeRegionSamples { */ public final class TasksListByResourceGroupSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksResourceGroupLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * GetTasksResourceGroupLocation_example.json */ /** * Sample code: Get security recommendation tasks in a resource group. @@ -7330,7 +8592,9 @@ import com.azure.resourcemanager.security.models.TaskUpdateActionType; */ public final class TasksUpdateResourceGroupLevelTaskStateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/UpdateTaskResourceGroupLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * UpdateTaskResourceGroupLocation_example.json */ /** * Sample code: Change security recommendation task state. @@ -7356,7 +8620,9 @@ import com.azure.resourcemanager.security.models.TaskUpdateActionType; */ public final class TasksUpdateSubscriptionLevelTaskStateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/UpdateTaskSubscriptionLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/ + * UpdateTaskSubscriptionLocation_example.json */ /** * Sample code: Change security recommendation task state. @@ -7380,7 +8646,9 @@ public final class TasksUpdateSubscriptionLevelTaskStateSamples { */ public final class TopologyGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/GetTopology_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/ + * GetTopology_example.json */ /** * Sample code: Get topology. @@ -7401,7 +8669,9 @@ public final class TopologyGetSamples { */ public final class TopologyListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/GetTopologySubscription_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/ + * GetTopologySubscription_example.json */ /** * Sample code: Get topology on a subscription. @@ -7422,7 +8692,9 @@ public final class TopologyListSamples { */ public final class TopologyListByHomeRegionSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/GetTopologySubscriptionLocation_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/ + * GetTopologySubscriptionLocation_example.json */ /** * Sample code: Get topology on a subscription from security data location. @@ -7444,7 +8716,9 @@ public final class TopologyListByHomeRegionSamples { */ public final class WorkspaceSettingsCreateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/CreateWorkspaceSetting_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * CreateWorkspaceSetting_example.json */ /** * Sample code: Create a workspace setting data for subscription. @@ -7471,7 +8745,9 @@ public final class WorkspaceSettingsCreateSamples { */ public final class WorkspaceSettingsDeleteSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/DeleteWorkspaceSetting_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * DeleteWorkspaceSetting_example.json */ /** * Sample code: Delete a workspace setting data for resource group. @@ -7493,7 +8769,9 @@ public final class WorkspaceSettingsDeleteSamples { */ public final class WorkspaceSettingsGetSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/GetWorkspaceSetting_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * GetWorkspaceSetting_example.json */ /** * Sample code: Get a workspace setting on subscription. @@ -7514,7 +8792,9 @@ public final class WorkspaceSettingsGetSamples { */ public final class WorkspaceSettingsListSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/GetWorkspaceSettings_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * GetWorkspaceSettings_example.json */ /** * Sample code: Get workspace settings on subscription. @@ -7537,7 +8817,9 @@ import com.azure.resourcemanager.security.models.WorkspaceSetting; */ public final class WorkspaceSettingsUpdateSamples { /* - * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/UpdateWorkspaceSetting_example.json + * x-ms-original-file: + * specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/ + * UpdateWorkspaceSetting_example.json */ /** * Sample code: Update a workspace setting data for subscription. diff --git a/sdk/security/azure-resourcemanager-security/pom.xml b/sdk/security/azure-resourcemanager-security/pom.xml index aed2cd74c3d6..0337ac07413c 100644 --- a/sdk/security/azure-resourcemanager-security/pom.xml +++ b/sdk/security/azure-resourcemanager-security/pom.xml @@ -46,6 +46,7 @@ 0 0 true + false diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/SecurityManager.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/SecurityManager.java index 46177c0d5c64..0d84e621ce5c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/SecurityManager.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/SecurityManager.java @@ -11,21 +11,19 @@ import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.HttpPolicyProviders; import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.SecurityCenter; -import com.azure.resourcemanager.security.implementation.AdaptiveApplicationControlsImpl; -import com.azure.resourcemanager.security.implementation.AdaptiveNetworkHardeningsImpl; import com.azure.resourcemanager.security.implementation.AdvancedThreatProtectionsImpl; import com.azure.resourcemanager.security.implementation.AlertsImpl; import com.azure.resourcemanager.security.implementation.AlertsSuppressionRulesImpl; @@ -35,8 +33,8 @@ import com.azure.resourcemanager.security.implementation.ApplicationsImpl; import com.azure.resourcemanager.security.implementation.AssessmentsImpl; import com.azure.resourcemanager.security.implementation.AssessmentsMetadatasImpl; -import com.azure.resourcemanager.security.implementation.AutomationsImpl; import com.azure.resourcemanager.security.implementation.AutoProvisioningSettingsImpl; +import com.azure.resourcemanager.security.implementation.AutomationsImpl; import com.azure.resourcemanager.security.implementation.AzureDevOpsOrgsImpl; import com.azure.resourcemanager.security.implementation.AzureDevOpsProjectsImpl; import com.azure.resourcemanager.security.implementation.AzureDevOpsReposImpl; @@ -45,10 +43,13 @@ import com.azure.resourcemanager.security.implementation.ConnectorsImpl; import com.azure.resourcemanager.security.implementation.CustomAssessmentAutomationsImpl; import com.azure.resourcemanager.security.implementation.CustomEntityStoreAssignmentsImpl; +import com.azure.resourcemanager.security.implementation.CustomRecommendationsImpl; import com.azure.resourcemanager.security.implementation.DefenderForStoragesImpl; -import com.azure.resourcemanager.security.implementation.DeviceSecurityGroupsImpl; import com.azure.resourcemanager.security.implementation.DevOpsConfigurationsImpl; import com.azure.resourcemanager.security.implementation.DevOpsOperationResultsImpl; +import com.azure.resourcemanager.security.implementation.DevOpsPoliciesImpl; +import com.azure.resourcemanager.security.implementation.DevOpsPolicyAssignmentsImpl; +import com.azure.resourcemanager.security.implementation.DeviceSecurityGroupsImpl; import com.azure.resourcemanager.security.implementation.DiscoveredSecuritySolutionsImpl; import com.azure.resourcemanager.security.implementation.ExternalSecuritySolutionsImpl; import com.azure.resourcemanager.security.implementation.GitHubOwnersImpl; @@ -83,6 +84,7 @@ import com.azure.resourcemanager.security.implementation.SecurityOperatorsImpl; import com.azure.resourcemanager.security.implementation.SecuritySolutionsImpl; import com.azure.resourcemanager.security.implementation.SecuritySolutionsReferenceDatasImpl; +import com.azure.resourcemanager.security.implementation.SecurityStandardsImpl; import com.azure.resourcemanager.security.implementation.SensitivitySettingsImpl; import com.azure.resourcemanager.security.implementation.ServerVulnerabilityAssessmentsImpl; import com.azure.resourcemanager.security.implementation.ServerVulnerabilityAssessmentsSettingsImpl; @@ -91,12 +93,11 @@ import com.azure.resourcemanager.security.implementation.SqlVulnerabilityAssessmentBaselineRulesImpl; import com.azure.resourcemanager.security.implementation.SqlVulnerabilityAssessmentScanResultsImpl; import com.azure.resourcemanager.security.implementation.SqlVulnerabilityAssessmentScansImpl; +import com.azure.resourcemanager.security.implementation.StandardAssignmentsImpl; import com.azure.resourcemanager.security.implementation.SubAssessmentsImpl; import com.azure.resourcemanager.security.implementation.TasksImpl; import com.azure.resourcemanager.security.implementation.TopologiesImpl; import com.azure.resourcemanager.security.implementation.WorkspaceSettingsImpl; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControls; -import com.azure.resourcemanager.security.models.AdaptiveNetworkHardenings; import com.azure.resourcemanager.security.models.AdvancedThreatProtections; import com.azure.resourcemanager.security.models.Alerts; import com.azure.resourcemanager.security.models.AlertsSuppressionRules; @@ -106,8 +107,8 @@ import com.azure.resourcemanager.security.models.Applications; import com.azure.resourcemanager.security.models.Assessments; import com.azure.resourcemanager.security.models.AssessmentsMetadatas; -import com.azure.resourcemanager.security.models.Automations; import com.azure.resourcemanager.security.models.AutoProvisioningSettings; +import com.azure.resourcemanager.security.models.Automations; import com.azure.resourcemanager.security.models.AzureDevOpsOrgs; import com.azure.resourcemanager.security.models.AzureDevOpsProjects; import com.azure.resourcemanager.security.models.AzureDevOpsRepos; @@ -116,10 +117,13 @@ import com.azure.resourcemanager.security.models.Connectors; import com.azure.resourcemanager.security.models.CustomAssessmentAutomations; import com.azure.resourcemanager.security.models.CustomEntityStoreAssignments; +import com.azure.resourcemanager.security.models.CustomRecommendations; import com.azure.resourcemanager.security.models.DefenderForStorages; -import com.azure.resourcemanager.security.models.DeviceSecurityGroups; import com.azure.resourcemanager.security.models.DevOpsConfigurations; import com.azure.resourcemanager.security.models.DevOpsOperationResults; +import com.azure.resourcemanager.security.models.DevOpsPolicies; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignments; +import com.azure.resourcemanager.security.models.DeviceSecurityGroups; import com.azure.resourcemanager.security.models.DiscoveredSecuritySolutions; import com.azure.resourcemanager.security.models.ExternalSecuritySolutions; import com.azure.resourcemanager.security.models.GitHubOwners; @@ -153,6 +157,7 @@ import com.azure.resourcemanager.security.models.SecurityOperators; import com.azure.resourcemanager.security.models.SecuritySolutions; import com.azure.resourcemanager.security.models.SecuritySolutionsReferenceDatas; +import com.azure.resourcemanager.security.models.SecurityStandards; import com.azure.resourcemanager.security.models.SensitivitySettings; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessments; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettings; @@ -161,6 +166,7 @@ import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentBaselineRules; import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScanResults; import com.azure.resourcemanager.security.models.SqlVulnerabilityAssessmentScans; +import com.azure.resourcemanager.security.models.StandardAssignments; import com.azure.resourcemanager.security.models.SubAssessments; import com.azure.resourcemanager.security.models.Tasks; import com.azure.resourcemanager.security.models.Topologies; @@ -243,6 +249,30 @@ public final class SecurityManager { private SecurityConnectors securityConnectors; + private AzureDevOpsOrgs azureDevOpsOrgs; + + private AzureDevOpsProjects azureDevOpsProjects; + + private AzureDevOpsRepos azureDevOpsRepos; + + private DevOpsConfigurations devOpsConfigurations; + + private DevOpsPolicies devOpsPolicies; + + private DevOpsPolicyAssignments devOpsPolicyAssignments; + + private GitHubOwners gitHubOwners; + + private GitHubRepos gitHubRepos; + + private GitLabGroups gitLabGroups; + + private GitLabSubgroups gitLabSubgroups; + + private GitLabProjects gitLabProjects; + + private DevOpsOperationResults devOpsOperationResults; + private ComplianceResults complianceResults; private AdvancedThreatProtections advancedThreatProtections; @@ -257,12 +287,8 @@ public final class SecurityManager { private IotSecuritySolutions iotSecuritySolutions; - private AdaptiveNetworkHardenings adaptiveNetworkHardenings; - private AllowedConnections allowedConnections; - private AdaptiveApplicationControls adaptiveApplicationControls; - private DiscoveredSecuritySolutions discoveredSecuritySolutions; private ExternalSecuritySolutions externalSecuritySolutions; @@ -297,25 +323,11 @@ public final class SecurityManager { private Pricings pricings; - private AzureDevOpsOrgs azureDevOpsOrgs; + private SecurityStandards securityStandards; - private AzureDevOpsProjects azureDevOpsProjects; + private StandardAssignments standardAssignments; - private AzureDevOpsRepos azureDevOpsRepos; - - private DevOpsConfigurations devOpsConfigurations; - - private GitHubOwners gitHubOwners; - - private GitHubRepos gitHubRepos; - - private GitLabGroups gitLabGroups; - - private GitLabSubgroups gitLabSubgroups; - - private GitLabProjects gitLabProjects; - - private DevOpsOperationResults devOpsOperationResults; + private CustomRecommendations customRecommendations; private final SecurityCenter clientObject; @@ -481,7 +493,7 @@ public SecurityManager authenticate(TokenCredential credential, AzureProfile pro .append("-") .append("com.azure.resourcemanager.security") .append("/") - .append("1.0.0-beta.7"); + .append("1.0.0-beta.8"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -514,7 +526,7 @@ public SecurityManager authenticate(TokenCredential credential, AzureProfile pro HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .collect(Collectors.toList())); @@ -936,6 +948,152 @@ public SecurityConnectors securityConnectors() { return securityConnectors; } + /** + * Gets the resource collection API of AzureDevOpsOrgs. It manages AzureDevOpsOrg. + * + * @return Resource collection API of AzureDevOpsOrgs. + */ + public AzureDevOpsOrgs azureDevOpsOrgs() { + if (this.azureDevOpsOrgs == null) { + this.azureDevOpsOrgs = new AzureDevOpsOrgsImpl(clientObject.getAzureDevOpsOrgs(), this); + } + return azureDevOpsOrgs; + } + + /** + * Gets the resource collection API of AzureDevOpsProjects. It manages AzureDevOpsProject. + * + * @return Resource collection API of AzureDevOpsProjects. + */ + public AzureDevOpsProjects azureDevOpsProjects() { + if (this.azureDevOpsProjects == null) { + this.azureDevOpsProjects = new AzureDevOpsProjectsImpl(clientObject.getAzureDevOpsProjects(), this); + } + return azureDevOpsProjects; + } + + /** + * Gets the resource collection API of AzureDevOpsRepos. It manages AzureDevOpsRepository. + * + * @return Resource collection API of AzureDevOpsRepos. + */ + public AzureDevOpsRepos azureDevOpsRepos() { + if (this.azureDevOpsRepos == null) { + this.azureDevOpsRepos = new AzureDevOpsReposImpl(clientObject.getAzureDevOpsRepos(), this); + } + return azureDevOpsRepos; + } + + /** + * Gets the resource collection API of DevOpsConfigurations. + * + * @return Resource collection API of DevOpsConfigurations. + */ + public DevOpsConfigurations devOpsConfigurations() { + if (this.devOpsConfigurations == null) { + this.devOpsConfigurations = new DevOpsConfigurationsImpl(clientObject.getDevOpsConfigurations(), this); + } + return devOpsConfigurations; + } + + /** + * Gets the resource collection API of DevOpsPolicies. + * + * @return Resource collection API of DevOpsPolicies. + */ + public DevOpsPolicies devOpsPolicies() { + if (this.devOpsPolicies == null) { + this.devOpsPolicies = new DevOpsPoliciesImpl(clientObject.getDevOpsPolicies(), this); + } + return devOpsPolicies; + } + + /** + * Gets the resource collection API of DevOpsPolicyAssignments. It manages DevOpsPolicyAssignment. + * + * @return Resource collection API of DevOpsPolicyAssignments. + */ + public DevOpsPolicyAssignments devOpsPolicyAssignments() { + if (this.devOpsPolicyAssignments == null) { + this.devOpsPolicyAssignments + = new DevOpsPolicyAssignmentsImpl(clientObject.getDevOpsPolicyAssignments(), this); + } + return devOpsPolicyAssignments; + } + + /** + * Gets the resource collection API of GitHubOwners. + * + * @return Resource collection API of GitHubOwners. + */ + public GitHubOwners gitHubOwners() { + if (this.gitHubOwners == null) { + this.gitHubOwners = new GitHubOwnersImpl(clientObject.getGitHubOwners(), this); + } + return gitHubOwners; + } + + /** + * Gets the resource collection API of GitHubRepos. + * + * @return Resource collection API of GitHubRepos. + */ + public GitHubRepos gitHubRepos() { + if (this.gitHubRepos == null) { + this.gitHubRepos = new GitHubReposImpl(clientObject.getGitHubRepos(), this); + } + return gitHubRepos; + } + + /** + * Gets the resource collection API of GitLabGroups. + * + * @return Resource collection API of GitLabGroups. + */ + public GitLabGroups gitLabGroups() { + if (this.gitLabGroups == null) { + this.gitLabGroups = new GitLabGroupsImpl(clientObject.getGitLabGroups(), this); + } + return gitLabGroups; + } + + /** + * Gets the resource collection API of GitLabSubgroups. + * + * @return Resource collection API of GitLabSubgroups. + */ + public GitLabSubgroups gitLabSubgroups() { + if (this.gitLabSubgroups == null) { + this.gitLabSubgroups = new GitLabSubgroupsImpl(clientObject.getGitLabSubgroups(), this); + } + return gitLabSubgroups; + } + + /** + * Gets the resource collection API of GitLabProjects. + * + * @return Resource collection API of GitLabProjects. + */ + public GitLabProjects gitLabProjects() { + if (this.gitLabProjects == null) { + this.gitLabProjects = new GitLabProjectsImpl(clientObject.getGitLabProjects(), this); + } + return gitLabProjects; + } + + /** + * Gets the resource collection API of DevOpsOperationResults. + * + * @return Resource collection API of DevOpsOperationResults. + */ + public DevOpsOperationResults devOpsOperationResults() { + if (this.devOpsOperationResults == null) { + this.devOpsOperationResults + = new DevOpsOperationResultsImpl(clientObject.getDevOpsOperationResults(), this); + } + return devOpsOperationResults; + } + /** * Gets the resource collection API of ComplianceResults. * @@ -1024,19 +1182,6 @@ public IotSecuritySolutions iotSecuritySolutions() { return iotSecuritySolutions; } - /** - * Gets the resource collection API of AdaptiveNetworkHardenings. - * - * @return Resource collection API of AdaptiveNetworkHardenings. - */ - public AdaptiveNetworkHardenings adaptiveNetworkHardenings() { - if (this.adaptiveNetworkHardenings == null) { - this.adaptiveNetworkHardenings - = new AdaptiveNetworkHardeningsImpl(clientObject.getAdaptiveNetworkHardenings(), this); - } - return adaptiveNetworkHardenings; - } - /** * Gets the resource collection API of AllowedConnections. * @@ -1049,19 +1194,6 @@ public AllowedConnections allowedConnections() { return allowedConnections; } - /** - * Gets the resource collection API of AdaptiveApplicationControls. It manages AdaptiveApplicationControlGroup. - * - * @return Resource collection API of AdaptiveApplicationControls. - */ - public AdaptiveApplicationControls adaptiveApplicationControls() { - if (this.adaptiveApplicationControls == null) { - this.adaptiveApplicationControls - = new AdaptiveApplicationControlsImpl(clientObject.getAdaptiveApplicationControls(), this); - } - return adaptiveApplicationControls; - } - /** * Gets the resource collection API of DiscoveredSecuritySolutions. * @@ -1274,124 +1406,39 @@ public Pricings pricings() { } /** - * Gets the resource collection API of AzureDevOpsOrgs. It manages AzureDevOpsOrg. + * Gets the resource collection API of SecurityStandards. It manages SecurityStandard. * - * @return Resource collection API of AzureDevOpsOrgs. + * @return Resource collection API of SecurityStandards. */ - public AzureDevOpsOrgs azureDevOpsOrgs() { - if (this.azureDevOpsOrgs == null) { - this.azureDevOpsOrgs = new AzureDevOpsOrgsImpl(clientObject.getAzureDevOpsOrgs(), this); + public SecurityStandards securityStandards() { + if (this.securityStandards == null) { + this.securityStandards = new SecurityStandardsImpl(clientObject.getSecurityStandards(), this); } - return azureDevOpsOrgs; + return securityStandards; } /** - * Gets the resource collection API of AzureDevOpsProjects. It manages AzureDevOpsProject. + * Gets the resource collection API of StandardAssignments. It manages StandardAssignment. * - * @return Resource collection API of AzureDevOpsProjects. + * @return Resource collection API of StandardAssignments. */ - public AzureDevOpsProjects azureDevOpsProjects() { - if (this.azureDevOpsProjects == null) { - this.azureDevOpsProjects = new AzureDevOpsProjectsImpl(clientObject.getAzureDevOpsProjects(), this); + public StandardAssignments standardAssignments() { + if (this.standardAssignments == null) { + this.standardAssignments = new StandardAssignmentsImpl(clientObject.getStandardAssignments(), this); } - return azureDevOpsProjects; - } - - /** - * Gets the resource collection API of AzureDevOpsRepos. It manages AzureDevOpsRepository. - * - * @return Resource collection API of AzureDevOpsRepos. - */ - public AzureDevOpsRepos azureDevOpsRepos() { - if (this.azureDevOpsRepos == null) { - this.azureDevOpsRepos = new AzureDevOpsReposImpl(clientObject.getAzureDevOpsRepos(), this); - } - return azureDevOpsRepos; + return standardAssignments; } /** - * Gets the resource collection API of DevOpsConfigurations. + * Gets the resource collection API of CustomRecommendations. It manages CustomRecommendation. * - * @return Resource collection API of DevOpsConfigurations. + * @return Resource collection API of CustomRecommendations. */ - public DevOpsConfigurations devOpsConfigurations() { - if (this.devOpsConfigurations == null) { - this.devOpsConfigurations = new DevOpsConfigurationsImpl(clientObject.getDevOpsConfigurations(), this); + public CustomRecommendations customRecommendations() { + if (this.customRecommendations == null) { + this.customRecommendations = new CustomRecommendationsImpl(clientObject.getCustomRecommendations(), this); } - return devOpsConfigurations; - } - - /** - * Gets the resource collection API of GitHubOwners. - * - * @return Resource collection API of GitHubOwners. - */ - public GitHubOwners gitHubOwners() { - if (this.gitHubOwners == null) { - this.gitHubOwners = new GitHubOwnersImpl(clientObject.getGitHubOwners(), this); - } - return gitHubOwners; - } - - /** - * Gets the resource collection API of GitHubRepos. - * - * @return Resource collection API of GitHubRepos. - */ - public GitHubRepos gitHubRepos() { - if (this.gitHubRepos == null) { - this.gitHubRepos = new GitHubReposImpl(clientObject.getGitHubRepos(), this); - } - return gitHubRepos; - } - - /** - * Gets the resource collection API of GitLabGroups. - * - * @return Resource collection API of GitLabGroups. - */ - public GitLabGroups gitLabGroups() { - if (this.gitLabGroups == null) { - this.gitLabGroups = new GitLabGroupsImpl(clientObject.getGitLabGroups(), this); - } - return gitLabGroups; - } - - /** - * Gets the resource collection API of GitLabSubgroups. - * - * @return Resource collection API of GitLabSubgroups. - */ - public GitLabSubgroups gitLabSubgroups() { - if (this.gitLabSubgroups == null) { - this.gitLabSubgroups = new GitLabSubgroupsImpl(clientObject.getGitLabSubgroups(), this); - } - return gitLabSubgroups; - } - - /** - * Gets the resource collection API of GitLabProjects. - * - * @return Resource collection API of GitLabProjects. - */ - public GitLabProjects gitLabProjects() { - if (this.gitLabProjects == null) { - this.gitLabProjects = new GitLabProjectsImpl(clientObject.getGitLabProjects(), this); - } - return gitLabProjects; - } - - /** - * Gets the resource collection API of DevOpsOperationResults. - * - * @return Resource collection API of DevOpsOperationResults. - */ - public DevOpsOperationResults devOpsOperationResults() { - if (this.devOpsOperationResults == null) { - this.devOpsOperationResults - = new DevOpsOperationResultsImpl(clientObject.getDevOpsOperationResults(), this); - } - return devOpsOperationResults; + return customRecommendations; } /** diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveApplicationControlsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveApplicationControlsClient.java deleted file mode 100644 index 413920bdc12c..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveApplicationControlsClient.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; - -/** - * An instance of this class provides access to all the operations defined in AdaptiveApplicationControlsClient. - */ -public interface AdaptiveApplicationControlsClient { - /** - * Gets a list of application control machine groups for the subscription. - * - * @param includePathRecommendations Include the policy rules. - * @param summary Return output in a summarized form. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of application control machine groups for the subscription along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response listWithResponse(Boolean includePathRecommendations, - Boolean summary, Context context); - - /** - * Gets a list of application control machine groups for the subscription. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of application control machine groups for the subscription. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - AdaptiveApplicationControlGroupsInner list(); - - /** - * Gets an application control VM/server group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String ascLocation, String groupName, - Context context); - - /** - * Gets an application control VM/server group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - AdaptiveApplicationControlGroupInner get(String ascLocation, String groupName); - - /** - * Update an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response putWithResponse(String ascLocation, String groupName, - AdaptiveApplicationControlGroupInner body, Context context); - - /** - * Update an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - AdaptiveApplicationControlGroupInner put(String ascLocation, String groupName, - AdaptiveApplicationControlGroupInner body); - - /** - * Delete an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String ascLocation, String groupName, Context context); - - /** - * Delete an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String ascLocation, String groupName); -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveNetworkHardeningsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveNetworkHardeningsClient.java deleted file mode 100644 index a9d60aff4c1c..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/AdaptiveNetworkHardeningsClient.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; -import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; -import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningEnforceRequest; - -/** - * An instance of this class provides access to all the operations defined in AdaptiveNetworkHardeningsClient. - */ -public interface AdaptiveNetworkHardeningsClient { - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource as paginated response - * with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByExtendedResource(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName); - - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource as paginated response - * with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByExtendedResource(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, Context context); - - /** - * Gets a single Adaptive Network Hardening resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single Adaptive Network Hardening resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, Context context); - - /** - * Gets a single Adaptive Network Hardening resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single Adaptive Network Hardening resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - AdaptiveNetworkHardeningInner get(String resourceGroupName, String resourceNamespace, String resourceType, - String resourceName, String adaptiveNetworkHardeningResourceName); - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginEnforce(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, - AdaptiveNetworkHardeningEnforceRequest body); - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginEnforce(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, - AdaptiveNetworkHardeningEnforceRequest body, Context context); - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void enforce(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, - String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body); - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void enforce(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, - String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body, Context context); -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomRecommendationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomRecommendationsClient.java new file mode 100644 index 000000000000..24c04431ddad --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/CustomRecommendationsClient.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.CustomRecommendationInner; + +/** + * An instance of this class provides access to all the operations defined in CustomRecommendationsClient. + */ +public interface CustomRecommendationsClient { + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String customRecommendationName, Context context); + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomRecommendationInner get(String scope, String customRecommendationName); + + /** + * Creates or updates a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param customRecommendationBody Custom Recommendation body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Recommendation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String scope, String customRecommendationName, + CustomRecommendationInner customRecommendationBody, Context context); + + /** + * Creates or updates a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param customRecommendationBody Custom Recommendation body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomRecommendationInner createOrUpdate(String scope, String customRecommendationName, + CustomRecommendationInner customRecommendationBody); + + /** + * Delete a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String scope, String customRecommendationName, Context context); + + /** + * Delete a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope, String customRecommendationName); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DefenderForStoragesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DefenderForStoragesClient.java index a703e8d5114d..f092ddc308de 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DefenderForStoragesClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DefenderForStoragesClient.java @@ -9,6 +9,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner; +import com.azure.resourcemanager.security.fluent.models.MalwareScanInner; import com.azure.resourcemanager.security.models.SettingName; /** @@ -73,4 +74,92 @@ Response createWithResponse(String resourceId, S @ServiceMethod(returns = ReturnType.SINGLE) DefenderForStorageSettingInner create(String resourceId, SettingName settingName, DefenderForStorageSettingInner defenderForStorageSetting); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response startMalwareScanWithResponse(String resourceId, SettingName settingName, + Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MalwareScanInner startMalwareScan(String resourceId, SettingName settingName); + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelMalwareScanWithResponse(String resourceId, SettingName settingName, String scanId, + Context context); + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MalwareScanInner cancelMalwareScan(String resourceId, SettingName settingName, String scanId); + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMalwareScanWithResponse(String resourceId, SettingName settingName, String scanId, + Context context); + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MalwareScanInner getMalwareScan(String resourceId, SettingName settingName, String scanId); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsPoliciesClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsPoliciesClient.java new file mode 100644 index 000000000000..e395c3b7cfba --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsPoliciesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyInner; + +/** + * An instance of this class provides access to all the operations defined in DevOpsPoliciesClient. + */ +public interface DevOpsPoliciesClient { + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName); + + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, Context context); + + /** + * Returns a DevOps Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String policyName, Context context); + + /** + * Returns a DevOps Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsPolicyInner get(String resourceGroupName, String securityConnectorName, String policyName); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsPolicyAssignmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsPolicyAssignmentsClient.java new file mode 100644 index 000000000000..2c9701b13063 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/DevOpsPolicyAssignmentsClient.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyAssignmentInner; + +/** + * An instance of this class provides access to all the operations defined in DevOpsPolicyAssignmentsClient. + */ +public interface DevOpsPolicyAssignmentsClient { + /** + * Returns a list of DevOps Policy Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName); + + /** + * Returns a list of DevOps Policy Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param resourceId Optional filter for listing the assignments of a specific resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, String resourceId, Context context); + + /** + * Returns a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, Context context); + + /** + * Returns a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsPolicyAssignmentInner get(String resourceGroupName, String securityConnectorName, String policyAssignmentId); + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevOpsPolicyAssignmentInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment); + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevOpsPolicyAssignmentInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context); + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsPolicyAssignmentInner createOrUpdate(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment); + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsPolicyAssignmentInner createOrUpdate(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context); + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevOpsPolicyAssignmentInner> beginUpdate( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment); + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DevOpsPolicyAssignmentInner> beginUpdate( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context); + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsPolicyAssignmentInner update(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment); + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DevOpsPolicyAssignmentInner update(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context); + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String securityConnectorName, + String policyAssignmentId); + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, Context context); + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String securityConnectorName, String policyAssignmentId); + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String securityConnectorName, String policyAssignmentId, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationsClient.java index 4c7cab5d704e..3ce1a1869f47 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationsClient.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/OperationsClient.java @@ -19,7 +19,7 @@ public interface OperationsClient { * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider as paginated response with + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -32,7 +32,7 @@ public interface OperationsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider as paginated response with + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityCenter.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityCenter.java index bb13ccefdee4..5fd6a9503173 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityCenter.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityCenter.java @@ -270,6 +270,90 @@ public interface SecurityCenter { */ SecurityConnectorsClient getSecurityConnectors(); + /** + * Gets the AzureDevOpsOrgsClient object to access its operations. + * + * @return the AzureDevOpsOrgsClient object. + */ + AzureDevOpsOrgsClient getAzureDevOpsOrgs(); + + /** + * Gets the AzureDevOpsProjectsClient object to access its operations. + * + * @return the AzureDevOpsProjectsClient object. + */ + AzureDevOpsProjectsClient getAzureDevOpsProjects(); + + /** + * Gets the AzureDevOpsReposClient object to access its operations. + * + * @return the AzureDevOpsReposClient object. + */ + AzureDevOpsReposClient getAzureDevOpsRepos(); + + /** + * Gets the DevOpsConfigurationsClient object to access its operations. + * + * @return the DevOpsConfigurationsClient object. + */ + DevOpsConfigurationsClient getDevOpsConfigurations(); + + /** + * Gets the DevOpsPoliciesClient object to access its operations. + * + * @return the DevOpsPoliciesClient object. + */ + DevOpsPoliciesClient getDevOpsPolicies(); + + /** + * Gets the DevOpsPolicyAssignmentsClient object to access its operations. + * + * @return the DevOpsPolicyAssignmentsClient object. + */ + DevOpsPolicyAssignmentsClient getDevOpsPolicyAssignments(); + + /** + * Gets the GitHubOwnersClient object to access its operations. + * + * @return the GitHubOwnersClient object. + */ + GitHubOwnersClient getGitHubOwners(); + + /** + * Gets the GitHubReposClient object to access its operations. + * + * @return the GitHubReposClient object. + */ + GitHubReposClient getGitHubRepos(); + + /** + * Gets the GitLabGroupsClient object to access its operations. + * + * @return the GitLabGroupsClient object. + */ + GitLabGroupsClient getGitLabGroups(); + + /** + * Gets the GitLabSubgroupsClient object to access its operations. + * + * @return the GitLabSubgroupsClient object. + */ + GitLabSubgroupsClient getGitLabSubgroups(); + + /** + * Gets the GitLabProjectsClient object to access its operations. + * + * @return the GitLabProjectsClient object. + */ + GitLabProjectsClient getGitLabProjects(); + + /** + * Gets the DevOpsOperationResultsClient object to access its operations. + * + * @return the DevOpsOperationResultsClient object. + */ + DevOpsOperationResultsClient getDevOpsOperationResults(); + /** * Gets the ComplianceResultsClient object to access its operations. * @@ -319,13 +403,6 @@ public interface SecurityCenter { */ IotSecuritySolutionsClient getIotSecuritySolutions(); - /** - * Gets the AdaptiveNetworkHardeningsClient object to access its operations. - * - * @return the AdaptiveNetworkHardeningsClient object. - */ - AdaptiveNetworkHardeningsClient getAdaptiveNetworkHardenings(); - /** * Gets the AllowedConnectionsClient object to access its operations. * @@ -333,13 +410,6 @@ public interface SecurityCenter { */ AllowedConnectionsClient getAllowedConnections(); - /** - * Gets the AdaptiveApplicationControlsClient object to access its operations. - * - * @return the AdaptiveApplicationControlsClient object. - */ - AdaptiveApplicationControlsClient getAdaptiveApplicationControls(); - /** * Gets the DiscoveredSecuritySolutionsClient object to access its operations. * @@ -460,72 +530,23 @@ public interface SecurityCenter { PricingsClient getPricings(); /** - * Gets the AzureDevOpsOrgsClient object to access its operations. - * - * @return the AzureDevOpsOrgsClient object. - */ - AzureDevOpsOrgsClient getAzureDevOpsOrgs(); - - /** - * Gets the AzureDevOpsProjectsClient object to access its operations. - * - * @return the AzureDevOpsProjectsClient object. - */ - AzureDevOpsProjectsClient getAzureDevOpsProjects(); - - /** - * Gets the AzureDevOpsReposClient object to access its operations. - * - * @return the AzureDevOpsReposClient object. - */ - AzureDevOpsReposClient getAzureDevOpsRepos(); - - /** - * Gets the DevOpsConfigurationsClient object to access its operations. - * - * @return the DevOpsConfigurationsClient object. - */ - DevOpsConfigurationsClient getDevOpsConfigurations(); - - /** - * Gets the GitHubOwnersClient object to access its operations. - * - * @return the GitHubOwnersClient object. - */ - GitHubOwnersClient getGitHubOwners(); - - /** - * Gets the GitHubReposClient object to access its operations. - * - * @return the GitHubReposClient object. - */ - GitHubReposClient getGitHubRepos(); - - /** - * Gets the GitLabGroupsClient object to access its operations. - * - * @return the GitLabGroupsClient object. - */ - GitLabGroupsClient getGitLabGroups(); - - /** - * Gets the GitLabSubgroupsClient object to access its operations. + * Gets the SecurityStandardsClient object to access its operations. * - * @return the GitLabSubgroupsClient object. + * @return the SecurityStandardsClient object. */ - GitLabSubgroupsClient getGitLabSubgroups(); + SecurityStandardsClient getSecurityStandards(); /** - * Gets the GitLabProjectsClient object to access its operations. + * Gets the StandardAssignmentsClient object to access its operations. * - * @return the GitLabProjectsClient object. + * @return the StandardAssignmentsClient object. */ - GitLabProjectsClient getGitLabProjects(); + StandardAssignmentsClient getStandardAssignments(); /** - * Gets the DevOpsOperationResultsClient object to access its operations. + * Gets the CustomRecommendationsClient object to access its operations. * - * @return the DevOpsOperationResultsClient object. + * @return the CustomRecommendationsClient object. */ - DevOpsOperationResultsClient getDevOpsOperationResults(); + CustomRecommendationsClient getCustomRecommendations(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityStandardsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityStandardsClient.java new file mode 100644 index 000000000000..9122c8b4d7bd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/SecurityStandardsClient.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityStandardInner; + +/** + * An instance of this class provides access to all the operations defined in SecurityStandardsClient. + */ +public interface SecurityStandardsClient { + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant security standards over a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant security standards over a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); + + /** + * Get a specific security standard for the requested scope by standardId. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific security standard for the requested scope by standardId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String scope, String standardId, Context context); + + /** + * Get a specific security standard for the requested scope by standardId. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific security standard for the requested scope by standardId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityStandardInner get(String scope, String standardId); + + /** + * Creates or updates a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param standard Custom security standard over a pre-defined scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Standard on a resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String scope, String standardId, + SecurityStandardInner standard, Context context); + + /** + * Creates or updates a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param standard Custom security standard over a pre-defined scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Standard on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityStandardInner createOrUpdate(String scope, String standardId, SecurityStandardInner standard); + + /** + * Delete a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String scope, String standardId, Context context); + + /** + * Delete a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope, String standardId); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/StandardAssignmentsClient.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/StandardAssignmentsClient.java new file mode 100644 index 000000000000..1580cf4fab6a --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/StandardAssignmentsClient.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.StandardAssignmentInner; + +/** + * An instance of this class provides access to all the operations defined in StandardAssignmentsClient. + */ +public interface StandardAssignmentsClient { + /** + * Retrieves a standard assignment. + * + * This operation retrieves a single standard assignment, given its name and the scope it was created at. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceId, String standardAssignmentName, + Context context); + + /** + * Retrieves a standard assignment. + * + * This operation retrieves a single standard assignment, given its name and the scope it was created at. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StandardAssignmentInner get(String resourceId, String standardAssignmentName); + + /** + * Creates or updates a standard assignment. + * + * This operation creates or updates a standard assignment with the given scope and name. standard assignments apply + * to all resources contained within their scope. For example, when you assign a policy at resource group scope, + * that policy applies to all resources in the group. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param standardAssignment Custom standard assignment over a pre-defined scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceId, String standardAssignmentName, + StandardAssignmentInner standardAssignment, Context context); + + /** + * Creates or updates a standard assignment. + * + * This operation creates or updates a standard assignment with the given scope and name. standard assignments apply + * to all resources contained within their scope. For example, when you assign a policy at resource group scope, + * that policy applies to all resources in the group. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param standardAssignment Custom standard assignment over a pre-defined scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StandardAssignmentInner create(String resourceId, String standardAssignmentName, + StandardAssignmentInner standardAssignment); + + /** + * Deletes a standard assignment. + * + * This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a + * standard assignment is the part of its ID preceding + * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceId, String standardAssignmentName, Context context); + + /** + * Deletes a standard assignment. + * + * This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a + * standard assignment is the part of its ID preceding + * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceId, String standardAssignmentName); + + /** + * Get a list of all relevant standard assignments over a scope. + * + * @param scope The scope of the standard assignment. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant standard assignments over a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Get a list of all relevant standard assignments over a scope. + * + * @param scope The scope of the standard assignment. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant standard assignments over a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupData.java deleted file mode 100644 index 7ac3e7964507..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupData.java +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControlIssueSummary; -import com.azure.resourcemanager.security.models.ConfigurationStatus; -import com.azure.resourcemanager.security.models.EnforcementMode; -import com.azure.resourcemanager.security.models.PathRecommendation; -import com.azure.resourcemanager.security.models.ProtectionMode; -import com.azure.resourcemanager.security.models.RecommendationStatus; -import com.azure.resourcemanager.security.models.SourceSystem; -import com.azure.resourcemanager.security.models.VmRecommendation; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** - * Represents a machines group and set of rules to be allowed running on a machine. - */ -@Fluent -public final class AdaptiveApplicationControlGroupData { - /* - * The application control policy enforcement/protection mode of the machine group - */ - @JsonProperty(value = "enforcementMode") - private EnforcementMode enforcementMode; - - /* - * The protection mode of the collection/file types. Exe/Msi/Script are used for Windows, Executable is used for Linux. - */ - @JsonProperty(value = "protectionMode") - private ProtectionMode protectionMode; - - /* - * The configuration status of the machines group or machine or rule - */ - @JsonProperty(value = "configurationStatus", access = JsonProperty.Access.WRITE_ONLY) - private ConfigurationStatus configurationStatus; - - /* - * The initial recommendation status of the machine group or machine - */ - @JsonProperty(value = "recommendationStatus", access = JsonProperty.Access.WRITE_ONLY) - private RecommendationStatus recommendationStatus; - - /* - * The issues property. - */ - @JsonProperty(value = "issues", access = JsonProperty.Access.WRITE_ONLY) - private List issues; - - /* - * The source type of the machine group - */ - @JsonProperty(value = "sourceSystem", access = JsonProperty.Access.WRITE_ONLY) - private SourceSystem sourceSystem; - - /* - * The vmRecommendations property. - */ - @JsonProperty(value = "vmRecommendations") - private List vmRecommendations; - - /* - * The pathRecommendations property. - */ - @JsonProperty(value = "pathRecommendations") - private List pathRecommendations; - - /** - * Creates an instance of AdaptiveApplicationControlGroupData class. - */ - public AdaptiveApplicationControlGroupData() { - } - - /** - * Get the enforcementMode property: The application control policy enforcement/protection mode of the machine - * group. - * - * @return the enforcementMode value. - */ - public EnforcementMode enforcementMode() { - return this.enforcementMode; - } - - /** - * Set the enforcementMode property: The application control policy enforcement/protection mode of the machine - * group. - * - * @param enforcementMode the enforcementMode value to set. - * @return the AdaptiveApplicationControlGroupData object itself. - */ - public AdaptiveApplicationControlGroupData withEnforcementMode(EnforcementMode enforcementMode) { - this.enforcementMode = enforcementMode; - return this; - } - - /** - * Get the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script are used for - * Windows, Executable is used for Linux. - * - * @return the protectionMode value. - */ - public ProtectionMode protectionMode() { - return this.protectionMode; - } - - /** - * Set the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script are used for - * Windows, Executable is used for Linux. - * - * @param protectionMode the protectionMode value to set. - * @return the AdaptiveApplicationControlGroupData object itself. - */ - public AdaptiveApplicationControlGroupData withProtectionMode(ProtectionMode protectionMode) { - this.protectionMode = protectionMode; - return this; - } - - /** - * Get the configurationStatus property: The configuration status of the machines group or machine or rule. - * - * @return the configurationStatus value. - */ - public ConfigurationStatus configurationStatus() { - return this.configurationStatus; - } - - /** - * Get the recommendationStatus property: The initial recommendation status of the machine group or machine. - * - * @return the recommendationStatus value. - */ - public RecommendationStatus recommendationStatus() { - return this.recommendationStatus; - } - - /** - * Get the issues property: The issues property. - * - * @return the issues value. - */ - public List issues() { - return this.issues; - } - - /** - * Get the sourceSystem property: The source type of the machine group. - * - * @return the sourceSystem value. - */ - public SourceSystem sourceSystem() { - return this.sourceSystem; - } - - /** - * Get the vmRecommendations property: The vmRecommendations property. - * - * @return the vmRecommendations value. - */ - public List vmRecommendations() { - return this.vmRecommendations; - } - - /** - * Set the vmRecommendations property: The vmRecommendations property. - * - * @param vmRecommendations the vmRecommendations value to set. - * @return the AdaptiveApplicationControlGroupData object itself. - */ - public AdaptiveApplicationControlGroupData withVmRecommendations(List vmRecommendations) { - this.vmRecommendations = vmRecommendations; - return this; - } - - /** - * Get the pathRecommendations property: The pathRecommendations property. - * - * @return the pathRecommendations value. - */ - public List pathRecommendations() { - return this.pathRecommendations; - } - - /** - * Set the pathRecommendations property: The pathRecommendations property. - * - * @param pathRecommendations the pathRecommendations value to set. - * @return the AdaptiveApplicationControlGroupData object itself. - */ - public AdaptiveApplicationControlGroupData withPathRecommendations(List pathRecommendations) { - this.pathRecommendations = pathRecommendations; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (protectionMode() != null) { - protectionMode().validate(); - } - if (issues() != null) { - issues().forEach(e -> e.validate()); - } - if (vmRecommendations() != null) { - vmRecommendations().forEach(e -> e.validate()); - } - if (pathRecommendations() != null) { - pathRecommendations().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupInner.java deleted file mode 100644 index 51453b85a897..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupInner.java +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControlIssueSummary; -import com.azure.resourcemanager.security.models.ConfigurationStatus; -import com.azure.resourcemanager.security.models.EnforcementMode; -import com.azure.resourcemanager.security.models.PathRecommendation; -import com.azure.resourcemanager.security.models.ProtectionMode; -import com.azure.resourcemanager.security.models.RecommendationStatus; -import com.azure.resourcemanager.security.models.SourceSystem; -import com.azure.resourcemanager.security.models.VmRecommendation; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** - * The AdaptiveApplicationControlGroup model. - */ -@Fluent -public final class AdaptiveApplicationControlGroupInner extends ProxyResource { - /* - * Represents a machines group and set of rules to be allowed running on a machine - */ - @JsonProperty(value = "properties", required = true) - private AdaptiveApplicationControlGroupData innerProperties = new AdaptiveApplicationControlGroupData(); - - /* - * Location where the resource is stored - */ - @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) - private String location; - - /** - * Creates an instance of AdaptiveApplicationControlGroupInner class. - */ - public AdaptiveApplicationControlGroupInner() { - } - - /** - * Get the innerProperties property: Represents a machines group and set of rules to be allowed running on a - * machine. - * - * @return the innerProperties value. - */ - private AdaptiveApplicationControlGroupData innerProperties() { - return this.innerProperties; - } - - /** - * Get the location property: Location where the resource is stored. - * - * @return the location value. - */ - public String location() { - return this.location; - } - - /** - * Get the enforcementMode property: The application control policy enforcement/protection mode of the machine - * group. - * - * @return the enforcementMode value. - */ - public EnforcementMode enforcementMode() { - return this.innerProperties() == null ? null : this.innerProperties().enforcementMode(); - } - - /** - * Set the enforcementMode property: The application control policy enforcement/protection mode of the machine - * group. - * - * @param enforcementMode the enforcementMode value to set. - * @return the AdaptiveApplicationControlGroupInner object itself. - */ - public AdaptiveApplicationControlGroupInner withEnforcementMode(EnforcementMode enforcementMode) { - if (this.innerProperties() == null) { - this.innerProperties = new AdaptiveApplicationControlGroupData(); - } - this.innerProperties().withEnforcementMode(enforcementMode); - return this; - } - - /** - * Get the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script are used for - * Windows, Executable is used for Linux. - * - * @return the protectionMode value. - */ - public ProtectionMode protectionMode() { - return this.innerProperties() == null ? null : this.innerProperties().protectionMode(); - } - - /** - * Set the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script are used for - * Windows, Executable is used for Linux. - * - * @param protectionMode the protectionMode value to set. - * @return the AdaptiveApplicationControlGroupInner object itself. - */ - public AdaptiveApplicationControlGroupInner withProtectionMode(ProtectionMode protectionMode) { - if (this.innerProperties() == null) { - this.innerProperties = new AdaptiveApplicationControlGroupData(); - } - this.innerProperties().withProtectionMode(protectionMode); - return this; - } - - /** - * Get the configurationStatus property: The configuration status of the machines group or machine or rule. - * - * @return the configurationStatus value. - */ - public ConfigurationStatus configurationStatus() { - return this.innerProperties() == null ? null : this.innerProperties().configurationStatus(); - } - - /** - * Get the recommendationStatus property: The initial recommendation status of the machine group or machine. - * - * @return the recommendationStatus value. - */ - public RecommendationStatus recommendationStatus() { - return this.innerProperties() == null ? null : this.innerProperties().recommendationStatus(); - } - - /** - * Get the issues property: The issues property. - * - * @return the issues value. - */ - public List issues() { - return this.innerProperties() == null ? null : this.innerProperties().issues(); - } - - /** - * Get the sourceSystem property: The source type of the machine group. - * - * @return the sourceSystem value. - */ - public SourceSystem sourceSystem() { - return this.innerProperties() == null ? null : this.innerProperties().sourceSystem(); - } - - /** - * Get the vmRecommendations property: The vmRecommendations property. - * - * @return the vmRecommendations value. - */ - public List vmRecommendations() { - return this.innerProperties() == null ? null : this.innerProperties().vmRecommendations(); - } - - /** - * Set the vmRecommendations property: The vmRecommendations property. - * - * @param vmRecommendations the vmRecommendations value to set. - * @return the AdaptiveApplicationControlGroupInner object itself. - */ - public AdaptiveApplicationControlGroupInner withVmRecommendations(List vmRecommendations) { - if (this.innerProperties() == null) { - this.innerProperties = new AdaptiveApplicationControlGroupData(); - } - this.innerProperties().withVmRecommendations(vmRecommendations); - return this; - } - - /** - * Get the pathRecommendations property: The pathRecommendations property. - * - * @return the pathRecommendations value. - */ - public List pathRecommendations() { - return this.innerProperties() == null ? null : this.innerProperties().pathRecommendations(); - } - - /** - * Set the pathRecommendations property: The pathRecommendations property. - * - * @param pathRecommendations the pathRecommendations value to set. - * @return the AdaptiveApplicationControlGroupInner object itself. - */ - public AdaptiveApplicationControlGroupInner withPathRecommendations(List pathRecommendations) { - if (this.innerProperties() == null) { - this.innerProperties = new AdaptiveApplicationControlGroupData(); - } - this.innerProperties().withPathRecommendations(pathRecommendations); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerProperties in model AdaptiveApplicationControlGroupInner")); - } else { - innerProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(AdaptiveApplicationControlGroupInner.class); -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupsInner.java deleted file mode 100644 index ae5363f4d983..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveApplicationControlGroupsInner.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** - * Represents a list of VM/server groups and set of rules that are Recommended by Microsoft Defender for Cloud to be - * allowed. - */ -@Fluent -public final class AdaptiveApplicationControlGroupsInner { - /* - * The value property. - */ - @JsonProperty(value = "value") - private List value; - - /** - * Creates an instance of AdaptiveApplicationControlGroupsInner class. - */ - public AdaptiveApplicationControlGroupsInner() { - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: The value property. - * - * @param value the value value to set. - * @return the AdaptiveApplicationControlGroupsInner object itself. - */ - public AdaptiveApplicationControlGroupsInner withValue(List value) { - this.value = value; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningInner.java deleted file mode 100644 index 5f390e92a4f0..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningInner.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.resourcemanager.security.models.EffectiveNetworkSecurityGroups; -import com.azure.resourcemanager.security.models.Rule; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; -import java.util.List; - -/** - * The resource whose properties describes the Adaptive Network Hardening settings for some Azure resource. - */ -@Fluent -public final class AdaptiveNetworkHardeningInner extends ProxyResource { - /* - * Properties of the Adaptive Network Hardening resource - */ - @JsonProperty(value = "properties") - private AdaptiveNetworkHardeningProperties innerProperties; - - /** - * Creates an instance of AdaptiveNetworkHardeningInner class. - */ - public AdaptiveNetworkHardeningInner() { - } - - /** - * Get the innerProperties property: Properties of the Adaptive Network Hardening resource. - * - * @return the innerProperties value. - */ - private AdaptiveNetworkHardeningProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the rules property: The security rules which are recommended to be effective on the VM. - * - * @return the rules value. - */ - public List rules() { - return this.innerProperties() == null ? null : this.innerProperties().rules(); - } - - /** - * Set the rules property: The security rules which are recommended to be effective on the VM. - * - * @param rules the rules value to set. - * @return the AdaptiveNetworkHardeningInner object itself. - */ - public AdaptiveNetworkHardeningInner withRules(List rules) { - if (this.innerProperties() == null) { - this.innerProperties = new AdaptiveNetworkHardeningProperties(); - } - this.innerProperties().withRules(rules); - return this; - } - - /** - * Get the rulesCalculationTime property: The UTC time on which the rules were calculated. - * - * @return the rulesCalculationTime value. - */ - public OffsetDateTime rulesCalculationTime() { - return this.innerProperties() == null ? null : this.innerProperties().rulesCalculationTime(); - } - - /** - * Set the rulesCalculationTime property: The UTC time on which the rules were calculated. - * - * @param rulesCalculationTime the rulesCalculationTime value to set. - * @return the AdaptiveNetworkHardeningInner object itself. - */ - public AdaptiveNetworkHardeningInner withRulesCalculationTime(OffsetDateTime rulesCalculationTime) { - if (this.innerProperties() == null) { - this.innerProperties = new AdaptiveNetworkHardeningProperties(); - } - this.innerProperties().withRulesCalculationTime(rulesCalculationTime); - return this; - } - - /** - * Get the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces - * of the protected resource. - * - * @return the effectiveNetworkSecurityGroups value. - */ - public List effectiveNetworkSecurityGroups() { - return this.innerProperties() == null ? null : this.innerProperties().effectiveNetworkSecurityGroups(); - } - - /** - * Set the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces - * of the protected resource. - * - * @param effectiveNetworkSecurityGroups the effectiveNetworkSecurityGroups value to set. - * @return the AdaptiveNetworkHardeningInner object itself. - */ - public AdaptiveNetworkHardeningInner - withEffectiveNetworkSecurityGroups(List effectiveNetworkSecurityGroups) { - if (this.innerProperties() == null) { - this.innerProperties = new AdaptiveNetworkHardeningProperties(); - } - this.innerProperties().withEffectiveNetworkSecurityGroups(effectiveNetworkSecurityGroups); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningProperties.java deleted file mode 100644 index c17319b56de3..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdaptiveNetworkHardeningProperties.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.security.models.EffectiveNetworkSecurityGroups; -import com.azure.resourcemanager.security.models.Rule; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; -import java.util.List; - -/** - * Adaptive Network Hardening resource properties. - */ -@Fluent -public final class AdaptiveNetworkHardeningProperties { - /* - * The security rules which are recommended to be effective on the VM - */ - @JsonProperty(value = "rules") - private List rules; - - /* - * The UTC time on which the rules were calculated - */ - @JsonProperty(value = "rulesCalculationTime") - private OffsetDateTime rulesCalculationTime; - - /* - * The Network Security Groups effective on the network interfaces of the protected resource - */ - @JsonProperty(value = "effectiveNetworkSecurityGroups") - private List effectiveNetworkSecurityGroups; - - /** - * Creates an instance of AdaptiveNetworkHardeningProperties class. - */ - public AdaptiveNetworkHardeningProperties() { - } - - /** - * Get the rules property: The security rules which are recommended to be effective on the VM. - * - * @return the rules value. - */ - public List rules() { - return this.rules; - } - - /** - * Set the rules property: The security rules which are recommended to be effective on the VM. - * - * @param rules the rules value to set. - * @return the AdaptiveNetworkHardeningProperties object itself. - */ - public AdaptiveNetworkHardeningProperties withRules(List rules) { - this.rules = rules; - return this; - } - - /** - * Get the rulesCalculationTime property: The UTC time on which the rules were calculated. - * - * @return the rulesCalculationTime value. - */ - public OffsetDateTime rulesCalculationTime() { - return this.rulesCalculationTime; - } - - /** - * Set the rulesCalculationTime property: The UTC time on which the rules were calculated. - * - * @param rulesCalculationTime the rulesCalculationTime value to set. - * @return the AdaptiveNetworkHardeningProperties object itself. - */ - public AdaptiveNetworkHardeningProperties withRulesCalculationTime(OffsetDateTime rulesCalculationTime) { - this.rulesCalculationTime = rulesCalculationTime; - return this; - } - - /** - * Get the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces - * of the protected resource. - * - * @return the effectiveNetworkSecurityGroups value. - */ - public List effectiveNetworkSecurityGroups() { - return this.effectiveNetworkSecurityGroups; - } - - /** - * Set the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces - * of the protected resource. - * - * @param effectiveNetworkSecurityGroups the effectiveNetworkSecurityGroups value to set. - * @return the AdaptiveNetworkHardeningProperties object itself. - */ - public AdaptiveNetworkHardeningProperties - withEffectiveNetworkSecurityGroups(List effectiveNetworkSecurityGroups) { - this.effectiveNetworkSecurityGroups = effectiveNetworkSecurityGroups; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (rules() != null) { - rules().forEach(e -> e.validate()); - } - if (effectiveNetworkSecurityGroups() != null) { - effectiveNetworkSecurityGroups().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionProperties.java index 76167c2ac2c9..ac862963f537 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionProperties.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Advanced Threat Protection settings. */ @Fluent -public final class AdvancedThreatProtectionProperties { +public final class AdvancedThreatProtectionProperties implements JsonSerializable { /* * Indicates whether Advanced Threat Protection is enabled. */ - @JsonProperty(value = "isEnabled") private Boolean isEnabled; /** @@ -51,4 +54,42 @@ public AdvancedThreatProtectionProperties withIsEnabled(Boolean isEnabled) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", this.isEnabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdvancedThreatProtectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdvancedThreatProtectionProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AdvancedThreatProtectionProperties. + */ + public static AdvancedThreatProtectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdvancedThreatProtectionProperties deserializedAdvancedThreatProtectionProperties + = new AdvancedThreatProtectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedAdvancedThreatProtectionProperties.isEnabled + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAdvancedThreatProtectionProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionSettingInner.java index 54ca2c870ac1..decd1c4a3528 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionSettingInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AdvancedThreatProtectionSettingInner.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Advanced Threat Protection resource. @@ -16,9 +19,23 @@ public final class AdvancedThreatProtectionSettingInner extends ProxyResource { /* * The Advanced Threat Protection settings. */ - @JsonProperty(value = "properties") private AdvancedThreatProtectionProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AdvancedThreatProtectionSettingInner class. */ @@ -34,6 +51,36 @@ private AdvancedThreatProtectionProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the isEnabled property: Indicates whether Advanced Threat Protection is enabled. * @@ -67,4 +114,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdvancedThreatProtectionSettingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdvancedThreatProtectionSettingInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AdvancedThreatProtectionSettingInner. + */ + public static AdvancedThreatProtectionSettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdvancedThreatProtectionSettingInner deserializedAdvancedThreatProtectionSettingInner + = new AdvancedThreatProtectionSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAdvancedThreatProtectionSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAdvancedThreatProtectionSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAdvancedThreatProtectionSettingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAdvancedThreatProtectionSettingInner.innerProperties + = AdvancedThreatProtectionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAdvancedThreatProtectionSettingInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertInner.java index 1280f5d3ce19..aeaef63006ef 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertInner.java @@ -6,13 +6,16 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AlertEntity; import com.azure.resourcemanager.security.models.AlertPropertiesSupportingEvidence; import com.azure.resourcemanager.security.models.AlertSeverity; import com.azure.resourcemanager.security.models.AlertStatus; import com.azure.resourcemanager.security.models.Intent; import com.azure.resourcemanager.security.models.ResourceIdentifier; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; import java.util.Map; @@ -25,9 +28,23 @@ public final class AlertInner extends ProxyResource { /* * describes security alert properties. */ - @JsonProperty(value = "properties") private AlertProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AlertInner class. */ @@ -43,6 +60,36 @@ private AlertProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the version property: Schema version. * @@ -335,4 +382,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AlertInner. + */ + public static AlertInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertInner deserializedAlertInner = new AlertInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAlertInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAlertInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAlertInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAlertInner.innerProperties = AlertProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertProperties.java index 934629652615..292faba35f83 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertProperties.java @@ -5,14 +5,18 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AlertEntity; import com.azure.resourcemanager.security.models.AlertPropertiesSupportingEvidence; import com.azure.resourcemanager.security.models.AlertSeverity; import com.azure.resourcemanager.security.models.AlertStatus; import com.azure.resourcemanager.security.models.Intent; import com.azure.resourcemanager.security.models.ResourceIdentifier; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; import java.util.Map; @@ -21,168 +25,146 @@ * describes security alert properties. */ @Fluent -public final class AlertProperties { +public final class AlertProperties implements JsonSerializable { /* * Schema version. */ - @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) private String version; /* - * Unique identifier for the detection logic (all alert instances from the same detection logic will have the same alertType). + * Unique identifier for the detection logic (all alert instances from the same detection logic will have the same + * alertType). */ - @JsonProperty(value = "alertType", access = JsonProperty.Access.WRITE_ONLY) private String alertType; /* * Unique identifier for the alert. */ - @JsonProperty(value = "systemAlertId", access = JsonProperty.Access.WRITE_ONLY) private String systemAlertId; /* - * The name of Azure Security Center pricing tier which powering this alert. Learn more: https://docs.microsoft.com/en-us/azure/security-center/security-center-pricing + * The name of Azure Security Center pricing tier which powering this alert. Learn more: + * https://docs.microsoft.com/en-us/azure/security-center/security-center-pricing */ - @JsonProperty(value = "productComponentName", access = JsonProperty.Access.WRITE_ONLY) private String productComponentName; /* * The display name of the alert. */ - @JsonProperty(value = "alertDisplayName", access = JsonProperty.Access.WRITE_ONLY) private String alertDisplayName; /* * Description of the suspicious activity that was detected. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* - * The risk level of the threat that was detected. Learn more: https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. + * The risk level of the threat that was detected. Learn more: + * https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. */ - @JsonProperty(value = "severity", access = JsonProperty.Access.WRITE_ONLY) private AlertSeverity severity; /* - * The kill chain related intent behind the alert. For list of supported values, and explanations of Azure Security Center's supported kill chain intents. + * The kill chain related intent behind the alert. For list of supported values, and explanations of Azure Security + * Center's supported kill chain intents. */ - @JsonProperty(value = "intent", access = JsonProperty.Access.WRITE_ONLY) private Intent intent; /* * The UTC time of the first event or activity included in the alert in ISO8601 format. */ - @JsonProperty(value = "startTimeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime startTimeUtc; /* * The UTC time of the last event or activity included in the alert in ISO8601 format. */ - @JsonProperty(value = "endTimeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime endTimeUtc; /* - * The resource identifiers that can be used to direct the alert to the right product exposure group (tenant, workspace, subscription etc.). There can be multiple identifiers of different type per alert. + * The resource identifiers that can be used to direct the alert to the right product exposure group (tenant, + * workspace, subscription etc.). There can be multiple identifiers of different type per alert. */ - @JsonProperty(value = "resourceIdentifiers", access = JsonProperty.Access.WRITE_ONLY) private List resourceIdentifiers; /* * Manual action items to take to remediate the alert. */ - @JsonProperty(value = "remediationSteps", access = JsonProperty.Access.WRITE_ONLY) private List remediationSteps; /* * The name of the vendor that raises the alert. */ - @JsonProperty(value = "vendorName", access = JsonProperty.Access.WRITE_ONLY) private String vendorName; /* * The life cycle status of the alert. */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private AlertStatus status; /* * Links related to the alert */ - @JsonProperty(value = "extendedLinks", access = JsonProperty.Access.WRITE_ONLY) private List> extendedLinks; /* * A direct link to the alert page in Azure Portal. */ - @JsonProperty(value = "alertUri", access = JsonProperty.Access.WRITE_ONLY) private String alertUri; /* * The UTC time the alert was generated in ISO8601 format. */ - @JsonProperty(value = "timeGeneratedUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime timeGeneratedUtc; /* - * The name of the product which published this alert (Microsoft Sentinel, Microsoft Defender for Identity, Microsoft Defender for Endpoint, Microsoft Defender for Office, Microsoft Defender for Cloud Apps, and so on). + * The name of the product which published this alert (Microsoft Sentinel, Microsoft Defender for Identity, + * Microsoft Defender for Endpoint, Microsoft Defender for Office, Microsoft Defender for Cloud Apps, and so on). */ - @JsonProperty(value = "productName", access = JsonProperty.Access.WRITE_ONLY) private String productName; /* * The UTC processing end time of the alert in ISO8601 format. */ - @JsonProperty(value = "processingEndTimeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime processingEndTimeUtc; /* * A list of entities related to the alert. */ - @JsonProperty(value = "entities", access = JsonProperty.Access.WRITE_ONLY) private List entities; /* * This field determines whether the alert is an incident (a compound grouping of several alerts) or a single alert. */ - @JsonProperty(value = "isIncident", access = JsonProperty.Access.WRITE_ONLY) private Boolean isIncident; /* * Key for corelating related alerts. Alerts with the same correlation key considered to be related. */ - @JsonProperty(value = "correlationKey", access = JsonProperty.Access.WRITE_ONLY) private String correlationKey; /* * Custom properties for the alert. */ - @JsonProperty(value = "extendedProperties") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map extendedProperties; /* * The display name of the resource most related to this alert. */ - @JsonProperty(value = "compromisedEntity", access = JsonProperty.Access.WRITE_ONLY) private String compromisedEntity; /* * kill chain related techniques behind the alert. */ - @JsonProperty(value = "techniques", access = JsonProperty.Access.WRITE_ONLY) private List techniques; /* * Kill chain related sub-techniques behind the alert. */ - @JsonProperty(value = "subTechniques", access = JsonProperty.Access.WRITE_ONLY) private List subTechniques; /* * Changing set of properties depending on the supportingEvidence type. */ - @JsonProperty(value = "supportingEvidence") private AlertPropertiesSupportingEvidence supportingEvidence; /** @@ -483,4 +465,107 @@ public void validate() { supportingEvidence().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("extendedProperties", this.extendedProperties, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("supportingEvidence", this.supportingEvidence); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AlertProperties. + */ + public static AlertProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertProperties deserializedAlertProperties = new AlertProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("version".equals(fieldName)) { + deserializedAlertProperties.version = reader.getString(); + } else if ("alertType".equals(fieldName)) { + deserializedAlertProperties.alertType = reader.getString(); + } else if ("systemAlertId".equals(fieldName)) { + deserializedAlertProperties.systemAlertId = reader.getString(); + } else if ("productComponentName".equals(fieldName)) { + deserializedAlertProperties.productComponentName = reader.getString(); + } else if ("alertDisplayName".equals(fieldName)) { + deserializedAlertProperties.alertDisplayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedAlertProperties.description = reader.getString(); + } else if ("severity".equals(fieldName)) { + deserializedAlertProperties.severity = AlertSeverity.fromString(reader.getString()); + } else if ("intent".equals(fieldName)) { + deserializedAlertProperties.intent = Intent.fromString(reader.getString()); + } else if ("startTimeUtc".equals(fieldName)) { + deserializedAlertProperties.startTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTimeUtc".equals(fieldName)) { + deserializedAlertProperties.endTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("resourceIdentifiers".equals(fieldName)) { + List resourceIdentifiers + = reader.readArray(reader1 -> ResourceIdentifier.fromJson(reader1)); + deserializedAlertProperties.resourceIdentifiers = resourceIdentifiers; + } else if ("remediationSteps".equals(fieldName)) { + List remediationSteps = reader.readArray(reader1 -> reader1.getString()); + deserializedAlertProperties.remediationSteps = remediationSteps; + } else if ("vendorName".equals(fieldName)) { + deserializedAlertProperties.vendorName = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedAlertProperties.status = AlertStatus.fromString(reader.getString()); + } else if ("extendedLinks".equals(fieldName)) { + List> extendedLinks + = reader.readArray(reader1 -> reader1.readMap(reader2 -> reader2.getString())); + deserializedAlertProperties.extendedLinks = extendedLinks; + } else if ("alertUri".equals(fieldName)) { + deserializedAlertProperties.alertUri = reader.getString(); + } else if ("timeGeneratedUtc".equals(fieldName)) { + deserializedAlertProperties.timeGeneratedUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("productName".equals(fieldName)) { + deserializedAlertProperties.productName = reader.getString(); + } else if ("processingEndTimeUtc".equals(fieldName)) { + deserializedAlertProperties.processingEndTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("entities".equals(fieldName)) { + List entities = reader.readArray(reader1 -> AlertEntity.fromJson(reader1)); + deserializedAlertProperties.entities = entities; + } else if ("isIncident".equals(fieldName)) { + deserializedAlertProperties.isIncident = reader.getNullable(JsonReader::getBoolean); + } else if ("correlationKey".equals(fieldName)) { + deserializedAlertProperties.correlationKey = reader.getString(); + } else if ("extendedProperties".equals(fieldName)) { + Map extendedProperties = reader.readMap(reader1 -> reader1.getString()); + deserializedAlertProperties.extendedProperties = extendedProperties; + } else if ("compromisedEntity".equals(fieldName)) { + deserializedAlertProperties.compromisedEntity = reader.getString(); + } else if ("techniques".equals(fieldName)) { + List techniques = reader.readArray(reader1 -> reader1.getString()); + deserializedAlertProperties.techniques = techniques; + } else if ("subTechniques".equals(fieldName)) { + List subTechniques = reader.readArray(reader1 -> reader1.getString()); + deserializedAlertProperties.subTechniques = subTechniques; + } else if ("supportingEvidence".equals(fieldName)) { + deserializedAlertProperties.supportingEvidence = AlertPropertiesSupportingEvidence.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertSyncSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertSyncSettingProperties.java index 95d1855ae1f9..cda34775e356 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertSyncSettingProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertSyncSettingProperties.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The alert sync setting properties. */ @Fluent -public final class AlertSyncSettingProperties { +public final class AlertSyncSettingProperties implements JsonSerializable { /* * Is the alert sync setting enabled */ - @JsonProperty(value = "enabled", required = true) private boolean enabled; /** @@ -51,4 +54,41 @@ public AlertSyncSettingProperties withEnabled(boolean enabled) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertSyncSettingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertSyncSettingProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AlertSyncSettingProperties. + */ + public static AlertSyncSettingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertSyncSettingProperties deserializedAlertSyncSettingProperties = new AlertSyncSettingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedAlertSyncSettingProperties.enabled = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertSyncSettingProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleInner.java index 236997fedc02..b82361145a2d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleInner.java @@ -6,9 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.RuleState; import com.azure.resourcemanager.security.models.SuppressionAlertsScope; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** @@ -19,9 +22,23 @@ public final class AlertsSuppressionRuleInner extends ProxyResource { /* * describes AlertsSuppressionRule properties */ - @JsonProperty(value = "properties") private AlertsSuppressionRuleProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AlertsSuppressionRuleInner class. */ @@ -37,6 +54,36 @@ private AlertsSuppressionRuleProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the alertType property: Type of the alert to automatically suppress. For all alert types, use '*'. * @@ -196,4 +243,48 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertsSuppressionRuleInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertsSuppressionRuleInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AlertsSuppressionRuleInner. + */ + public static AlertsSuppressionRuleInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertsSuppressionRuleInner deserializedAlertsSuppressionRuleInner = new AlertsSuppressionRuleInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAlertsSuppressionRuleInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAlertsSuppressionRuleInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAlertsSuppressionRuleInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAlertsSuppressionRuleInner.innerProperties + = AlertsSuppressionRuleProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertsSuppressionRuleInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleProperties.java index 17fe283ad39d..b7d82f67d8ea 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AlertsSuppressionRuleProperties.java @@ -5,57 +5,56 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.RuleState; import com.azure.resourcemanager.security.models.SuppressionAlertsScope; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * describes AlertsSuppressionRule properties. */ @Fluent -public final class AlertsSuppressionRuleProperties { +public final class AlertsSuppressionRuleProperties implements JsonSerializable { /* * Type of the alert to automatically suppress. For all alert types, use '*' */ - @JsonProperty(value = "alertType", required = true) private String alertType; /* * The last time this rule was modified */ - @JsonProperty(value = "lastModifiedUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastModifiedUtc; /* * Expiration date of the rule, if value is not provided or provided as null there will no expiration at all */ - @JsonProperty(value = "expirationDateUtc") private OffsetDateTime expirationDateUtc; /* * The reason for dismissing the alert */ - @JsonProperty(value = "reason", required = true) private String reason; /* * Possible states of the rule */ - @JsonProperty(value = "state", required = true) private RuleState state; /* * Any comment regarding the rule */ - @JsonProperty(value = "comment") private String comment; /* * The suppression conditions */ - @JsonProperty(value = "suppressionAlertsScope") private SuppressionAlertsScope suppressionAlertsScope; /** @@ -222,4 +221,65 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AlertsSuppressionRuleProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("alertType", this.alertType); + jsonWriter.writeStringField("reason", this.reason); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("expirationDateUtc", + this.expirationDateUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expirationDateUtc)); + jsonWriter.writeStringField("comment", this.comment); + jsonWriter.writeJsonField("suppressionAlertsScope", this.suppressionAlertsScope); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertsSuppressionRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertsSuppressionRuleProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AlertsSuppressionRuleProperties. + */ + public static AlertsSuppressionRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertsSuppressionRuleProperties deserializedAlertsSuppressionRuleProperties + = new AlertsSuppressionRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertType".equals(fieldName)) { + deserializedAlertsSuppressionRuleProperties.alertType = reader.getString(); + } else if ("reason".equals(fieldName)) { + deserializedAlertsSuppressionRuleProperties.reason = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedAlertsSuppressionRuleProperties.state = RuleState.fromString(reader.getString()); + } else if ("lastModifiedUtc".equals(fieldName)) { + deserializedAlertsSuppressionRuleProperties.lastModifiedUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("expirationDateUtc".equals(fieldName)) { + deserializedAlertsSuppressionRuleProperties.expirationDateUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("comment".equals(fieldName)) { + deserializedAlertsSuppressionRuleProperties.comment = reader.getString(); + } else if ("suppressionAlertsScope".equals(fieldName)) { + deserializedAlertsSuppressionRuleProperties.suppressionAlertsScope + = SuppressionAlertsScope.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertsSuppressionRuleProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceInner.java index 8e5129cea270..afbc07bd351a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ConnectableResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -19,15 +22,28 @@ public final class AllowedConnectionsResourceInner extends ProxyResource { /* * Describes the allowed traffic between Azure resources */ - @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private AllowedConnectionsResourceProperties innerProperties; /* * Location where the resource is stored */ - @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) private String location; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AllowedConnectionsResourceInner class. */ @@ -52,6 +68,36 @@ public String location() { return this.location; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the calculatedDateTime property: The UTC time on which the allowed connections resource was calculated. * @@ -80,4 +126,50 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AllowedConnectionsResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AllowedConnectionsResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AllowedConnectionsResourceInner. + */ + public static AllowedConnectionsResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AllowedConnectionsResourceInner deserializedAllowedConnectionsResourceInner + = new AllowedConnectionsResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAllowedConnectionsResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAllowedConnectionsResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAllowedConnectionsResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAllowedConnectionsResourceInner.innerProperties + = AllowedConnectionsResourceProperties.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedAllowedConnectionsResourceInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAllowedConnectionsResourceInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceProperties.java index 65cec8ebc792..da1e8534ce59 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AllowedConnectionsResourceProperties.java @@ -5,8 +5,13 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ConnectableResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -14,17 +19,16 @@ * Describes the allowed traffic between Azure resources. */ @Immutable -public final class AllowedConnectionsResourceProperties { +public final class AllowedConnectionsResourceProperties + implements JsonSerializable { /* * The UTC time on which the allowed connections resource was calculated */ - @JsonProperty(value = "calculatedDateTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime calculatedDateTime; /* * List of connectable resources */ - @JsonProperty(value = "connectableResources", access = JsonProperty.Access.WRITE_ONLY) private List connectableResources; /** @@ -61,4 +65,45 @@ public void validate() { connectableResources().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AllowedConnectionsResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AllowedConnectionsResourceProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AllowedConnectionsResourceProperties. + */ + public static AllowedConnectionsResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AllowedConnectionsResourceProperties deserializedAllowedConnectionsResourceProperties + = new AllowedConnectionsResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("calculatedDateTime".equals(fieldName)) { + deserializedAllowedConnectionsResourceProperties.calculatedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("connectableResources".equals(fieldName)) { + List connectableResources + = reader.readArray(reader1 -> ConnectableResource.fromJson(reader1)); + deserializedAllowedConnectionsResourceProperties.connectableResources = connectableResources; + } else { + reader.skipChildren(); + } + } + + return deserializedAllowedConnectionsResourceProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApiCollectionInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApiCollectionInner.java index 91c637403e35..91caed5217f3 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApiCollectionInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApiCollectionInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * An API collection as represented by Microsoft Defender for APIs. @@ -17,9 +20,23 @@ public final class ApiCollectionInner extends ProxyResource { /* * Describes the properties of an API collection. */ - @JsonProperty(value = "properties") private ApiCollectionProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ApiCollectionInner class. */ @@ -35,6 +52,36 @@ private ApiCollectionProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the provisioningState property: Gets the provisioning state of the API collection. * @@ -143,4 +190,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiCollectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiCollectionInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApiCollectionInner. + */ + public static ApiCollectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiCollectionInner deserializedApiCollectionInner = new ApiCollectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedApiCollectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedApiCollectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedApiCollectionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedApiCollectionInner.innerProperties = ApiCollectionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedApiCollectionInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApiCollectionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApiCollectionProperties.java index 709ceccc5f22..522b33f0b84b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApiCollectionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApiCollectionProperties.java @@ -5,72 +5,67 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Describes the properties of an API collection. */ @Immutable -public final class ApiCollectionProperties { +public final class ApiCollectionProperties implements JsonSerializable { /* * Gets the provisioning state of the API collection. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ProvisioningState provisioningState; /* * The display name of the API collection. */ - @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) private String displayName; /* * The resource Id of the resource from where this API collection was discovered. */ - @JsonProperty(value = "discoveredVia", access = JsonProperty.Access.WRITE_ONLY) private String discoveredVia; /* * The base URI for this API collection. All endpoints of this API collection extend this base URI. */ - @JsonProperty(value = "baseUrl", access = JsonProperty.Access.WRITE_ONLY) private String baseUrl; /* * The number of API endpoints discovered in this API collection. */ - @JsonProperty(value = "numberOfApiEndpoints", access = JsonProperty.Access.WRITE_ONLY) private Long numberOfApiEndpoints; /* * The number of API endpoints in this API collection that have not received any API traffic in the last 30 days. */ - @JsonProperty(value = "numberOfInactiveApiEndpoints", access = JsonProperty.Access.WRITE_ONLY) private Long numberOfInactiveApiEndpoints; /* * The number of API endpoints in this API collection that are unauthenticated. */ - @JsonProperty(value = "numberOfUnauthenticatedApiEndpoints", access = JsonProperty.Access.WRITE_ONLY) private Long numberOfUnauthenticatedApiEndpoints; /* * The number of API endpoints in this API collection for which API traffic from the internet was observed. */ - @JsonProperty(value = "numberOfExternalApiEndpoints", access = JsonProperty.Access.WRITE_ONLY) private Long numberOfExternalApiEndpoints; /* - * The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or responses. + * The number of API endpoints in this API collection which are exposing sensitive data in their requests and/or + * responses. */ - @JsonProperty(value = "numberOfApiEndpointsWithSensitiveDataExposed", access = JsonProperty.Access.WRITE_ONLY) private Long numberOfApiEndpointsWithSensitiveDataExposed; /* * The highest priority sensitivity label from Microsoft Purview in this API collection. */ - @JsonProperty(value = "sensitivityLabel", access = JsonProperty.Access.WRITE_ONLY) private String sensitivityLabel; /** @@ -182,4 +177,62 @@ public String sensitivityLabel() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiCollectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiCollectionProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ApiCollectionProperties. + */ + public static ApiCollectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiCollectionProperties deserializedApiCollectionProperties = new ApiCollectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedApiCollectionProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedApiCollectionProperties.displayName = reader.getString(); + } else if ("discoveredVia".equals(fieldName)) { + deserializedApiCollectionProperties.discoveredVia = reader.getString(); + } else if ("baseUrl".equals(fieldName)) { + deserializedApiCollectionProperties.baseUrl = reader.getString(); + } else if ("numberOfApiEndpoints".equals(fieldName)) { + deserializedApiCollectionProperties.numberOfApiEndpoints = reader.getNullable(JsonReader::getLong); + } else if ("numberOfInactiveApiEndpoints".equals(fieldName)) { + deserializedApiCollectionProperties.numberOfInactiveApiEndpoints + = reader.getNullable(JsonReader::getLong); + } else if ("numberOfUnauthenticatedApiEndpoints".equals(fieldName)) { + deserializedApiCollectionProperties.numberOfUnauthenticatedApiEndpoints + = reader.getNullable(JsonReader::getLong); + } else if ("numberOfExternalApiEndpoints".equals(fieldName)) { + deserializedApiCollectionProperties.numberOfExternalApiEndpoints + = reader.getNullable(JsonReader::getLong); + } else if ("numberOfApiEndpointsWithSensitiveDataExposed".equals(fieldName)) { + deserializedApiCollectionProperties.numberOfApiEndpointsWithSensitiveDataExposed + = reader.getNullable(JsonReader::getLong); + } else if ("sensitivityLabel".equals(fieldName)) { + deserializedApiCollectionProperties.sensitivityLabel = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApiCollectionProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationInner.java index ec4589ff800d..15d33f5044d4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ApplicationSourceResourceType; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -18,9 +21,23 @@ public final class ApplicationInner extends ProxyResource { /* * Properties of a security application */ - @JsonProperty(value = "properties") private ApplicationProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ApplicationInner class. */ @@ -36,6 +53,36 @@ private ApplicationProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the displayName property: display name of the application. * @@ -138,4 +185,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApplicationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApplicationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApplicationInner. + */ + public static ApplicationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApplicationInner deserializedApplicationInner = new ApplicationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedApplicationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedApplicationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedApplicationInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedApplicationInner.innerProperties = ApplicationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedApplicationInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationProperties.java index e2c81bc98fe1..1945a5b0e02e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ApplicationProperties.java @@ -6,37 +6,37 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ApplicationSourceResourceType; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Describes properties of an application. */ @Fluent -public final class ApplicationProperties { +public final class ApplicationProperties implements JsonSerializable { /* * display name of the application */ - @JsonProperty(value = "displayName") private String displayName; /* * description of the application */ - @JsonProperty(value = "description") private String description; /* * The application source, what it affects, e.g. Assessments */ - @JsonProperty(value = "sourceResourceType", required = true) private ApplicationSourceResourceType sourceResourceType; /* * The application conditionSets - see examples */ - @JsonProperty(value = "conditionSets", required = true) private List conditionSets; /** @@ -144,4 +144,54 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(ApplicationProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceResourceType", + this.sourceResourceType == null ? null : this.sourceResourceType.toString()); + jsonWriter.writeArrayField("conditionSets", this.conditionSets, + (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApplicationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApplicationProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApplicationProperties. + */ + public static ApplicationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApplicationProperties deserializedApplicationProperties = new ApplicationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceResourceType".equals(fieldName)) { + deserializedApplicationProperties.sourceResourceType + = ApplicationSourceResourceType.fromString(reader.getString()); + } else if ("conditionSets".equals(fieldName)) { + List conditionSets = reader.readArray(reader1 -> reader1.readUntyped()); + deserializedApplicationProperties.conditionSets = conditionSets; + } else if ("displayName".equals(fieldName)) { + deserializedApplicationProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedApplicationProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApplicationProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AscLocationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AscLocationInner.java index 698386ce9650..8293bd0662fd 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AscLocationInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AscLocationInner.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The ASC location of the subscription is in the "name" field. @@ -16,9 +19,23 @@ public final class AscLocationInner extends ProxyResource { /* * An empty set of properties */ - @JsonProperty(value = "properties") private Object properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AscLocationInner class. */ @@ -45,6 +62,36 @@ public AscLocationInner withProperties(Object properties) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -52,4 +99,47 @@ public AscLocationInner withProperties(Object properties) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeUntypedField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AscLocationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AscLocationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AscLocationInner. + */ + public static AscLocationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AscLocationInner deserializedAscLocationInner = new AscLocationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAscLocationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAscLocationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAscLocationInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAscLocationInner.properties = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedAscLocationInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java index 925be47a8c8d..0b5606d53831 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AutoProvision; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Auto provisioning setting. @@ -17,9 +20,23 @@ public final class AutoProvisioningSettingInner extends ProxyResource { /* * Auto provisioning setting data */ - @JsonProperty(value = "properties") private AutoProvisioningSettingProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AutoProvisioningSettingInner class. */ @@ -35,6 +52,36 @@ private AutoProvisioningSettingProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the autoProvision property: Describes what kind of security agent provisioning action to take. * @@ -68,4 +115,48 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutoProvisioningSettingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutoProvisioningSettingInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AutoProvisioningSettingInner. + */ + public static AutoProvisioningSettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutoProvisioningSettingInner deserializedAutoProvisioningSettingInner = new AutoProvisioningSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAutoProvisioningSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAutoProvisioningSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAutoProvisioningSettingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAutoProvisioningSettingInner.innerProperties + = AutoProvisioningSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAutoProvisioningSettingInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingProperties.java index fcdf5bc70695..8919653efa8c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutoProvisioningSettingProperties.java @@ -6,18 +6,21 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AutoProvision; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * describes properties of an auto provisioning setting. */ @Fluent -public final class AutoProvisioningSettingProperties { +public final class AutoProvisioningSettingProperties implements JsonSerializable { /* * Describes what kind of security agent provisioning action to take */ - @JsonProperty(value = "autoProvision", required = true) private AutoProvision autoProvision; /** @@ -60,4 +63,43 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AutoProvisioningSettingProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("autoProvision", this.autoProvision == null ? null : this.autoProvision.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutoProvisioningSettingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutoProvisioningSettingProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AutoProvisioningSettingProperties. + */ + public static AutoProvisioningSettingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutoProvisioningSettingProperties deserializedAutoProvisioningSettingProperties + = new AutoProvisioningSettingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("autoProvision".equals(fieldName)) { + deserializedAutoProvisioningSettingProperties.autoProvision + = AutoProvision.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAutoProvisioningSettingProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationInner.java index 6891382e4f17..e34ac40396a3 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationInner.java @@ -6,10 +6,13 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AutomationAction; import com.azure.resourcemanager.security.models.AutomationScope; import com.azure.resourcemanager.security.models.AutomationSource; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -21,9 +24,23 @@ public final class AutomationInner extends Resource { /* * Security automation data */ - @JsonProperty(value = "properties") private AutomationProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AutomationInner class. */ @@ -39,6 +56,36 @@ private AutomationProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -190,4 +237,54 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AutomationInner. + */ + public static AutomationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationInner deserializedAutomationInner = new AutomationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAutomationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAutomationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAutomationInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAutomationInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAutomationInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedAutomationInner.innerProperties = AutomationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationProperties.java index f474fa43fb72..4fba434b798f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationProperties.java @@ -5,10 +5,14 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AutomationAction; import com.azure.resourcemanager.security.models.AutomationScope; import com.azure.resourcemanager.security.models.AutomationSource; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -16,35 +20,32 @@ * security events data models schemas - please visit https://aka.ms/ASCAutomationSchemas. */ @Fluent -public final class AutomationProperties { +public final class AutomationProperties implements JsonSerializable { /* * The security automation description. */ - @JsonProperty(value = "description") private String description; /* * Indicates whether the security automation is enabled. */ - @JsonProperty(value = "isEnabled") private Boolean isEnabled; /* - * A collection of scopes on which the security automations logic is applied. Supported scopes are the subscription itself or a resource group under that subscription. The automation will only apply on defined scopes. + * A collection of scopes on which the security automations logic is applied. Supported scopes are the subscription + * itself or a resource group under that subscription. The automation will only apply on defined scopes. */ - @JsonProperty(value = "scopes") private List scopes; /* * A collection of the source event types which evaluate the security automation set of rules. */ - @JsonProperty(value = "sources") private List sources; /* - * A collection of the actions which are triggered if all the configured rules evaluations, within at least one rule set, are true. + * A collection of the actions which are triggered if all the configured rules evaluations, within at least one rule + * set, are true. */ - @JsonProperty(value = "actions") private List actions; /** @@ -177,4 +178,55 @@ public void validate() { actions().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeBooleanField("isEnabled", this.isEnabled); + jsonWriter.writeArrayField("scopes", this.scopes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("sources", this.sources, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("actions", this.actions, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationProperties. + */ + public static AutomationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationProperties deserializedAutomationProperties = new AutomationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAutomationProperties.description = reader.getString(); + } else if ("isEnabled".equals(fieldName)) { + deserializedAutomationProperties.isEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("scopes".equals(fieldName)) { + List scopes = reader.readArray(reader1 -> AutomationScope.fromJson(reader1)); + deserializedAutomationProperties.scopes = scopes; + } else if ("sources".equals(fieldName)) { + List sources = reader.readArray(reader1 -> AutomationSource.fromJson(reader1)); + deserializedAutomationProperties.sources = sources; + } else if ("actions".equals(fieldName)) { + List actions = reader.readArray(reader1 -> AutomationAction.fromJson(reader1)); + deserializedAutomationProperties.actions = actions; + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationValidationStatusInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationValidationStatusInner.java index 7ebb43e68de0..8d5aaeebcd88 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationValidationStatusInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AutomationValidationStatusInner.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The security automation model state property bag. */ @Fluent -public final class AutomationValidationStatusInner { +public final class AutomationValidationStatusInner implements JsonSerializable { /* * Indicates whether the model is valid or not. */ - @JsonProperty(value = "isValid") private Boolean isValid; /* * The validation message. */ - @JsonProperty(value = "message") private String message; /** @@ -77,4 +79,44 @@ public AutomationValidationStatusInner withMessage(String message) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isValid", this.isValid); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationValidationStatusInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationValidationStatusInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationValidationStatusInner. + */ + public static AutomationValidationStatusInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationValidationStatusInner deserializedAutomationValidationStatusInner + = new AutomationValidationStatusInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isValid".equals(fieldName)) { + deserializedAutomationValidationStatusInner.isValid = reader.getNullable(JsonReader::getBoolean); + } else if ("message".equals(fieldName)) { + deserializedAutomationValidationStatusInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationValidationStatusInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgInner.java index 65a89d987a17..3e1809971204 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AzureDevOpsOrgProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Azure DevOps Organization resource. @@ -18,15 +21,28 @@ public final class AzureDevOpsOrgInner extends ProxyResource { /* * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * Azure DevOps Organization properties. */ - @JsonProperty(value = "properties") private AzureDevOpsOrgProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AzureDevOpsOrgInner class. */ @@ -62,6 +78,36 @@ public AzureDevOpsOrgInner withProperties(AzureDevOpsOrgProperties properties) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsOrgInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsOrgInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureDevOpsOrgInner. + */ + public static AzureDevOpsOrgInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsOrgInner deserializedAzureDevOpsOrgInner = new AzureDevOpsOrgInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzureDevOpsOrgInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAzureDevOpsOrgInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAzureDevOpsOrgInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAzureDevOpsOrgInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedAzureDevOpsOrgInner.properties = AzureDevOpsOrgProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsOrgInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgListResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgListResponseInner.java index d84170ba3669..d1108a13c731 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgListResponseInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsOrgListResponseInner.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * List of RP resources which supports pagination. */ @Fluent -public final class AzureDevOpsOrgListResponseInner { +public final class AzureDevOpsOrgListResponseInner implements JsonSerializable { /* * Gets or sets list of resources. */ - @JsonProperty(value = "value") private List value; /* * Gets or sets next link to scroll over the results. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -81,4 +83,46 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsOrgListResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsOrgListResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsOrgListResponseInner. + */ + public static AzureDevOpsOrgListResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsOrgListResponseInner deserializedAzureDevOpsOrgListResponseInner + = new AzureDevOpsOrgListResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AzureDevOpsOrgInner.fromJson(reader1)); + deserializedAzureDevOpsOrgListResponseInner.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAzureDevOpsOrgListResponseInner.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsOrgListResponseInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsProjectInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsProjectInner.java index 0b80eb4533bd..0bb3e8f5dfc5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsProjectInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsProjectInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AzureDevOpsProjectProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Azure DevOps Project resource. @@ -18,15 +21,28 @@ public final class AzureDevOpsProjectInner extends ProxyResource { /* * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * Azure DevOps Project properties. */ - @JsonProperty(value = "properties") private AzureDevOpsProjectProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AzureDevOpsProjectInner class. */ @@ -62,6 +78,36 @@ public AzureDevOpsProjectInner withProperties(AzureDevOpsProjectProperties prope return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsProjectInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsProjectInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureDevOpsProjectInner. + */ + public static AzureDevOpsProjectInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsProjectInner deserializedAzureDevOpsProjectInner = new AzureDevOpsProjectInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzureDevOpsProjectInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAzureDevOpsProjectInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAzureDevOpsProjectInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAzureDevOpsProjectInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedAzureDevOpsProjectInner.properties = AzureDevOpsProjectProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsProjectInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsRepositoryInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsRepositoryInner.java index ce96e9660324..9af9eb9f0ce4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsRepositoryInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/AzureDevOpsRepositoryInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AzureDevOpsRepositoryProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Azure DevOps Repository resource. @@ -18,15 +21,28 @@ public final class AzureDevOpsRepositoryInner extends ProxyResource { /* * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * Azure DevOps Repository properties. */ - @JsonProperty(value = "properties") private AzureDevOpsRepositoryProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AzureDevOpsRepositoryInner class. */ @@ -62,6 +78,36 @@ public AzureDevOpsRepositoryInner withProperties(AzureDevOpsRepositoryProperties return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -72,4 +118,50 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsRepositoryInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsRepositoryInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureDevOpsRepositoryInner. + */ + public static AzureDevOpsRepositoryInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsRepositoryInner deserializedAzureDevOpsRepositoryInner = new AzureDevOpsRepositoryInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzureDevOpsRepositoryInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAzureDevOpsRepositoryInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAzureDevOpsRepositoryInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAzureDevOpsRepositoryInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedAzureDevOpsRepositoryInner.properties + = AzureDevOpsRepositoryProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsRepositoryInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java index d45d5bac29dd..4a7e8c4e1d19 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ComplianceSegment; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -19,9 +22,23 @@ public final class ComplianceInner extends ProxyResource { /* * Compliance data */ - @JsonProperty(value = "properties") private ComplianceProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ComplianceInner class. */ @@ -37,6 +54,36 @@ private ComplianceProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the assessmentTimestampUtcDate property: The timestamp when the Compliance calculation was conducted. * @@ -75,4 +122,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComplianceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComplianceInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ComplianceInner. + */ + public static ComplianceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComplianceInner deserializedComplianceInner = new ComplianceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedComplianceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedComplianceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedComplianceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedComplianceInner.innerProperties = ComplianceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedComplianceInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceProperties.java index def356c1586b..3e0378f14669 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceProperties.java @@ -5,8 +5,13 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ComplianceSegment; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -16,23 +21,21 @@ * Definitions applicable to a given resource. */ @Immutable -public final class ComplianceProperties { +public final class ComplianceProperties implements JsonSerializable { /* * The timestamp when the Compliance calculation was conducted. */ - @JsonProperty(value = "assessmentTimestampUtcDate", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime assessmentTimestampUtcDate; /* - * The resource count of the given subscription for which the Compliance calculation was conducted (needed for Management Group Compliance calculation). + * The resource count of the given subscription for which the Compliance calculation was conducted (needed for + * Management Group Compliance calculation). */ - @JsonProperty(value = "resourceCount", access = JsonProperty.Access.WRITE_ONLY) private Integer resourceCount; /* * An array of segment, which is the actually the compliance assessment. */ - @JsonProperty(value = "assessmentResult", access = JsonProperty.Access.WRITE_ONLY) private List assessmentResult; /** @@ -79,4 +82,46 @@ public void validate() { assessmentResult().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComplianceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComplianceProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ComplianceProperties. + */ + public static ComplianceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComplianceProperties deserializedComplianceProperties = new ComplianceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessmentTimestampUtcDate".equals(fieldName)) { + deserializedComplianceProperties.assessmentTimestampUtcDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("resourceCount".equals(fieldName)) { + deserializedComplianceProperties.resourceCount = reader.getNullable(JsonReader::getInt); + } else if ("assessmentResult".equals(fieldName)) { + List assessmentResult + = reader.readArray(reader1 -> ComplianceSegment.fromJson(reader1)); + deserializedComplianceProperties.assessmentResult = assessmentResult; + } else { + reader.skipChildren(); + } + } + + return deserializedComplianceProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultInner.java index 7ba1143528a3..c2f0b5b178fd 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ResourceStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * a compliance result. @@ -17,9 +20,23 @@ public final class ComplianceResultInner extends ProxyResource { /* * Compliance result data */ - @JsonProperty(value = "properties") private ComplianceResultProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ComplianceResultInner class. */ @@ -35,6 +52,36 @@ private ComplianceResultProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the resourceStatus property: The status of the resource regarding a single assessment. * @@ -54,4 +101,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComplianceResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComplianceResultInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ComplianceResultInner. + */ + public static ComplianceResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComplianceResultInner deserializedComplianceResultInner = new ComplianceResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedComplianceResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedComplianceResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedComplianceResultInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedComplianceResultInner.innerProperties = ComplianceResultProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedComplianceResultInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultProperties.java index 1b58d3960bcc..ba3151e68485 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ComplianceResultProperties.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ResourceStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Compliance result data. */ @Immutable -public final class ComplianceResultProperties { +public final class ComplianceResultProperties implements JsonSerializable { /* * The status of the resource regarding a single assessment */ - @JsonProperty(value = "resourceStatus", access = JsonProperty.Access.WRITE_ONLY) private ResourceStatus resourceStatus; /** @@ -41,4 +44,40 @@ public ResourceStatus resourceStatus() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComplianceResultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComplianceResultProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ComplianceResultProperties. + */ + public static ComplianceResultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComplianceResultProperties deserializedComplianceResultProperties = new ComplianceResultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceStatus".equals(fieldName)) { + deserializedComplianceResultProperties.resourceStatus + = ResourceStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedComplianceResultProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingInner.java index 447751f0bfe1..3f6bb6260ff7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingInner.java @@ -6,9 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AuthenticationDetailsProperties; import com.azure.resourcemanager.security.models.HybridComputeSettingsProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The connector setting. @@ -18,9 +21,23 @@ public final class ConnectorSettingInner extends ProxyResource { /* * Connector setting data */ - @JsonProperty(value = "properties") private ConnectorSettingProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ConnectorSettingInner class. */ @@ -36,6 +53,36 @@ private ConnectorSettingProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the hybridComputeSettings property: Settings for hybrid compute management. These settings are relevant only * for Arc autoProvision (Hybrid Compute). @@ -96,4 +143,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorSettingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorSettingInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectorSettingInner. + */ + public static ConnectorSettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorSettingInner deserializedConnectorSettingInner = new ConnectorSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedConnectorSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedConnectorSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedConnectorSettingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedConnectorSettingInner.innerProperties = ConnectorSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorSettingInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingProperties.java index 800caa677e3b..82e8a6921385 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ConnectorSettingProperties.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AuthenticationDetailsProperties; import com.azure.resourcemanager.security.models.HybridComputeSettingsProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Describes properties of a connector setting. */ @Fluent -public final class ConnectorSettingProperties { +public final class ConnectorSettingProperties implements JsonSerializable { /* * Settings for hybrid compute management. These settings are relevant only for Arc autoProvision (Hybrid Compute). */ - @JsonProperty(value = "hybridComputeSettings") private HybridComputeSettingsProperties hybridComputeSettings; /* * Settings for authentication management, these settings are relevant only for the cloud connector. */ - @JsonProperty(value = "authenticationDetails") private AuthenticationDetailsProperties authenticationDetails; /** @@ -89,4 +91,45 @@ public void validate() { authenticationDetails().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("hybridComputeSettings", this.hybridComputeSettings); + jsonWriter.writeJsonField("authenticationDetails", this.authenticationDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorSettingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorSettingProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectorSettingProperties. + */ + public static ConnectorSettingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorSettingProperties deserializedConnectorSettingProperties = new ConnectorSettingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("hybridComputeSettings".equals(fieldName)) { + deserializedConnectorSettingProperties.hybridComputeSettings + = HybridComputeSettingsProperties.fromJson(reader); + } else if ("authenticationDetails".equals(fieldName)) { + deserializedConnectorSettingProperties.authenticationDetails + = AuthenticationDetailsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorSettingProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationInner.java index 0927361ce3ae..ee2f035c6a23 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationInner.java @@ -7,9 +7,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.SeverityEnum; import com.azure.resourcemanager.security.models.SupportedCloudEnum; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Custom Assessment Automation. @@ -19,15 +22,28 @@ public final class CustomAssessmentAutomationInner extends ProxyResource { /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * describes Custom Assessment Automation properties. */ - @JsonProperty(value = "properties") private CustomAssessmentAutomationProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of CustomAssessmentAutomationInner class. */ @@ -52,6 +68,36 @@ private CustomAssessmentAutomationProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the compressedQuery property: GZip encoded KQL query representing the assessment automation results required. * @@ -229,4 +275,51 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAssessmentAutomationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationInner. + */ + public static CustomAssessmentAutomationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationInner deserializedCustomAssessmentAutomationInner + = new CustomAssessmentAutomationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedCustomAssessmentAutomationInner.innerProperties + = CustomAssessmentAutomationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationProperties.java index 91e4bbc482b7..b4b88b60b16b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationProperties.java @@ -5,55 +5,53 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.SeverityEnum; import com.azure.resourcemanager.security.models.SupportedCloudEnum; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * describes the Custom Assessment Automation properties. */ @Fluent -public final class CustomAssessmentAutomationProperties { +public final class CustomAssessmentAutomationProperties + implements JsonSerializable { /* * GZip encoded KQL query representing the assessment automation results required. */ - @JsonProperty(value = "compressedQuery") private String compressedQuery; /* * Relevant cloud for the custom assessment automation. */ - @JsonProperty(value = "supportedCloud") private SupportedCloudEnum supportedCloud = SupportedCloudEnum.AWS; /* * The severity to relate to the assessments generated by this assessment automation. */ - @JsonProperty(value = "severity") private SeverityEnum severity = SeverityEnum.LOW; /* * The display name of the assessments generated by this assessment automation. */ - @JsonProperty(value = "displayName") private String displayName; /* * The description to relate to the assessments generated by this assessment automation. */ - @JsonProperty(value = "description") private String description; /* * The remediation description to relate to the assessments generated by this assessment automation. */ - @JsonProperty(value = "remediationDescription") private String remediationDescription; /* * The assessment metadata key used when an assessment is generated for this assessment automation. */ - @JsonProperty(value = "assessmentKey") private String assessmentKey; /** @@ -215,4 +213,62 @@ public CustomAssessmentAutomationProperties withAssessmentKey(String assessmentK */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("compressedQuery", this.compressedQuery); + jsonWriter.writeStringField("supportedCloud", + this.supportedCloud == null ? null : this.supportedCloud.toString()); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("remediationDescription", this.remediationDescription); + jsonWriter.writeStringField("assessmentKey", this.assessmentKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAssessmentAutomationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationProperties. + */ + public static CustomAssessmentAutomationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationProperties deserializedCustomAssessmentAutomationProperties + = new CustomAssessmentAutomationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("compressedQuery".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.compressedQuery = reader.getString(); + } else if ("supportedCloud".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.supportedCloud + = SupportedCloudEnum.fromString(reader.getString()); + } else if ("severity".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.severity + = SeverityEnum.fromString(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.description = reader.getString(); + } else if ("remediationDescription".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.remediationDescription = reader.getString(); + } else if ("assessmentKey".equals(fieldName)) { + deserializedCustomAssessmentAutomationProperties.assessmentKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationRequestProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationRequestProperties.java index 69a9046298a6..e718ed78ee26 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationRequestProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomAssessmentAutomationRequestProperties.java @@ -5,49 +5,48 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.SeverityEnum; import com.azure.resourcemanager.security.models.SupportedCloudEnum; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * describes the Custom Assessment Automation properties. */ @Fluent -public final class CustomAssessmentAutomationRequestProperties { +public final class CustomAssessmentAutomationRequestProperties + implements JsonSerializable { /* * Base 64 encoded KQL query representing the assessment automation results required. */ - @JsonProperty(value = "compressedQuery") private String compressedQuery; /* * Relevant cloud for the custom assessment automation. */ - @JsonProperty(value = "supportedCloud") private SupportedCloudEnum supportedCloud = SupportedCloudEnum.AWS; /* * The severity to relate to the assessments generated by this assessment automation. */ - @JsonProperty(value = "severity") private SeverityEnum severity = SeverityEnum.LOW; /* * The display name of the assessments generated by this assessment automation. */ - @JsonProperty(value = "displayName") private String displayName; /* * The description to relate to the assessments generated by this assessment automation. */ - @JsonProperty(value = "description") private String description; /* * The remediation description to relate to the assessments generated by this assessment automation. */ - @JsonProperty(value = "remediationDescription") private String remediationDescription; /** @@ -189,4 +188,59 @@ public CustomAssessmentAutomationRequestProperties withRemediationDescription(St */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("compressedQuery", this.compressedQuery); + jsonWriter.writeStringField("supportedCloud", + this.supportedCloud == null ? null : this.supportedCloud.toString()); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("remediationDescription", this.remediationDescription); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAssessmentAutomationRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationRequestProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationRequestProperties. + */ + public static CustomAssessmentAutomationRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationRequestProperties deserializedCustomAssessmentAutomationRequestProperties + = new CustomAssessmentAutomationRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("compressedQuery".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.compressedQuery = reader.getString(); + } else if ("supportedCloud".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.supportedCloud + = SupportedCloudEnum.fromString(reader.getString()); + } else if ("severity".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.severity + = SeverityEnum.fromString(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.description = reader.getString(); + } else if ("remediationDescription".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequestProperties.remediationDescription = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationRequestProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentInner.java index 3a24a6da384b..2cc3ca2fa5bc 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentInner.java @@ -7,7 +7,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Custom entity store assignment. @@ -17,15 +20,28 @@ public final class CustomEntityStoreAssignmentInner extends ProxyResource { /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * describes custom entity store assignment properties. */ - @JsonProperty(value = "properties") private CustomEntityStoreAssignmentProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of CustomEntityStoreAssignmentInner class. */ @@ -50,6 +66,36 @@ private CustomEntityStoreAssignmentProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the principal property: The principal assigned with entity store. Format of principal is: [AAD * type]=[PrincipalObjectId];[TenantId]. @@ -108,4 +154,51 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityStoreAssignmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentInner. + */ + public static CustomEntityStoreAssignmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentInner deserializedCustomEntityStoreAssignmentInner + = new CustomEntityStoreAssignmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentInner.innerProperties + = CustomEntityStoreAssignmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentProperties.java index b6b881e2da6e..c45fd7b558e5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentProperties.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * describes the custom entity store assignment properties. */ @Fluent -public final class CustomEntityStoreAssignmentProperties { +public final class CustomEntityStoreAssignmentProperties + implements JsonSerializable { /* * The principal assigned with entity store. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId] */ - @JsonProperty(value = "principal") private String principal; /* * The link to entity store database. */ - @JsonProperty(value = "entityStoreDatabaseLink") private String entityStoreDatabaseLink; /** @@ -79,4 +82,44 @@ public CustomEntityStoreAssignmentProperties withEntityStoreDatabaseLink(String */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("principal", this.principal); + jsonWriter.writeStringField("entityStoreDatabaseLink", this.entityStoreDatabaseLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityStoreAssignmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentProperties. + */ + public static CustomEntityStoreAssignmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentProperties deserializedCustomEntityStoreAssignmentProperties + = new CustomEntityStoreAssignmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principal".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentProperties.principal = reader.getString(); + } else if ("entityStoreDatabaseLink".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentProperties.entityStoreDatabaseLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentRequestProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentRequestProperties.java index f652fccc8270..9941030ada8b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentRequestProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomEntityStoreAssignmentRequestProperties.java @@ -5,17 +5,22 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * describes properties of custom entity store assignment request. */ @Fluent -public final class CustomEntityStoreAssignmentRequestProperties { +public final class CustomEntityStoreAssignmentRequestProperties + implements JsonSerializable { /* - * The principal assigned with entity store. If not provided, will use caller principal. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId] + * The principal assigned with entity store. If not provided, will use caller principal. Format of principal is: + * [AAD type]=[PrincipalObjectId];[TenantId] */ - @JsonProperty(value = "principal") private String principal; /** @@ -53,4 +58,41 @@ public CustomEntityStoreAssignmentRequestProperties withPrincipal(String princip */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("principal", this.principal); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityStoreAssignmentRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentRequestProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentRequestProperties. + */ + public static CustomEntityStoreAssignmentRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentRequestProperties deserializedCustomEntityStoreAssignmentRequestProperties + = new CustomEntityStoreAssignmentRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principal".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentRequestProperties.principal = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentRequestProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomRecommendationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomRecommendationInner.java new file mode 100644 index 000000000000..08c74e9cf7b3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomRecommendationInner.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.RecommendationSupportedClouds; +import com.azure.resourcemanager.security.models.SecurityIssue; +import com.azure.resourcemanager.security.models.SeverityEnum; +import java.io.IOException; +import java.util.List; + +/** + * Custom Recommendation. + */ +@Fluent +public final class CustomRecommendationInner extends ProxyResource { + /* + * describes Custom Recommendation properties. + */ + private CustomRecommendationProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CustomRecommendationInner class. + */ + public CustomRecommendationInner() { + } + + /** + * Get the innerProperties property: describes Custom Recommendation properties. + * + * @return the innerProperties value. + */ + private CustomRecommendationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the query property: KQL query representing the Recommendation results required. + * + * @return the query value. + */ + public String query() { + return this.innerProperties() == null ? null : this.innerProperties().query(); + } + + /** + * Set the query property: KQL query representing the Recommendation results required. + * + * @param query the query value to set. + * @return the CustomRecommendationInner object itself. + */ + public CustomRecommendationInner withQuery(String query) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRecommendationProperties(); + } + this.innerProperties().withQuery(query); + return this; + } + + /** + * Get the cloudProviders property: List of all standard supported clouds. + * + * @return the cloudProviders value. + */ + public List cloudProviders() { + return this.innerProperties() == null ? null : this.innerProperties().cloudProviders(); + } + + /** + * Set the cloudProviders property: List of all standard supported clouds. + * + * @param cloudProviders the cloudProviders value to set. + * @return the CustomRecommendationInner object itself. + */ + public CustomRecommendationInner withCloudProviders(List cloudProviders) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRecommendationProperties(); + } + this.innerProperties().withCloudProviders(cloudProviders); + return this; + } + + /** + * Get the severity property: The severity to relate to the assessments generated by this Recommendation. + * + * @return the severity value. + */ + public SeverityEnum severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: The severity to relate to the assessments generated by this Recommendation. + * + * @param severity the severity value to set. + * @return the CustomRecommendationInner object itself. + */ + public CustomRecommendationInner withSeverity(SeverityEnum severity) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRecommendationProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the securityIssue property: The severity to relate to the assessments generated by this Recommendation. + * + * @return the securityIssue value. + */ + public SecurityIssue securityIssue() { + return this.innerProperties() == null ? null : this.innerProperties().securityIssue(); + } + + /** + * Set the securityIssue property: The severity to relate to the assessments generated by this Recommendation. + * + * @param securityIssue the securityIssue value to set. + * @return the CustomRecommendationInner object itself. + */ + public CustomRecommendationInner withSecurityIssue(SecurityIssue securityIssue) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRecommendationProperties(); + } + this.innerProperties().withSecurityIssue(securityIssue); + return this; + } + + /** + * Get the displayName property: The display name of the assessments generated by this Recommendation. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the assessments generated by this Recommendation. + * + * @param displayName the displayName value to set. + * @return the CustomRecommendationInner object itself. + */ + public CustomRecommendationInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRecommendationProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: The description to relate to the assessments generated by this Recommendation. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description to relate to the assessments generated by this Recommendation. + * + * @param description the description value to set. + * @return the CustomRecommendationInner object itself. + */ + public CustomRecommendationInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRecommendationProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the remediationDescription property: The remediation description to relate to the assessments generated by + * this Recommendation. + * + * @return the remediationDescription value. + */ + public String remediationDescription() { + return this.innerProperties() == null ? null : this.innerProperties().remediationDescription(); + } + + /** + * Set the remediationDescription property: The remediation description to relate to the assessments generated by + * this Recommendation. + * + * @param remediationDescription the remediationDescription value to set. + * @return the CustomRecommendationInner object itself. + */ + public CustomRecommendationInner withRemediationDescription(String remediationDescription) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomRecommendationProperties(); + } + this.innerProperties().withRemediationDescription(remediationDescription); + return this; + } + + /** + * Get the assessmentKey property: The assessment metadata key used when an assessment is generated for this + * Recommendation. + * + * @return the assessmentKey value. + */ + public String assessmentKey() { + return this.innerProperties() == null ? null : this.innerProperties().assessmentKey(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomRecommendationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomRecommendationInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomRecommendationInner. + */ + public static CustomRecommendationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomRecommendationInner deserializedCustomRecommendationInner = new CustomRecommendationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomRecommendationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomRecommendationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomRecommendationInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCustomRecommendationInner.innerProperties + = CustomRecommendationProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCustomRecommendationInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomRecommendationInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomRecommendationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomRecommendationProperties.java new file mode 100644 index 000000000000..156394e22ab3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/CustomRecommendationProperties.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.RecommendationSupportedClouds; +import com.azure.resourcemanager.security.models.SecurityIssue; +import com.azure.resourcemanager.security.models.SeverityEnum; +import java.io.IOException; +import java.util.List; + +/** + * describes the Custom Recommendation properties. + */ +@Fluent +public final class CustomRecommendationProperties implements JsonSerializable { + /* + * KQL query representing the Recommendation results required. + */ + private String query; + + /* + * List of all standard supported clouds. + */ + private List cloudProviders; + + /* + * The severity to relate to the assessments generated by this Recommendation. + */ + private SeverityEnum severity = SeverityEnum.LOW; + + /* + * The severity to relate to the assessments generated by this Recommendation. + */ + private SecurityIssue securityIssue = SecurityIssue.BEST_PRACTICES; + + /* + * The display name of the assessments generated by this Recommendation. + */ + private String displayName; + + /* + * The description to relate to the assessments generated by this Recommendation. + */ + private String description; + + /* + * The remediation description to relate to the assessments generated by this Recommendation. + */ + private String remediationDescription; + + /* + * The assessment metadata key used when an assessment is generated for this Recommendation. + */ + private String assessmentKey; + + /** + * Creates an instance of CustomRecommendationProperties class. + */ + public CustomRecommendationProperties() { + } + + /** + * Get the query property: KQL query representing the Recommendation results required. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: KQL query representing the Recommendation results required. + * + * @param query the query value to set. + * @return the CustomRecommendationProperties object itself. + */ + public CustomRecommendationProperties withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the cloudProviders property: List of all standard supported clouds. + * + * @return the cloudProviders value. + */ + public List cloudProviders() { + return this.cloudProviders; + } + + /** + * Set the cloudProviders property: List of all standard supported clouds. + * + * @param cloudProviders the cloudProviders value to set. + * @return the CustomRecommendationProperties object itself. + */ + public CustomRecommendationProperties withCloudProviders(List cloudProviders) { + this.cloudProviders = cloudProviders; + return this; + } + + /** + * Get the severity property: The severity to relate to the assessments generated by this Recommendation. + * + * @return the severity value. + */ + public SeverityEnum severity() { + return this.severity; + } + + /** + * Set the severity property: The severity to relate to the assessments generated by this Recommendation. + * + * @param severity the severity value to set. + * @return the CustomRecommendationProperties object itself. + */ + public CustomRecommendationProperties withSeverity(SeverityEnum severity) { + this.severity = severity; + return this; + } + + /** + * Get the securityIssue property: The severity to relate to the assessments generated by this Recommendation. + * + * @return the securityIssue value. + */ + public SecurityIssue securityIssue() { + return this.securityIssue; + } + + /** + * Set the securityIssue property: The severity to relate to the assessments generated by this Recommendation. + * + * @param securityIssue the securityIssue value to set. + * @return the CustomRecommendationProperties object itself. + */ + public CustomRecommendationProperties withSecurityIssue(SecurityIssue securityIssue) { + this.securityIssue = securityIssue; + return this; + } + + /** + * Get the displayName property: The display name of the assessments generated by this Recommendation. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the assessments generated by this Recommendation. + * + * @param displayName the displayName value to set. + * @return the CustomRecommendationProperties object itself. + */ + public CustomRecommendationProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: The description to relate to the assessments generated by this Recommendation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description to relate to the assessments generated by this Recommendation. + * + * @param description the description value to set. + * @return the CustomRecommendationProperties object itself. + */ + public CustomRecommendationProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the remediationDescription property: The remediation description to relate to the assessments generated by + * this Recommendation. + * + * @return the remediationDescription value. + */ + public String remediationDescription() { + return this.remediationDescription; + } + + /** + * Set the remediationDescription property: The remediation description to relate to the assessments generated by + * this Recommendation. + * + * @param remediationDescription the remediationDescription value to set. + * @return the CustomRecommendationProperties object itself. + */ + public CustomRecommendationProperties withRemediationDescription(String remediationDescription) { + this.remediationDescription = remediationDescription; + return this; + } + + /** + * Get the assessmentKey property: The assessment metadata key used when an assessment is generated for this + * Recommendation. + * + * @return the assessmentKey value. + */ + public String assessmentKey() { + return this.assessmentKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("query", this.query); + jsonWriter.writeArrayField("cloudProviders", this.cloudProviders, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("securityIssue", this.securityIssue == null ? null : this.securityIssue.toString()); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("remediationDescription", this.remediationDescription); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomRecommendationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomRecommendationProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomRecommendationProperties. + */ + public static CustomRecommendationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomRecommendationProperties deserializedCustomRecommendationProperties + = new CustomRecommendationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("query".equals(fieldName)) { + deserializedCustomRecommendationProperties.query = reader.getString(); + } else if ("cloudProviders".equals(fieldName)) { + List cloudProviders + = reader.readArray(reader1 -> RecommendationSupportedClouds.fromString(reader1.getString())); + deserializedCustomRecommendationProperties.cloudProviders = cloudProviders; + } else if ("severity".equals(fieldName)) { + deserializedCustomRecommendationProperties.severity = SeverityEnum.fromString(reader.getString()); + } else if ("securityIssue".equals(fieldName)) { + deserializedCustomRecommendationProperties.securityIssue + = SecurityIssue.fromString(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedCustomRecommendationProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCustomRecommendationProperties.description = reader.getString(); + } else if ("remediationDescription".equals(fieldName)) { + deserializedCustomRecommendationProperties.remediationDescription = reader.getString(); + } else if ("assessmentKey".equals(fieldName)) { + deserializedCustomRecommendationProperties.assessmentKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomRecommendationProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DataExportSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DataExportSettingProperties.java index eca261e08f1f..f55b6a43516b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DataExportSettingProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DataExportSettingProperties.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The data export setting properties. */ @Fluent -public final class DataExportSettingProperties { +public final class DataExportSettingProperties implements JsonSerializable { /* * Is the data export setting enabled */ - @JsonProperty(value = "enabled", required = true) private boolean enabled; /** @@ -51,4 +54,41 @@ public DataExportSettingProperties withEnabled(boolean enabled) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataExportSettingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataExportSettingProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DataExportSettingProperties. + */ + public static DataExportSettingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataExportSettingProperties deserializedDataExportSettingProperties = new DataExportSettingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDataExportSettingProperties.enabled = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataExportSettingProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingInner.java index a965338cdaee..f3ea0dc65e55 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.resourcemanager.security.models.OperationStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.DefenderForStorageSettingProperties; +import java.io.IOException; /** * The Defender for Storage resource. @@ -17,206 +20,132 @@ public final class DefenderForStorageSettingInner extends ProxyResource { /* * Defender for Storage resource properties. */ - @JsonProperty(value = "properties") - private DefenderForStorageSettingProperties innerProperties; + private DefenderForStorageSettingProperties properties; - /** - * Creates an instance of DefenderForStorageSettingInner class. - */ - public DefenderForStorageSettingInner() { - } - - /** - * Get the innerProperties property: Defender for Storage resource properties. - * - * @return the innerProperties value. - */ - private DefenderForStorageSettingProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the isEnabled property: Indicates whether Defender for Storage is enabled on this storage account. - * - * @return the isEnabled value. + /* + * The type of the resource. */ - public Boolean isEnabled() { - return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); - } + private String type; - /** - * Set the isEnabled property: Indicates whether Defender for Storage is enabled on this storage account. - * - * @param isEnabled the isEnabled value to set. - * @return the DefenderForStorageSettingInner object itself. + /* + * The name of the resource. */ - public DefenderForStorageSettingInner withIsEnabled(Boolean isEnabled) { - if (this.innerProperties() == null) { - this.innerProperties = new DefenderForStorageSettingProperties(); - } - this.innerProperties().withIsEnabled(isEnabled); - return this; - } + private String name; - /** - * Get the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this storage - * account should override the settings defined for the subscription. - * - * @return the overrideSubscriptionLevelSettings value. + /* + * Fully qualified resource Id for the resource. */ - public Boolean overrideSubscriptionLevelSettings() { - return this.innerProperties() == null ? null : this.innerProperties().overrideSubscriptionLevelSettings(); - } + private String id; /** - * Set the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this storage - * account should override the settings defined for the subscription. - * - * @param overrideSubscriptionLevelSettings the overrideSubscriptionLevelSettings value to set. - * @return the DefenderForStorageSettingInner object itself. + * Creates an instance of DefenderForStorageSettingInner class. */ - public DefenderForStorageSettingInner - withOverrideSubscriptionLevelSettings(Boolean overrideSubscriptionLevelSettings) { - if (this.innerProperties() == null) { - this.innerProperties = new DefenderForStorageSettingProperties(); - } - this.innerProperties().withOverrideSubscriptionLevelSettings(overrideSubscriptionLevelSettings); - return this; + public DefenderForStorageSettingInner() { } /** - * Get the scanResultsEventGridTopicResourceId property: Optional. Resource id of an Event Grid Topic to send scan - * results to. + * Get the properties property: Defender for Storage resource properties. * - * @return the scanResultsEventGridTopicResourceId value. + * @return the properties value. */ - public String scanResultsEventGridTopicResourceId() { - return this.innerProperties() == null ? null : this.innerProperties().scanResultsEventGridTopicResourceId(); + public DefenderForStorageSettingProperties properties() { + return this.properties; } /** - * Set the scanResultsEventGridTopicResourceId property: Optional. Resource id of an Event Grid Topic to send scan - * results to. + * Set the properties property: Defender for Storage resource properties. * - * @param scanResultsEventGridTopicResourceId the scanResultsEventGridTopicResourceId value to set. + * @param properties the properties value to set. * @return the DefenderForStorageSettingInner object itself. */ - public DefenderForStorageSettingInner - withScanResultsEventGridTopicResourceId(String scanResultsEventGridTopicResourceId) { - if (this.innerProperties() == null) { - this.innerProperties = new DefenderForStorageSettingProperties(); - } - this.innerProperties().withScanResultsEventGridTopicResourceId(scanResultsEventGridTopicResourceId); + public DefenderForStorageSettingInner withProperties(DefenderForStorageSettingProperties properties) { + this.properties = properties; return this; } /** - * Get the operationStatus property: Upon failure or partial success. Additional data describing Malware Scanning - * enable/disable operation. - * - * @return the operationStatus value. - */ - public OperationStatus operationStatus() { - return this.innerProperties() == null ? null : this.innerProperties().operationStatus(); - } - - /** - * Get the isEnabledMalwareScanningIsEnabled property: Indicates whether On Upload malware scanning should be - * enabled. + * Get the type property: The type of the resource. * - * @return the isEnabledMalwareScanningIsEnabled value. + * @return the type value. */ - public Boolean isEnabledMalwareScanningIsEnabled() { - return this.innerProperties() == null ? null : this.innerProperties().isEnabledMalwareScanningIsEnabled(); + @Override + public String type() { + return this.type; } /** - * Set the isEnabledMalwareScanningIsEnabled property: Indicates whether On Upload malware scanning should be - * enabled. + * Get the name property: The name of the resource. * - * @param isEnabledMalwareScanningIsEnabled the isEnabledMalwareScanningIsEnabled value to set. - * @return the DefenderForStorageSettingInner object itself. + * @return the name value. */ - public DefenderForStorageSettingInner - withIsEnabledMalwareScanningIsEnabled(Boolean isEnabledMalwareScanningIsEnabled) { - if (this.innerProperties() == null) { - this.innerProperties = new DefenderForStorageSettingProperties(); - } - this.innerProperties().withIsEnabledMalwareScanningIsEnabled(isEnabledMalwareScanningIsEnabled); - return this; + @Override + public String name() { + return this.name; } /** - * Get the capGBPerMonth property: Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. + * Get the id property: Fully qualified resource Id for the resource. * - * @return the capGBPerMonth value. + * @return the id value. */ - public Integer capGBPerMonth() { - return this.innerProperties() == null ? null : this.innerProperties().capGBPerMonth(); + @Override + public String id() { + return this.id; } /** - * Set the capGBPerMonth property: Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. + * Validates the instance. * - * @param capGBPerMonth the capGBPerMonth value to set. - * @return the DefenderForStorageSettingInner object itself. + * @throws IllegalArgumentException thrown if the instance is not valid. */ - public DefenderForStorageSettingInner withCapGBPerMonth(Integer capGBPerMonth) { - if (this.innerProperties() == null) { - this.innerProperties = new DefenderForStorageSettingProperties(); + public void validate() { + if (properties() != null) { + properties().validate(); } - this.innerProperties().withCapGBPerMonth(capGBPerMonth); - return this; } /** - * Get the isEnabledSensitiveDataDiscoveryIsEnabled property: Indicates whether Sensitive Data Discovery should be - * enabled. - * - * @return the isEnabledSensitiveDataDiscoveryIsEnabled value. + * {@inheritDoc} */ - public Boolean isEnabledSensitiveDataDiscoveryIsEnabled() { - return this.innerProperties() == null - ? null - : this.innerProperties().isEnabledSensitiveDataDiscoveryIsEnabled(); + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); } /** - * Set the isEnabledSensitiveDataDiscoveryIsEnabled property: Indicates whether Sensitive Data Discovery should be - * enabled. + * Reads an instance of DefenderForStorageSettingInner from the JsonReader. * - * @param isEnabledSensitiveDataDiscoveryIsEnabled the isEnabledSensitiveDataDiscoveryIsEnabled value to set. - * @return the DefenderForStorageSettingInner object itself. + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForStorageSettingInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DefenderForStorageSettingInner. */ - public DefenderForStorageSettingInner - withIsEnabledSensitiveDataDiscoveryIsEnabled(Boolean isEnabledSensitiveDataDiscoveryIsEnabled) { - if (this.innerProperties() == null) { - this.innerProperties = new DefenderForStorageSettingProperties(); - } - this.innerProperties().withIsEnabledSensitiveDataDiscoveryIsEnabled(isEnabledSensitiveDataDiscoveryIsEnabled); - return this; - } + public static DefenderForStorageSettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForStorageSettingInner deserializedDefenderForStorageSettingInner + = new DefenderForStorageSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); - /** - * Get the operationStatusSensitiveDataDiscoveryOperationStatus property: Upon failure or partial success. - * Additional data describing Sensitive Data Discovery enable/disable operation. - * - * @return the operationStatusSensitiveDataDiscoveryOperationStatus value. - */ - public OperationStatus operationStatusSensitiveDataDiscoveryOperationStatus() { - return this.innerProperties() == null - ? null - : this.innerProperties().operationStatusSensitiveDataDiscoveryOperationStatus(); - } + if ("id".equals(fieldName)) { + deserializedDefenderForStorageSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDefenderForStorageSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDefenderForStorageSettingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDefenderForStorageSettingInner.properties + = DefenderForStorageSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } + return deserializedDefenderForStorageSettingInner; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingProperties.java deleted file mode 100644 index 6ab71fa356d7..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DefenderForStorageSettingProperties.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.security.models.OperationStatus; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Defender for Storage resource properties. - */ -@Fluent -public final class DefenderForStorageSettingProperties { - /* - * Indicates whether Defender for Storage is enabled on this storage account. - */ - @JsonProperty(value = "isEnabled") - private Boolean isEnabled; - - /* - * Properties of Malware Scanning. - */ - @JsonProperty(value = "malwareScanning") - private MalwareScanningProperties innerMalwareScanning; - - /* - * Properties of Sensitive Data Discovery. - */ - @JsonProperty(value = "sensitiveDataDiscovery") - private SensitiveDataDiscoveryProperties innerSensitiveDataDiscovery; - - /* - * Indicates whether the settings defined for this storage account should override the settings defined for the subscription. - */ - @JsonProperty(value = "overrideSubscriptionLevelSettings") - private Boolean overrideSubscriptionLevelSettings; - - /** - * Creates an instance of DefenderForStorageSettingProperties class. - */ - public DefenderForStorageSettingProperties() { - } - - /** - * Get the isEnabled property: Indicates whether Defender for Storage is enabled on this storage account. - * - * @return the isEnabled value. - */ - public Boolean isEnabled() { - return this.isEnabled; - } - - /** - * Set the isEnabled property: Indicates whether Defender for Storage is enabled on this storage account. - * - * @param isEnabled the isEnabled value to set. - * @return the DefenderForStorageSettingProperties object itself. - */ - public DefenderForStorageSettingProperties withIsEnabled(Boolean isEnabled) { - this.isEnabled = isEnabled; - return this; - } - - /** - * Get the innerMalwareScanning property: Properties of Malware Scanning. - * - * @return the innerMalwareScanning value. - */ - private MalwareScanningProperties innerMalwareScanning() { - return this.innerMalwareScanning; - } - - /** - * Get the innerSensitiveDataDiscovery property: Properties of Sensitive Data Discovery. - * - * @return the innerSensitiveDataDiscovery value. - */ - private SensitiveDataDiscoveryProperties innerSensitiveDataDiscovery() { - return this.innerSensitiveDataDiscovery; - } - - /** - * Get the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this storage - * account should override the settings defined for the subscription. - * - * @return the overrideSubscriptionLevelSettings value. - */ - public Boolean overrideSubscriptionLevelSettings() { - return this.overrideSubscriptionLevelSettings; - } - - /** - * Set the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this storage - * account should override the settings defined for the subscription. - * - * @param overrideSubscriptionLevelSettings the overrideSubscriptionLevelSettings value to set. - * @return the DefenderForStorageSettingProperties object itself. - */ - public DefenderForStorageSettingProperties - withOverrideSubscriptionLevelSettings(Boolean overrideSubscriptionLevelSettings) { - this.overrideSubscriptionLevelSettings = overrideSubscriptionLevelSettings; - return this; - } - - /** - * Get the scanResultsEventGridTopicResourceId property: Optional. Resource id of an Event Grid Topic to send scan - * results to. - * - * @return the scanResultsEventGridTopicResourceId value. - */ - public String scanResultsEventGridTopicResourceId() { - return this.innerMalwareScanning() == null - ? null - : this.innerMalwareScanning().scanResultsEventGridTopicResourceId(); - } - - /** - * Set the scanResultsEventGridTopicResourceId property: Optional. Resource id of an Event Grid Topic to send scan - * results to. - * - * @param scanResultsEventGridTopicResourceId the scanResultsEventGridTopicResourceId value to set. - * @return the DefenderForStorageSettingProperties object itself. - */ - public DefenderForStorageSettingProperties - withScanResultsEventGridTopicResourceId(String scanResultsEventGridTopicResourceId) { - if (this.innerMalwareScanning() == null) { - this.innerMalwareScanning = new MalwareScanningProperties(); - } - this.innerMalwareScanning().withScanResultsEventGridTopicResourceId(scanResultsEventGridTopicResourceId); - return this; - } - - /** - * Get the operationStatus property: Upon failure or partial success. Additional data describing Malware Scanning - * enable/disable operation. - * - * @return the operationStatus value. - */ - public OperationStatus operationStatus() { - return this.innerMalwareScanning() == null ? null : this.innerMalwareScanning().operationStatus(); - } - - /** - * Get the isEnabled property: Indicates whether On Upload malware scanning should be enabled. - * - * @return the isEnabled value. - */ - public Boolean isEnabledMalwareScanningIsEnabled() { - return this.innerMalwareScanning() == null ? null : this.innerMalwareScanning().isEnabled(); - } - - /** - * Set the isEnabled property: Indicates whether On Upload malware scanning should be enabled. - * - * @param isEnabled the isEnabled value to set. - * @return the DefenderForStorageSettingProperties object itself. - */ - public DefenderForStorageSettingProperties withIsEnabledMalwareScanningIsEnabled(Boolean isEnabled) { - if (this.innerMalwareScanning() == null) { - this.innerMalwareScanning = new MalwareScanningProperties(); - } - this.innerMalwareScanning().withIsEnabled(isEnabled); - return this; - } - - /** - * Get the capGBPerMonth property: Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. - * - * @return the capGBPerMonth value. - */ - public Integer capGBPerMonth() { - return this.innerMalwareScanning() == null ? null : this.innerMalwareScanning().capGBPerMonth(); - } - - /** - * Set the capGBPerMonth property: Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. - * - * @param capGBPerMonth the capGBPerMonth value to set. - * @return the DefenderForStorageSettingProperties object itself. - */ - public DefenderForStorageSettingProperties withCapGBPerMonth(Integer capGBPerMonth) { - if (this.innerMalwareScanning() == null) { - this.innerMalwareScanning = new MalwareScanningProperties(); - } - this.innerMalwareScanning().withCapGBPerMonth(capGBPerMonth); - return this; - } - - /** - * Get the isEnabled property: Indicates whether Sensitive Data Discovery should be enabled. - * - * @return the isEnabled value. - */ - public Boolean isEnabledSensitiveDataDiscoveryIsEnabled() { - return this.innerSensitiveDataDiscovery() == null ? null : this.innerSensitiveDataDiscovery().isEnabled(); - } - - /** - * Set the isEnabled property: Indicates whether Sensitive Data Discovery should be enabled. - * - * @param isEnabled the isEnabled value to set. - * @return the DefenderForStorageSettingProperties object itself. - */ - public DefenderForStorageSettingProperties withIsEnabledSensitiveDataDiscoveryIsEnabled(Boolean isEnabled) { - if (this.innerSensitiveDataDiscovery() == null) { - this.innerSensitiveDataDiscovery = new SensitiveDataDiscoveryProperties(); - } - this.innerSensitiveDataDiscovery().withIsEnabled(isEnabled); - return this; - } - - /** - * Get the operationStatus property: Upon failure or partial success. Additional data describing Sensitive Data - * Discovery enable/disable operation. - * - * @return the operationStatus value. - */ - public OperationStatus operationStatusSensitiveDataDiscoveryOperationStatus() { - return this.innerSensitiveDataDiscovery() == null ? null : this.innerSensitiveDataDiscovery().operationStatus(); - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerMalwareScanning() != null) { - innerMalwareScanning().validate(); - } - if (innerSensitiveDataDiscovery() != null) { - innerSensitiveDataDiscovery().validate(); - } - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsConfigurationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsConfigurationInner.java index 84cd2be215f6..52ea044b0ae6 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsConfigurationInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsConfigurationInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.DevOpsConfigurationProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * DevOps Configuration resource. @@ -18,15 +21,28 @@ public final class DevOpsConfigurationInner extends ProxyResource { /* * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * DevOps Configuration properties. */ - @JsonProperty(value = "properties") private DevOpsConfigurationProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of DevOpsConfigurationInner class. */ @@ -62,6 +78,36 @@ public DevOpsConfigurationInner withProperties(DevOpsConfigurationProperties pro return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsConfigurationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsConfigurationInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DevOpsConfigurationInner. + */ + public static DevOpsConfigurationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsConfigurationInner deserializedDevOpsConfigurationInner = new DevOpsConfigurationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDevOpsConfigurationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDevOpsConfigurationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDevOpsConfigurationInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedDevOpsConfigurationInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedDevOpsConfigurationInner.properties = DevOpsConfigurationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsConfigurationInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsPolicyAssignmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsPolicyAssignmentInner.java new file mode 100644 index 000000000000..cbcb271194bc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsPolicyAssignmentInner.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignmentProperties; +import java.io.IOException; + +/** + * DevOps Policy assignment resource. + */ +@Fluent +public final class DevOpsPolicyAssignmentInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * Properties of the DevOps policy assignment resource. + */ + private DevOpsPolicyAssignmentProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DevOpsPolicyAssignmentInner class. + */ + public DevOpsPolicyAssignmentInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: Properties of the DevOps policy assignment resource. + * + * @return the properties value. + */ + public DevOpsPolicyAssignmentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the DevOps policy assignment resource. + * + * @param properties the properties value to set. + * @return the DevOpsPolicyAssignmentInner object itself. + */ + public DevOpsPolicyAssignmentInner withProperties(DevOpsPolicyAssignmentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsPolicyAssignmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsPolicyAssignmentInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DevOpsPolicyAssignmentInner. + */ + public static DevOpsPolicyAssignmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsPolicyAssignmentInner deserializedDevOpsPolicyAssignmentInner = new DevOpsPolicyAssignmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentInner.properties + = DevOpsPolicyAssignmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsPolicyAssignmentInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsPolicyInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsPolicyInner.java new file mode 100644 index 000000000000..2e9ebc6580c3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DevOpsPolicyInner.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.DevOpsPolicyProperties; +import java.io.IOException; + +/** + * DevOps Policy Resource. + */ +@Fluent +public final class DevOpsPolicyInner extends ProxyResource { + /* + * Metadata pertaining to creation and last modification of the resource. + */ + private SystemData systemData; + + /* + * Policy DevOps Resource properties that contain the full definition of a DevOps policy resource. + */ + private DevOpsPolicyProperties properties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DevOpsPolicyInner class. + */ + public DevOpsPolicyInner() { + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: Policy DevOps Resource properties that contain the full definition of a DevOps + * policy resource. + * + * @return the properties value. + */ + public DevOpsPolicyProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Policy DevOps Resource properties that contain the full definition of a DevOps + * policy resource. + * + * @param properties the properties value to set. + * @return the DevOpsPolicyInner object itself. + */ + public DevOpsPolicyInner withProperties(DevOpsPolicyProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsPolicyInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsPolicyInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DevOpsPolicyInner. + */ + public static DevOpsPolicyInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsPolicyInner deserializedDevOpsPolicyInner = new DevOpsPolicyInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDevOpsPolicyInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDevOpsPolicyInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDevOpsPolicyInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedDevOpsPolicyInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedDevOpsPolicyInner.properties = DevOpsPolicyProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsPolicyInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupInner.java index 4ac5384380fa..8ae4b0c4c65b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupInner.java @@ -6,11 +6,14 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AllowlistCustomAlertRule; import com.azure.resourcemanager.security.models.DenylistCustomAlertRule; import com.azure.resourcemanager.security.models.ThresholdCustomAlertRule; import com.azure.resourcemanager.security.models.TimeWindowCustomAlertRule; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -21,9 +24,23 @@ public final class DeviceSecurityGroupInner extends ProxyResource { /* * Device Security group data */ - @JsonProperty(value = "properties") private DeviceSecurityGroupProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of DeviceSecurityGroupInner class. */ @@ -39,6 +56,36 @@ private DeviceSecurityGroupProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the thresholdRules property: The list of custom alert threshold rules. * @@ -141,4 +188,48 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceSecurityGroupInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceSecurityGroupInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DeviceSecurityGroupInner. + */ + public static DeviceSecurityGroupInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceSecurityGroupInner deserializedDeviceSecurityGroupInner = new DeviceSecurityGroupInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDeviceSecurityGroupInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDeviceSecurityGroupInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDeviceSecurityGroupInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDeviceSecurityGroupInner.innerProperties + = DeviceSecurityGroupProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceSecurityGroupInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupProperties.java index 89cd036e97e2..0b47e4dcff06 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DeviceSecurityGroupProperties.java @@ -5,40 +5,40 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AllowlistCustomAlertRule; import com.azure.resourcemanager.security.models.DenylistCustomAlertRule; import com.azure.resourcemanager.security.models.ThresholdCustomAlertRule; import com.azure.resourcemanager.security.models.TimeWindowCustomAlertRule; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * describes properties of a security group. */ @Fluent -public final class DeviceSecurityGroupProperties { +public final class DeviceSecurityGroupProperties implements JsonSerializable { /* * The list of custom alert threshold rules. */ - @JsonProperty(value = "thresholdRules") private List thresholdRules; /* * The list of custom alert time-window rules. */ - @JsonProperty(value = "timeWindowRules") private List timeWindowRules; /* * The allow-list custom alert rules. */ - @JsonProperty(value = "allowlistRules") private List allowlistRules; /* * The deny-list custom alert rules. */ - @JsonProperty(value = "denylistRules") private List denylistRules; /** @@ -146,4 +146,61 @@ public void validate() { denylistRules().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("thresholdRules", this.thresholdRules, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("timeWindowRules", this.timeWindowRules, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("allowlistRules", this.allowlistRules, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("denylistRules", this.denylistRules, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceSecurityGroupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceSecurityGroupProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DeviceSecurityGroupProperties. + */ + public static DeviceSecurityGroupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceSecurityGroupProperties deserializedDeviceSecurityGroupProperties + = new DeviceSecurityGroupProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("thresholdRules".equals(fieldName)) { + List thresholdRules + = reader.readArray(reader1 -> ThresholdCustomAlertRule.fromJson(reader1)); + deserializedDeviceSecurityGroupProperties.thresholdRules = thresholdRules; + } else if ("timeWindowRules".equals(fieldName)) { + List timeWindowRules + = reader.readArray(reader1 -> TimeWindowCustomAlertRule.fromJson(reader1)); + deserializedDeviceSecurityGroupProperties.timeWindowRules = timeWindowRules; + } else if ("allowlistRules".equals(fieldName)) { + List allowlistRules + = reader.readArray(reader1 -> AllowlistCustomAlertRule.fromJson(reader1)); + deserializedDeviceSecurityGroupProperties.allowlistRules = allowlistRules; + } else if ("denylistRules".equals(fieldName)) { + List denylistRules + = reader.readArray(reader1 -> DenylistCustomAlertRule.fromJson(reader1)); + deserializedDeviceSecurityGroupProperties.denylistRules = denylistRules; + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceSecurityGroupProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionInner.java index 03179841d944..1db9bbbc96cf 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.SecurityFamily; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The DiscoveredSecuritySolution model. @@ -18,15 +21,28 @@ public final class DiscoveredSecuritySolutionInner extends ProxyResource { /* * The properties property. */ - @JsonProperty(value = "properties", required = true) private DiscoveredSecuritySolutionProperties innerProperties = new DiscoveredSecuritySolutionProperties(); /* * Location where the resource is stored */ - @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) private String location; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of DiscoveredSecuritySolutionInner class. */ @@ -51,6 +67,36 @@ public String location() { return this.location; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the securityFamily property: The security family of the discovered solution. * @@ -159,4 +205,51 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(DiscoveredSecuritySolutionInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredSecuritySolutionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredSecuritySolutionInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredSecuritySolutionInner. + */ + public static DiscoveredSecuritySolutionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredSecuritySolutionInner deserializedDiscoveredSecuritySolutionInner + = new DiscoveredSecuritySolutionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionInner.innerProperties + = DiscoveredSecuritySolutionProperties.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredSecuritySolutionInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionProperties.java index 21f095658614..22eda29f8b3e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/DiscoveredSecuritySolutionProperties.java @@ -6,36 +6,37 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.SecurityFamily; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The DiscoveredSecuritySolutionProperties model. */ @Fluent -public final class DiscoveredSecuritySolutionProperties { +public final class DiscoveredSecuritySolutionProperties + implements JsonSerializable { /* * The security family of the discovered solution */ - @JsonProperty(value = "securityFamily", required = true) private SecurityFamily securityFamily; /* * The security solutions' image offer */ - @JsonProperty(value = "offer", required = true) private String offer; /* * The security solutions' image publisher */ - @JsonProperty(value = "publisher", required = true) private String publisher; /* * The security solutions' image sku */ - @JsonProperty(value = "sku", required = true) private String sku; /** @@ -153,4 +154,53 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(DiscoveredSecuritySolutionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("securityFamily", + this.securityFamily == null ? null : this.securityFamily.toString()); + jsonWriter.writeStringField("offer", this.offer); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredSecuritySolutionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredSecuritySolutionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredSecuritySolutionProperties. + */ + public static DiscoveredSecuritySolutionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredSecuritySolutionProperties deserializedDiscoveredSecuritySolutionProperties + = new DiscoveredSecuritySolutionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("securityFamily".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionProperties.securityFamily + = SecurityFamily.fromString(reader.getString()); + } else if ("offer".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionProperties.offer = reader.getString(); + } else if ("publisher".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionProperties.publisher = reader.getString(); + } else if ("sku".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionProperties.sku = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredSecuritySolutionProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ExternalSecuritySolutionInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ExternalSecuritySolutionInner.java index eaafde582a13..31a45b5549c0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ExternalSecuritySolutionInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ExternalSecuritySolutionInner.java @@ -6,50 +6,50 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AadExternalSecuritySolution; import com.azure.resourcemanager.security.models.AtaExternalSecuritySolution; import com.azure.resourcemanager.security.models.CefExternalSecuritySolution; import com.azure.resourcemanager.security.models.ExternalSecuritySolutionKind; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Represents a security solution external to Microsoft Defender for Cloud which sends information to an OMS workspace * and whose data is displayed by Microsoft Defender for Cloud. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "kind", - defaultImpl = ExternalSecuritySolutionInner.class, - visible = true) -@JsonTypeName("ExternalSecuritySolution") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "CEF", value = CefExternalSecuritySolution.class), - @JsonSubTypes.Type(name = "ATA", value = AtaExternalSecuritySolution.class), - @JsonSubTypes.Type(name = "AAD", value = AadExternalSecuritySolution.class) }) @Immutable public class ExternalSecuritySolutionInner extends ProxyResource { /* * The kind of the external solution */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) - private ExternalSecuritySolutionKind kind; + private ExternalSecuritySolutionKind kind = ExternalSecuritySolutionKind.fromString("ExternalSecuritySolution"); /* * Location where the resource is stored */ - @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) private String location; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ExternalSecuritySolutionInner class. */ public ExternalSecuritySolutionInner() { - this.kind = ExternalSecuritySolutionKind.fromString("ExternalSecuritySolution"); } /** @@ -70,6 +70,47 @@ public String location() { return this.location; } + /** + * Set the location property: Location where the resource is stored. + * + * @param location the location value to set. + * @return the ExternalSecuritySolutionInner object itself. + */ + ExternalSecuritySolutionInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -77,4 +118,80 @@ public String location() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExternalSecuritySolutionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExternalSecuritySolutionInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExternalSecuritySolutionInner. + */ + public static ExternalSecuritySolutionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("CEF".equals(discriminatorValue)) { + return CefExternalSecuritySolution.fromJson(readerToUse.reset()); + } else if ("ATA".equals(discriminatorValue)) { + return AtaExternalSecuritySolution.fromJson(readerToUse.reset()); + } else if ("AAD".equals(discriminatorValue)) { + return AadExternalSecuritySolution.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ExternalSecuritySolutionInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExternalSecuritySolutionInner deserializedExternalSecuritySolutionInner + = new ExternalSecuritySolutionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedExternalSecuritySolutionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedExternalSecuritySolutionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExternalSecuritySolutionInner.type = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedExternalSecuritySolutionInner.kind + = ExternalSecuritySolutionKind.fromString(reader.getString()); + } else if ("location".equals(fieldName)) { + deserializedExternalSecuritySolutionInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExternalSecuritySolutionInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsListResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsListResponseInner.java index b1ad53fd4210..f73e8e04eb85 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsListResponseInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsListResponseInner.java @@ -5,18 +5,22 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * A list with a single sensitivity settings resource. */ @Fluent -public final class GetSensitivitySettingsListResponseInner { +public final class GetSensitivitySettingsListResponseInner + implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value") private List value; /** @@ -55,4 +59,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetSensitivitySettingsListResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetSensitivitySettingsListResponseInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GetSensitivitySettingsListResponseInner. + */ + public static GetSensitivitySettingsListResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetSensitivitySettingsListResponseInner deserializedGetSensitivitySettingsListResponseInner + = new GetSensitivitySettingsListResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> GetSensitivitySettingsResponseInner.fromJson(reader1)); + deserializedGetSensitivitySettingsListResponseInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedGetSensitivitySettingsListResponseInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsResponseInner.java index 9163e9203502..4ce68181ff8c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsResponseInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GetSensitivitySettingsResponseInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.GetSensitivitySettingsResponseProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Data sensitivity settings for sensitive data discovery. @@ -17,9 +20,23 @@ public final class GetSensitivitySettingsResponseInner extends ProxyResource { /* * The sensitivity settings properties */ - @JsonProperty(value = "properties") private GetSensitivitySettingsResponseProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of GetSensitivitySettingsResponseInner class. */ @@ -46,6 +63,36 @@ public GetSensitivitySettingsResponseInner withProperties(GetSensitivitySettings return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -56,4 +103,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetSensitivitySettingsResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetSensitivitySettingsResponseInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetSensitivitySettingsResponseInner. + */ + public static GetSensitivitySettingsResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetSensitivitySettingsResponseInner deserializedGetSensitivitySettingsResponseInner + = new GetSensitivitySettingsResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseInner.properties + = GetSensitivitySettingsResponseProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGetSensitivitySettingsResponseInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerInner.java index cdc48c7f89f2..5f2159ddd6ef 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.GitHubOwnerProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * GitHub Owner resource. @@ -18,15 +21,28 @@ public final class GitHubOwnerInner extends ProxyResource { /* * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * GitHub Owner properties. */ - @JsonProperty(value = "properties") private GitHubOwnerProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of GitHubOwnerInner class. */ @@ -62,6 +78,36 @@ public GitHubOwnerInner withProperties(GitHubOwnerProperties properties) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitHubOwnerInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitHubOwnerInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GitHubOwnerInner. + */ + public static GitHubOwnerInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitHubOwnerInner deserializedGitHubOwnerInner = new GitHubOwnerInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGitHubOwnerInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGitHubOwnerInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGitHubOwnerInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedGitHubOwnerInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedGitHubOwnerInner.properties = GitHubOwnerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGitHubOwnerInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerListResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerListResponseInner.java index 37ea6f2cba59..7c7806276ba8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerListResponseInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubOwnerListResponseInner.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * List of RP resources which supports pagination. */ @Fluent -public final class GitHubOwnerListResponseInner { +public final class GitHubOwnerListResponseInner implements JsonSerializable { /* * Gets or sets list of resources. */ - @JsonProperty(value = "value") private List value; /* * Gets or sets next link to scroll over the results. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -81,4 +83,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitHubOwnerListResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitHubOwnerListResponseInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GitHubOwnerListResponseInner. + */ + public static GitHubOwnerListResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitHubOwnerListResponseInner deserializedGitHubOwnerListResponseInner = new GitHubOwnerListResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> GitHubOwnerInner.fromJson(reader1)); + deserializedGitHubOwnerListResponseInner.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGitHubOwnerListResponseInner.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGitHubOwnerListResponseInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubRepositoryInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubRepositoryInner.java index fdf3cf2876ca..3b6dd50b10d0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubRepositoryInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitHubRepositoryInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.GitHubRepositoryProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * GitHub Repository resource. @@ -18,15 +21,28 @@ public final class GitHubRepositoryInner extends ProxyResource { /* * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * GitHub Repository properties. */ - @JsonProperty(value = "properties") private GitHubRepositoryProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of GitHubRepositoryInner class. */ @@ -62,6 +78,36 @@ public GitHubRepositoryInner withProperties(GitHubRepositoryProperties propertie return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitHubRepositoryInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitHubRepositoryInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GitHubRepositoryInner. + */ + public static GitHubRepositoryInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitHubRepositoryInner deserializedGitHubRepositoryInner = new GitHubRepositoryInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGitHubRepositoryInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGitHubRepositoryInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGitHubRepositoryInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedGitHubRepositoryInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedGitHubRepositoryInner.properties = GitHubRepositoryProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGitHubRepositoryInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupInner.java index 40c4ee5cb99d..b20100ceff50 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.GitLabGroupProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * GitLab Group resource. @@ -18,15 +21,28 @@ public final class GitLabGroupInner extends ProxyResource { /* * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * GitLab Group properties. */ - @JsonProperty(value = "properties") private GitLabGroupProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of GitLabGroupInner class. */ @@ -62,6 +78,36 @@ public GitLabGroupInner withProperties(GitLabGroupProperties properties) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitLabGroupInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitLabGroupInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GitLabGroupInner. + */ + public static GitLabGroupInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitLabGroupInner deserializedGitLabGroupInner = new GitLabGroupInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGitLabGroupInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGitLabGroupInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGitLabGroupInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedGitLabGroupInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedGitLabGroupInner.properties = GitLabGroupProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGitLabGroupInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupListResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupListResponseInner.java index 12ece067735e..ada280020092 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupListResponseInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabGroupListResponseInner.java @@ -5,24 +5,26 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * List of RP resources which supports pagination. */ @Fluent -public final class GitLabGroupListResponseInner { +public final class GitLabGroupListResponseInner implements JsonSerializable { /* * Gets or sets list of resources. */ - @JsonProperty(value = "value") private List value; /* * Gets or sets next link to scroll over the results. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -81,4 +83,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitLabGroupListResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitLabGroupListResponseInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GitLabGroupListResponseInner. + */ + public static GitLabGroupListResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitLabGroupListResponseInner deserializedGitLabGroupListResponseInner = new GitLabGroupListResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> GitLabGroupInner.fromJson(reader1)); + deserializedGitLabGroupListResponseInner.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGitLabGroupListResponseInner.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGitLabGroupListResponseInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabProjectInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabProjectInner.java index 646ee832cd08..8156d2a40269 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabProjectInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GitLabProjectInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.GitLabProjectProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * GitLab Project resource. @@ -18,15 +21,28 @@ public final class GitLabProjectInner extends ProxyResource { /* * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * GitLab Project properties. */ - @JsonProperty(value = "properties") private GitLabProjectProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of GitLabProjectInner class. */ @@ -62,6 +78,36 @@ public GitLabProjectInner withProperties(GitLabProjectProperties properties) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -72,4 +118,49 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GitLabProjectInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GitLabProjectInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GitLabProjectInner. + */ + public static GitLabProjectInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GitLabProjectInner deserializedGitLabProjectInner = new GitLabProjectInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGitLabProjectInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGitLabProjectInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGitLabProjectInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedGitLabProjectInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedGitLabProjectInner.properties = GitLabProjectProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGitLabProjectInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentInner.java index 601e64c17fa0..fbae260e678f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentInner.java @@ -6,10 +6,13 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.GovernanceAssignmentAdditionalData; import com.azure.resourcemanager.security.models.GovernanceEmailNotification; import com.azure.resourcemanager.security.models.RemediationEta; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** @@ -20,9 +23,23 @@ public final class GovernanceAssignmentInner extends ProxyResource { /* * The properties of a governance assignment */ - @JsonProperty(value = "properties") private GovernanceAssignmentProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of GovernanceAssignmentInner class. */ @@ -38,6 +55,36 @@ private GovernanceAssignmentProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the owner property: The Owner for the governance assignment - e.g. user@contoso.com - see example. * @@ -193,4 +240,48 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GovernanceAssignmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GovernanceAssignmentInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GovernanceAssignmentInner. + */ + public static GovernanceAssignmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GovernanceAssignmentInner deserializedGovernanceAssignmentInner = new GovernanceAssignmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGovernanceAssignmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGovernanceAssignmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGovernanceAssignmentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedGovernanceAssignmentInner.innerProperties + = GovernanceAssignmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGovernanceAssignmentInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentProperties.java index 55bc8f70a8d1..152a28ae3469 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceAssignmentProperties.java @@ -5,52 +5,53 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.GovernanceAssignmentAdditionalData; import com.azure.resourcemanager.security.models.GovernanceEmailNotification; import com.azure.resourcemanager.security.models.RemediationEta; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; /** * Describes properties of an governance assignment. */ @Fluent -public final class GovernanceAssignmentProperties { +public final class GovernanceAssignmentProperties implements JsonSerializable { /* * The Owner for the governance assignment - e.g. user@contoso.com - see example */ - @JsonProperty(value = "owner") private String owner; /* - * The remediation due-date - after this date Secure Score will be affected (in case of active grace-period) + * The remediation due-date - after this date Secure Score will be affected (in case of active grace-period) */ - @JsonProperty(value = "remediationDueDate", required = true) private OffsetDateTime remediationDueDate; /* * The ETA (estimated time of arrival) for remediation (optional), see example */ - @JsonProperty(value = "remediationEta") private RemediationEta remediationEta; /* * Defines whether there is a grace period on the governance assignment */ - @JsonProperty(value = "isGracePeriod") private Boolean isGracePeriod; /* - * The email notifications settings for the governance rule, states whether to disable notifications for mangers and owners + * The email notifications settings for the governance rule, states whether to disable notifications for mangers and + * owners */ - @JsonProperty(value = "governanceEmailNotification") private GovernanceEmailNotification governanceEmailNotification; /* * The additional data for the governance assignment - e.g. links to ticket (optional), see example */ - @JsonProperty(value = "additionalData") private GovernanceAssignmentAdditionalData additionalData; /** @@ -209,4 +210,64 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(GovernanceAssignmentProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("remediationDueDate", + this.remediationDueDate == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.remediationDueDate)); + jsonWriter.writeStringField("owner", this.owner); + jsonWriter.writeJsonField("remediationEta", this.remediationEta); + jsonWriter.writeBooleanField("isGracePeriod", this.isGracePeriod); + jsonWriter.writeJsonField("governanceEmailNotification", this.governanceEmailNotification); + jsonWriter.writeJsonField("additionalData", this.additionalData); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GovernanceAssignmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GovernanceAssignmentProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GovernanceAssignmentProperties. + */ + public static GovernanceAssignmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GovernanceAssignmentProperties deserializedGovernanceAssignmentProperties + = new GovernanceAssignmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("remediationDueDate".equals(fieldName)) { + deserializedGovernanceAssignmentProperties.remediationDueDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("owner".equals(fieldName)) { + deserializedGovernanceAssignmentProperties.owner = reader.getString(); + } else if ("remediationEta".equals(fieldName)) { + deserializedGovernanceAssignmentProperties.remediationEta = RemediationEta.fromJson(reader); + } else if ("isGracePeriod".equals(fieldName)) { + deserializedGovernanceAssignmentProperties.isGracePeriod + = reader.getNullable(JsonReader::getBoolean); + } else if ("governanceEmailNotification".equals(fieldName)) { + deserializedGovernanceAssignmentProperties.governanceEmailNotification + = GovernanceEmailNotification.fromJson(reader); + } else if ("additionalData".equals(fieldName)) { + deserializedGovernanceAssignmentProperties.additionalData + = GovernanceAssignmentAdditionalData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGovernanceAssignmentProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleInner.java index e2d6ef9ec637..e109f4846fe7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleInner.java @@ -6,12 +6,15 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.GovernanceRuleEmailNotification; import com.azure.resourcemanager.security.models.GovernanceRuleMetadata; import com.azure.resourcemanager.security.models.GovernanceRuleOwnerSource; import com.azure.resourcemanager.security.models.GovernanceRuleSourceResourceType; import com.azure.resourcemanager.security.models.GovernanceRuleType; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -22,9 +25,23 @@ public final class GovernanceRuleInner extends ProxyResource { /* * Properties of a governance rule */ - @JsonProperty(value = "properties") private GovernanceRuleProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of GovernanceRuleInner class. */ @@ -40,6 +57,36 @@ private GovernanceRuleProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the tenantId property: The tenantId (GUID). * @@ -392,4 +439,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GovernanceRuleInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GovernanceRuleInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GovernanceRuleInner. + */ + public static GovernanceRuleInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GovernanceRuleInner deserializedGovernanceRuleInner = new GovernanceRuleInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGovernanceRuleInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGovernanceRuleInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGovernanceRuleInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedGovernanceRuleInner.innerProperties = GovernanceRuleProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGovernanceRuleInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleProperties.java index b53727c0070f..6921d2b80050 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/GovernanceRuleProperties.java @@ -6,107 +6,99 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.GovernanceRuleEmailNotification; import com.azure.resourcemanager.security.models.GovernanceRuleMetadata; import com.azure.resourcemanager.security.models.GovernanceRuleOwnerSource; import com.azure.resourcemanager.security.models.GovernanceRuleSourceResourceType; import com.azure.resourcemanager.security.models.GovernanceRuleType; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Describes properties of an governance rule. */ @Fluent -public final class GovernanceRuleProperties { +public final class GovernanceRuleProperties implements JsonSerializable { /* * The tenantId (GUID) */ - @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) private String tenantId; /* * Display name of the governance rule */ - @JsonProperty(value = "displayName", required = true) private String displayName; /* * Description of the governance rule */ - @JsonProperty(value = "description") private String description; /* - * Governance rule remediation timeframe - this is the time that will affect on the grace-period duration e.g. 7.00:00:00 - means 7 days + * Governance rule remediation timeframe - this is the time that will affect on the grace-period duration e.g. + * 7.00:00:00 - means 7 days */ - @JsonProperty(value = "remediationTimeframe") private String remediationTimeframe; /* * Defines whether there is a grace period on the governance rule */ - @JsonProperty(value = "isGracePeriod") private Boolean isGracePeriod; /* - * The governance rule priority, priority to the lower number. Rules with the same priority on the same scope will not be allowed + * The governance rule priority, priority to the lower number. Rules with the same priority on the same scope will + * not be allowed */ - @JsonProperty(value = "rulePriority", required = true) private int rulePriority; /* * Defines whether the rule is active/inactive */ - @JsonProperty(value = "isDisabled") private Boolean isDisabled; /* * The rule type of the governance rule, defines the source of the rule e.g. Integrated */ - @JsonProperty(value = "ruleType", required = true) private GovernanceRuleType ruleType; /* * The governance rule source, what the rule affects, e.g. Assessments */ - @JsonProperty(value = "sourceResourceType", required = true) private GovernanceRuleSourceResourceType sourceResourceType; /* * Excluded scopes, filter out the descendants of the scope (on management scopes) */ - @JsonProperty(value = "excludedScopes") private List excludedScopes; /* * The governance rule conditionSets - see examples */ - @JsonProperty(value = "conditionSets", required = true) private List conditionSets; /* * Defines whether the rule is management scope rule (master connector as a single scope or management scope) */ - @JsonProperty(value = "includeMemberScopes") private Boolean includeMemberScopes; /* * The owner source for the governance rule - e.g. Manually by user@contoso.com - see example */ - @JsonProperty(value = "ownerSource", required = true) private GovernanceRuleOwnerSource ownerSource; /* - * The email notifications settings for the governance rule, states whether to disable notifications for mangers and owners + * The email notifications settings for the governance rule, states whether to disable notifications for mangers and + * owners */ - @JsonProperty(value = "governanceEmailNotification") private GovernanceRuleEmailNotification governanceEmailNotification; /* * The governance rule metadata */ - @JsonProperty(value = "metadata") private GovernanceRuleMetadata metadata; /** @@ -457,4 +449,90 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(GovernanceRuleProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeIntField("rulePriority", this.rulePriority); + jsonWriter.writeStringField("ruleType", this.ruleType == null ? null : this.ruleType.toString()); + jsonWriter.writeStringField("sourceResourceType", + this.sourceResourceType == null ? null : this.sourceResourceType.toString()); + jsonWriter.writeArrayField("conditionSets", this.conditionSets, + (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeJsonField("ownerSource", this.ownerSource); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("remediationTimeframe", this.remediationTimeframe); + jsonWriter.writeBooleanField("isGracePeriod", this.isGracePeriod); + jsonWriter.writeBooleanField("isDisabled", this.isDisabled); + jsonWriter.writeArrayField("excludedScopes", this.excludedScopes, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("includeMemberScopes", this.includeMemberScopes); + jsonWriter.writeJsonField("governanceEmailNotification", this.governanceEmailNotification); + jsonWriter.writeJsonField("metadata", this.metadata); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GovernanceRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GovernanceRuleProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GovernanceRuleProperties. + */ + public static GovernanceRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GovernanceRuleProperties deserializedGovernanceRuleProperties = new GovernanceRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedGovernanceRuleProperties.displayName = reader.getString(); + } else if ("rulePriority".equals(fieldName)) { + deserializedGovernanceRuleProperties.rulePriority = reader.getInt(); + } else if ("ruleType".equals(fieldName)) { + deserializedGovernanceRuleProperties.ruleType = GovernanceRuleType.fromString(reader.getString()); + } else if ("sourceResourceType".equals(fieldName)) { + deserializedGovernanceRuleProperties.sourceResourceType + = GovernanceRuleSourceResourceType.fromString(reader.getString()); + } else if ("conditionSets".equals(fieldName)) { + List conditionSets = reader.readArray(reader1 -> reader1.readUntyped()); + deserializedGovernanceRuleProperties.conditionSets = conditionSets; + } else if ("ownerSource".equals(fieldName)) { + deserializedGovernanceRuleProperties.ownerSource = GovernanceRuleOwnerSource.fromJson(reader); + } else if ("tenantId".equals(fieldName)) { + deserializedGovernanceRuleProperties.tenantId = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedGovernanceRuleProperties.description = reader.getString(); + } else if ("remediationTimeframe".equals(fieldName)) { + deserializedGovernanceRuleProperties.remediationTimeframe = reader.getString(); + } else if ("isGracePeriod".equals(fieldName)) { + deserializedGovernanceRuleProperties.isGracePeriod = reader.getNullable(JsonReader::getBoolean); + } else if ("isDisabled".equals(fieldName)) { + deserializedGovernanceRuleProperties.isDisabled = reader.getNullable(JsonReader::getBoolean); + } else if ("excludedScopes".equals(fieldName)) { + List excludedScopes = reader.readArray(reader1 -> reader1.getString()); + deserializedGovernanceRuleProperties.excludedScopes = excludedScopes; + } else if ("includeMemberScopes".equals(fieldName)) { + deserializedGovernanceRuleProperties.includeMemberScopes + = reader.getNullable(JsonReader::getBoolean); + } else if ("governanceEmailNotification".equals(fieldName)) { + deserializedGovernanceRuleProperties.governanceEmailNotification + = GovernanceRuleEmailNotification.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + deserializedGovernanceRuleProperties.metadata = GovernanceRuleMetadata.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGovernanceRuleProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportInner.java index 75b77db58ad4..0b1dc8f30ce3 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportInner.java @@ -6,12 +6,15 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.EnvironmentDetails; import com.azure.resourcemanager.security.models.HealthDataClassification; import com.azure.resourcemanager.security.models.Issue; import com.azure.resourcemanager.security.models.ResourceDetailsAutoGenerated; import com.azure.resourcemanager.security.models.StatusAutoGenerated; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -23,9 +26,23 @@ public final class HealthReportInner extends ProxyResource { /* * Properties of a health report */ - @JsonProperty(value = "properties") private HealthReportProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of HealthReportInner class. */ @@ -41,6 +58,36 @@ private HealthReportProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the resourceDetails property: The resource details of the health report. * @@ -222,4 +269,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HealthReportInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HealthReportInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HealthReportInner. + */ + public static HealthReportInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HealthReportInner deserializedHealthReportInner = new HealthReportInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedHealthReportInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedHealthReportInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedHealthReportInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedHealthReportInner.innerProperties = HealthReportProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedHealthReportInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportProperties.java index 5c8d5d0a75cb..3c3cf5c1fbd5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/HealthReportProperties.java @@ -5,13 +5,16 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.EnvironmentDetails; import com.azure.resourcemanager.security.models.HealthDataClassification; import com.azure.resourcemanager.security.models.Issue; import com.azure.resourcemanager.security.models.ResourceDetailsAutoGenerated; import com.azure.resourcemanager.security.models.StatusAutoGenerated; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -19,54 +22,46 @@ * Describes properties of the health report. */ @Fluent -public final class HealthReportProperties { +public final class HealthReportProperties implements JsonSerializable { /* * The resource details of the health report */ - @JsonProperty(value = "resourceDetails") private ResourceDetailsAutoGenerated resourceDetails; /* * The environment details of the resource */ - @JsonProperty(value = "environmentDetails") private EnvironmentDetails environmentDetails; /* * The classification of the health report */ - @JsonProperty(value = "healthDataClassification") private HealthDataClassification healthDataClassification; /* * The status of the health report */ - @JsonProperty(value = "status") private StatusAutoGenerated status; /* * The affected defenders plans by unhealthy report */ - @JsonProperty(value = "affectedDefendersPlans") private List affectedDefendersPlans; /* * The affected defenders sub plans by unhealthy report */ - @JsonProperty(value = "affectedDefendersSubPlans") private List affectedDefendersSubPlans; /* - * Additional data for the given health report, this field can include more details on the resource and the health scenario. + * Additional data for the given health report, this field can include more details on the resource and the health + * scenario. */ - @JsonProperty(value = "reportAdditionalData", access = JsonProperty.Access.WRITE_ONLY) - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map reportAdditionalData; /* * A collection of the issues in the report */ - @JsonProperty(value = "issues") private List issues; /** @@ -247,4 +242,67 @@ public void validate() { issues().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resourceDetails", this.resourceDetails); + jsonWriter.writeJsonField("environmentDetails", this.environmentDetails); + jsonWriter.writeJsonField("healthDataClassification", this.healthDataClassification); + jsonWriter.writeJsonField("status", this.status); + jsonWriter.writeArrayField("affectedDefendersPlans", this.affectedDefendersPlans, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("affectedDefendersSubPlans", this.affectedDefendersSubPlans, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("issues", this.issues, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HealthReportProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HealthReportProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the HealthReportProperties. + */ + public static HealthReportProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HealthReportProperties deserializedHealthReportProperties = new HealthReportProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceDetails".equals(fieldName)) { + deserializedHealthReportProperties.resourceDetails = ResourceDetailsAutoGenerated.fromJson(reader); + } else if ("environmentDetails".equals(fieldName)) { + deserializedHealthReportProperties.environmentDetails = EnvironmentDetails.fromJson(reader); + } else if ("healthDataClassification".equals(fieldName)) { + deserializedHealthReportProperties.healthDataClassification + = HealthDataClassification.fromJson(reader); + } else if ("status".equals(fieldName)) { + deserializedHealthReportProperties.status = StatusAutoGenerated.fromJson(reader); + } else if ("affectedDefendersPlans".equals(fieldName)) { + List affectedDefendersPlans = reader.readArray(reader1 -> reader1.getString()); + deserializedHealthReportProperties.affectedDefendersPlans = affectedDefendersPlans; + } else if ("affectedDefendersSubPlans".equals(fieldName)) { + List affectedDefendersSubPlans = reader.readArray(reader1 -> reader1.getString()); + deserializedHealthReportProperties.affectedDefendersSubPlans = affectedDefendersSubPlans; + } else if ("reportAdditionalData".equals(fieldName)) { + Map reportAdditionalData = reader.readMap(reader1 -> reader1.getString()); + deserializedHealthReportProperties.reportAdditionalData = reportAdditionalData; + } else if ("issues".equals(fieldName)) { + List issues = reader.readArray(reader1 -> Issue.fromJson(reader1)); + deserializedHealthReportProperties.issues = issues; + } else { + reader.skipChildren(); + } + } + + return deserializedHealthReportProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java index 675a449f3fd5..1a8fc7aaed20 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyInner.java @@ -6,9 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.InformationType; import com.azure.resourcemanager.security.models.SensitivityLabel; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.Map; @@ -20,9 +23,23 @@ public final class InformationProtectionPolicyInner extends ProxyResource { /* * Information protection policy data */ - @JsonProperty(value = "properties") private InformationProtectionPolicyProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of InformationProtectionPolicyInner class. */ @@ -38,6 +55,36 @@ private InformationProtectionPolicyProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the lastModifiedUtc property: Describes the last UTC time the policy was modified. * @@ -112,4 +159,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InformationProtectionPolicyInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InformationProtectionPolicyInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InformationProtectionPolicyInner. + */ + public static InformationProtectionPolicyInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InformationProtectionPolicyInner deserializedInformationProtectionPolicyInner + = new InformationProtectionPolicyInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedInformationProtectionPolicyInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedInformationProtectionPolicyInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedInformationProtectionPolicyInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedInformationProtectionPolicyInner.innerProperties + = InformationProtectionPolicyProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedInformationProtectionPolicyInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyProperties.java index c8c4afe5b527..a7cfe8602c72 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/InformationProtectionPolicyProperties.java @@ -5,10 +5,14 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.InformationType; import com.azure.resourcemanager.security.models.SensitivityLabel; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.Map; @@ -16,31 +20,26 @@ * describes properties of an information protection policy. */ @Fluent -public final class InformationProtectionPolicyProperties { +public final class InformationProtectionPolicyProperties + implements JsonSerializable { /* * Describes the last UTC time the policy was modified. */ - @JsonProperty(value = "lastModifiedUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastModifiedUtc; /* * Describes the version of the policy. */ - @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) private String version; /* * Dictionary of sensitivity labels. */ - @JsonProperty(value = "labels") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map labels; /* * The sensitivity information types. */ - @JsonProperty(value = "informationTypes") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map informationTypes; /** @@ -128,4 +127,54 @@ public void validate() { }); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("labels", this.labels, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("informationTypes", this.informationTypes, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InformationProtectionPolicyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InformationProtectionPolicyProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the InformationProtectionPolicyProperties. + */ + public static InformationProtectionPolicyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InformationProtectionPolicyProperties deserializedInformationProtectionPolicyProperties + = new InformationProtectionPolicyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastModifiedUtc".equals(fieldName)) { + deserializedInformationProtectionPolicyProperties.lastModifiedUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("version".equals(fieldName)) { + deserializedInformationProtectionPolicyProperties.version = reader.getString(); + } else if ("labels".equals(fieldName)) { + Map labels + = reader.readMap(reader1 -> SensitivityLabel.fromJson(reader1)); + deserializedInformationProtectionPolicyProperties.labels = labels; + } else if ("informationTypes".equals(fieldName)) { + Map informationTypes + = reader.readMap(reader1 -> InformationType.fromJson(reader1)); + deserializedInformationProtectionPolicyProperties.informationTypes = informationTypes; + } else { + reader.skipChildren(); + } + } + + return deserializedInformationProtectionPolicyProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertInner.java index 6e0d7744ab16..343f45767548 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertInner.java @@ -6,10 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlertPropertiesTopDevicesListItem; import com.azure.resourcemanager.security.models.ReportedSeverity; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.LocalDate; import java.util.List; import java.util.Map; @@ -22,16 +24,28 @@ public final class IoTSecurityAggregatedAlertInner extends ProxyResource { /* * IoT Security solution aggregated alert details. */ - @JsonProperty(value = "properties") private IoTSecurityAggregatedAlertProperties innerProperties; /* * Resource tags */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of IoTSecurityAggregatedAlertInner class. */ @@ -67,6 +81,36 @@ public IoTSecurityAggregatedAlertInner withTags(Map tags) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the alertType property: Name of the alert type. * @@ -195,4 +239,53 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTSecurityAggregatedAlertInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTSecurityAggregatedAlertInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IoTSecurityAggregatedAlertInner. + */ + public static IoTSecurityAggregatedAlertInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTSecurityAggregatedAlertInner deserializedIoTSecurityAggregatedAlertInner + = new IoTSecurityAggregatedAlertInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertInner.innerProperties + = IoTSecurityAggregatedAlertProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedIoTSecurityAggregatedAlertInner.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedIoTSecurityAggregatedAlertInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertProperties.java index 98c98aaa7f3b..9a0f7a962955 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedAlertProperties.java @@ -5,9 +5,13 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.IoTSecurityAggregatedAlertPropertiesTopDevicesListItem; import com.azure.resourcemanager.security.models.ReportedSeverity; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.LocalDate; import java.util.List; @@ -15,83 +19,71 @@ * IoT Security solution aggregated alert details. */ @Immutable -public final class IoTSecurityAggregatedAlertProperties { +public final class IoTSecurityAggregatedAlertProperties + implements JsonSerializable { /* * Name of the alert type. */ - @JsonProperty(value = "alertType", access = JsonProperty.Access.WRITE_ONLY) private String alertType; /* * Display name of the alert type. */ - @JsonProperty(value = "alertDisplayName", access = JsonProperty.Access.WRITE_ONLY) private String alertDisplayName; /* * Date of detection. */ - @JsonProperty(value = "aggregatedDateUtc", access = JsonProperty.Access.WRITE_ONLY) private LocalDate aggregatedDateUtc; /* * Name of the organization that raised the alert. */ - @JsonProperty(value = "vendorName", access = JsonProperty.Access.WRITE_ONLY) private String vendorName; /* * Assessed alert severity. */ - @JsonProperty(value = "reportedSeverity", access = JsonProperty.Access.WRITE_ONLY) private ReportedSeverity reportedSeverity; /* * Recommended steps for remediation. */ - @JsonProperty(value = "remediationSteps", access = JsonProperty.Access.WRITE_ONLY) private String remediationSteps; /* * Description of the suspected vulnerability and meaning. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * Number of alerts occurrences within the aggregated time window. */ - @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) private Long count; /* * Azure resource ID of the resource that received the alerts. */ - @JsonProperty(value = "effectedResourceType", access = JsonProperty.Access.WRITE_ONLY) private String effectedResourceType; /* * The type of the alerted resource (Azure, Non-Azure). */ - @JsonProperty(value = "systemSource", access = JsonProperty.Access.WRITE_ONLY) private String systemSource; /* * IoT Security solution alert response. */ - @JsonProperty(value = "actionTaken", access = JsonProperty.Access.WRITE_ONLY) private String actionTaken; /* * Log analytics query for getting the list of affected devices/alerts. */ - @JsonProperty(value = "logAnalyticsQuery", access = JsonProperty.Access.WRITE_ONLY) private String logAnalyticsQuery; /* * 10 devices with the highest number of occurrences of this alert type, on this day. */ - @JsonProperty(value = "topDevicesList", access = JsonProperty.Access.WRITE_ONLY) private List topDevicesList; /** @@ -228,4 +220,68 @@ public void validate() { topDevicesList().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTSecurityAggregatedAlertProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTSecurityAggregatedAlertProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the IoTSecurityAggregatedAlertProperties. + */ + public static IoTSecurityAggregatedAlertProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTSecurityAggregatedAlertProperties deserializedIoTSecurityAggregatedAlertProperties + = new IoTSecurityAggregatedAlertProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("alertType".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.alertType = reader.getString(); + } else if ("alertDisplayName".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.alertDisplayName = reader.getString(); + } else if ("aggregatedDateUtc".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.aggregatedDateUtc + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("vendorName".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.vendorName = reader.getString(); + } else if ("reportedSeverity".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.reportedSeverity + = ReportedSeverity.fromString(reader.getString()); + } else if ("remediationSteps".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.remediationSteps = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.description = reader.getString(); + } else if ("count".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.count = reader.getNullable(JsonReader::getLong); + } else if ("effectedResourceType".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.effectedResourceType = reader.getString(); + } else if ("systemSource".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.systemSource = reader.getString(); + } else if ("actionTaken".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.actionTaken = reader.getString(); + } else if ("logAnalyticsQuery".equals(fieldName)) { + deserializedIoTSecurityAggregatedAlertProperties.logAnalyticsQuery = reader.getString(); + } else if ("topDevicesList".equals(fieldName)) { + List topDevicesList = reader + .readArray(reader1 -> IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.fromJson(reader1)); + deserializedIoTSecurityAggregatedAlertProperties.topDevicesList = topDevicesList; + } else { + reader.skipChildren(); + } + } + + return deserializedIoTSecurityAggregatedAlertProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationInner.java index ae23b23f9aea..171b339d1e97 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationInner.java @@ -6,9 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ReportedSeverity; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -19,16 +21,28 @@ public final class IoTSecurityAggregatedRecommendationInner extends ProxyResourc /* * Security Solution data */ - @JsonProperty(value = "properties") private IoTSecurityAggregatedRecommendationProperties innerProperties; /* * Resource tags */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of IoTSecurityAggregatedRecommendationInner class. */ @@ -64,6 +78,36 @@ public IoTSecurityAggregatedRecommendationInner withTags(Map tag return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the recommendationName property: Name of the recommendation. * @@ -178,4 +222,53 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTSecurityAggregatedRecommendationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTSecurityAggregatedRecommendationInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IoTSecurityAggregatedRecommendationInner. + */ + public static IoTSecurityAggregatedRecommendationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTSecurityAggregatedRecommendationInner deserializedIoTSecurityAggregatedRecommendationInner + = new IoTSecurityAggregatedRecommendationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationInner.innerProperties + = IoTSecurityAggregatedRecommendationProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedIoTSecurityAggregatedRecommendationInner.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedIoTSecurityAggregatedRecommendationInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationProperties.java index 0c1305dc7710..0a77745c1d83 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecurityAggregatedRecommendationProperties.java @@ -5,72 +5,67 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ReportedSeverity; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * IoT Security solution aggregated recommendation information. */ @Fluent -public final class IoTSecurityAggregatedRecommendationProperties { +public final class IoTSecurityAggregatedRecommendationProperties + implements JsonSerializable { /* * Name of the recommendation. */ - @JsonProperty(value = "recommendationName") private String recommendationName; /* * Display name of the recommendation type. */ - @JsonProperty(value = "recommendationDisplayName", access = JsonProperty.Access.WRITE_ONLY) private String recommendationDisplayName; /* * Description of the suspected vulnerability and meaning. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * Recommendation-type GUID. */ - @JsonProperty(value = "recommendationTypeId", access = JsonProperty.Access.WRITE_ONLY) private String recommendationTypeId; /* * Name of the organization that made the recommendation. */ - @JsonProperty(value = "detectedBy", access = JsonProperty.Access.WRITE_ONLY) private String detectedBy; /* * Recommended steps for remediation */ - @JsonProperty(value = "remediationSteps", access = JsonProperty.Access.WRITE_ONLY) private String remediationSteps; /* * Assessed recommendation severity. */ - @JsonProperty(value = "reportedSeverity", access = JsonProperty.Access.WRITE_ONLY) private ReportedSeverity reportedSeverity; /* * Number of healthy devices within the IoT Security solution. */ - @JsonProperty(value = "healthyDevices", access = JsonProperty.Access.WRITE_ONLY) private Long healthyDevices; /* * Number of unhealthy devices within the IoT Security solution. */ - @JsonProperty(value = "unhealthyDeviceCount", access = JsonProperty.Access.WRITE_ONLY) private Long unhealthyDeviceCount; /* * Log analytics query for getting the list of affected devices/alerts. */ - @JsonProperty(value = "logAnalyticsQuery", access = JsonProperty.Access.WRITE_ONLY) private String logAnalyticsQuery; /** @@ -187,4 +182,63 @@ public String logAnalyticsQuery() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recommendationName", this.recommendationName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTSecurityAggregatedRecommendationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTSecurityAggregatedRecommendationProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the IoTSecurityAggregatedRecommendationProperties. + */ + public static IoTSecurityAggregatedRecommendationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTSecurityAggregatedRecommendationProperties deserializedIoTSecurityAggregatedRecommendationProperties + = new IoTSecurityAggregatedRecommendationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recommendationName".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.recommendationName = reader.getString(); + } else if ("recommendationDisplayName".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.recommendationDisplayName + = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.description = reader.getString(); + } else if ("recommendationTypeId".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.recommendationTypeId = reader.getString(); + } else if ("detectedBy".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.detectedBy = reader.getString(); + } else if ("remediationSteps".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.remediationSteps = reader.getString(); + } else if ("reportedSeverity".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.reportedSeverity + = ReportedSeverity.fromString(reader.getString()); + } else if ("healthyDevices".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.healthyDevices + = reader.getNullable(JsonReader::getLong); + } else if ("unhealthyDeviceCount".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.unhealthyDeviceCount + = reader.getNullable(JsonReader::getLong); + } else if ("logAnalyticsQuery".equals(fieldName)) { + deserializedIoTSecurityAggregatedRecommendationProperties.logAnalyticsQuery = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIoTSecurityAggregatedRecommendationProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelInner.java index a7ad67332eed..9208df85ca9b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelInner.java @@ -6,12 +6,15 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.IoTSecurityAlertedDevice; import com.azure.resourcemanager.security.models.IoTSecurityDeviceAlert; import com.azure.resourcemanager.security.models.IoTSecurityDeviceRecommendation; import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem; import com.azure.resourcemanager.security.models.IoTSeverityMetrics; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -20,11 +23,25 @@ @Fluent public final class IoTSecuritySolutionAnalyticsModelInner extends ProxyResource { /* - * Security Solution Aggregated Alert data + * Security Solution Aggregated Alert data */ - @JsonProperty(value = "properties") private IoTSecuritySolutionAnalyticsModelProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of IoTSecuritySolutionAnalyticsModelInner class. */ @@ -40,6 +57,36 @@ private IoTSecuritySolutionAnalyticsModelProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the metrics property: Security analytics of your IoT Security solution. * @@ -149,4 +196,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTSecuritySolutionAnalyticsModelInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTSecuritySolutionAnalyticsModelInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IoTSecuritySolutionAnalyticsModelInner. + */ + public static IoTSecuritySolutionAnalyticsModelInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTSecuritySolutionAnalyticsModelInner deserializedIoTSecuritySolutionAnalyticsModelInner + = new IoTSecuritySolutionAnalyticsModelInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIoTSecuritySolutionAnalyticsModelInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIoTSecuritySolutionAnalyticsModelInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIoTSecuritySolutionAnalyticsModelInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedIoTSecuritySolutionAnalyticsModelInner.innerProperties + = IoTSecuritySolutionAnalyticsModelProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIoTSecuritySolutionAnalyticsModelInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelListInner.java index 405c475d0420..46cf8e52ec0d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelListInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelListInner.java @@ -6,24 +6,27 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * List of Security analytics of your IoT Security solution. */ @Fluent -public final class IoTSecuritySolutionAnalyticsModelListInner { +public final class IoTSecuritySolutionAnalyticsModelListInner + implements JsonSerializable { /* * List of Security analytics of your IoT Security solution */ - @JsonProperty(value = "value", required = true) private List value; /* * When there is too much alert data for one page, use this URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -77,4 +80,46 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(IoTSecuritySolutionAnalyticsModelListInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTSecuritySolutionAnalyticsModelListInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTSecuritySolutionAnalyticsModelListInner if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IoTSecuritySolutionAnalyticsModelListInner. + */ + public static IoTSecuritySolutionAnalyticsModelListInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTSecuritySolutionAnalyticsModelListInner deserializedIoTSecuritySolutionAnalyticsModelListInner + = new IoTSecuritySolutionAnalyticsModelListInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> IoTSecuritySolutionAnalyticsModelInner.fromJson(reader1)); + deserializedIoTSecuritySolutionAnalyticsModelListInner.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedIoTSecuritySolutionAnalyticsModelListInner.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIoTSecuritySolutionAnalyticsModelListInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelProperties.java index c43a6fdf5de6..b4078f2c67d2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionAnalyticsModelProperties.java @@ -5,53 +5,52 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.IoTSecurityAlertedDevice; import com.azure.resourcemanager.security.models.IoTSecurityDeviceAlert; import com.azure.resourcemanager.security.models.IoTSecurityDeviceRecommendation; import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem; import com.azure.resourcemanager.security.models.IoTSeverityMetrics; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Security analytics properties of your IoT Security solution. */ @Fluent -public final class IoTSecuritySolutionAnalyticsModelProperties { +public final class IoTSecuritySolutionAnalyticsModelProperties + implements JsonSerializable { /* * Security analytics of your IoT Security solution. */ - @JsonProperty(value = "metrics", access = JsonProperty.Access.WRITE_ONLY) private IoTSeverityMetrics metrics; /* * Number of unhealthy devices within your IoT Security solution. */ - @JsonProperty(value = "unhealthyDeviceCount", access = JsonProperty.Access.WRITE_ONLY) private Long unhealthyDeviceCount; /* * List of device metrics by the aggregation date. */ - @JsonProperty(value = "devicesMetrics", access = JsonProperty.Access.WRITE_ONLY) private List devicesMetrics; /* * List of the 3 devices with the most alerts. */ - @JsonProperty(value = "topAlertedDevices") private List topAlertedDevices; /* * List of the 3 most prevalent device alerts. */ - @JsonProperty(value = "mostPrevalentDeviceAlerts") private List mostPrevalentDeviceAlerts; /* * List of the 3 most prevalent device recommendations. */ - @JsonProperty(value = "mostPrevalentDeviceRecommendations") private List mostPrevalentDeviceRecommendations; /** @@ -172,4 +171,69 @@ public void validate() { mostPrevalentDeviceRecommendations().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("topAlertedDevices", this.topAlertedDevices, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("mostPrevalentDeviceAlerts", this.mostPrevalentDeviceAlerts, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("mostPrevalentDeviceRecommendations", this.mostPrevalentDeviceRecommendations, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTSecuritySolutionAnalyticsModelProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTSecuritySolutionAnalyticsModelProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the IoTSecuritySolutionAnalyticsModelProperties. + */ + public static IoTSecuritySolutionAnalyticsModelProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTSecuritySolutionAnalyticsModelProperties deserializedIoTSecuritySolutionAnalyticsModelProperties + = new IoTSecuritySolutionAnalyticsModelProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metrics".equals(fieldName)) { + deserializedIoTSecuritySolutionAnalyticsModelProperties.metrics + = IoTSeverityMetrics.fromJson(reader); + } else if ("unhealthyDeviceCount".equals(fieldName)) { + deserializedIoTSecuritySolutionAnalyticsModelProperties.unhealthyDeviceCount + = reader.getNullable(JsonReader::getLong); + } else if ("devicesMetrics".equals(fieldName)) { + List devicesMetrics + = reader.readArray( + reader1 -> IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.fromJson(reader1)); + deserializedIoTSecuritySolutionAnalyticsModelProperties.devicesMetrics = devicesMetrics; + } else if ("topAlertedDevices".equals(fieldName)) { + List topAlertedDevices + = reader.readArray(reader1 -> IoTSecurityAlertedDevice.fromJson(reader1)); + deserializedIoTSecuritySolutionAnalyticsModelProperties.topAlertedDevices = topAlertedDevices; + } else if ("mostPrevalentDeviceAlerts".equals(fieldName)) { + List mostPrevalentDeviceAlerts + = reader.readArray(reader1 -> IoTSecurityDeviceAlert.fromJson(reader1)); + deserializedIoTSecuritySolutionAnalyticsModelProperties.mostPrevalentDeviceAlerts + = mostPrevalentDeviceAlerts; + } else if ("mostPrevalentDeviceRecommendations".equals(fieldName)) { + List mostPrevalentDeviceRecommendations + = reader.readArray(reader1 -> IoTSecurityDeviceRecommendation.fromJson(reader1)); + deserializedIoTSecuritySolutionAnalyticsModelProperties.mostPrevalentDeviceRecommendations + = mostPrevalentDeviceRecommendations; + } else { + reader.skipChildren(); + } + } + + return deserializedIoTSecuritySolutionAnalyticsModelProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionModelInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionModelInner.java index 85f9cf832bdb..9117476b4aad 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionModelInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionModelInner.java @@ -7,6 +7,9 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AdditionalWorkspacesProperties; import com.azure.resourcemanager.security.models.DataSource; import com.azure.resourcemanager.security.models.ExportData; @@ -14,8 +17,7 @@ import com.azure.resourcemanager.security.models.SecuritySolutionStatus; import com.azure.resourcemanager.security.models.UnmaskedIpLoggingStatus; import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -27,28 +29,38 @@ public final class IoTSecuritySolutionModelInner extends ProxyResource { /* * The resource location. */ - @JsonProperty(value = "location") private String location; /* * Security Solution data */ - @JsonProperty(value = "properties") private IoTSecuritySolutionProperties innerProperties; /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * Resource tags */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of IoTSecuritySolutionModelInner class. */ @@ -113,6 +125,36 @@ public IoTSecuritySolutionModelInner withTags(Map tags) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the workspace property: Workspace resource ID. * @@ -365,4 +407,58 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTSecuritySolutionModelInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTSecuritySolutionModelInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IoTSecuritySolutionModelInner. + */ + public static IoTSecuritySolutionModelInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTSecuritySolutionModelInner deserializedIoTSecuritySolutionModelInner + = new IoTSecuritySolutionModelInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIoTSecuritySolutionModelInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIoTSecuritySolutionModelInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIoTSecuritySolutionModelInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedIoTSecuritySolutionModelInner.location = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedIoTSecuritySolutionModelInner.innerProperties + = IoTSecuritySolutionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedIoTSecuritySolutionModelInner.systemData = SystemData.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedIoTSecuritySolutionModelInner.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedIoTSecuritySolutionModelInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionProperties.java index 9ef5c730a55f..ee9bf93a8ba4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/IoTSecuritySolutionProperties.java @@ -6,6 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AdditionalWorkspacesProperties; import com.azure.resourcemanager.security.models.DataSource; import com.azure.resourcemanager.security.models.ExportData; @@ -13,78 +17,67 @@ import com.azure.resourcemanager.security.models.SecuritySolutionStatus; import com.azure.resourcemanager.security.models.UnmaskedIpLoggingStatus; import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Security Solution setting data. */ @Fluent -public final class IoTSecuritySolutionProperties { +public final class IoTSecuritySolutionProperties implements JsonSerializable { /* * Workspace resource ID */ - @JsonProperty(value = "workspace") private String workspace; /* * Resource display name. */ - @JsonProperty(value = "displayName", required = true) private String displayName; /* * Status of the IoT Security solution. */ - @JsonProperty(value = "status") private SecuritySolutionStatus status; /* * List of additional options for exporting to workspace data. */ - @JsonProperty(value = "export") private List export; /* * Disabled data sources. Disabling these data sources compromises the system. */ - @JsonProperty(value = "disabledDataSources") private List disabledDataSources; /* * IoT Hub resource IDs */ - @JsonProperty(value = "iotHubs", required = true) private List iotHubs; /* * Properties of the IoT Security solution's user defined resources. */ - @JsonProperty(value = "userDefinedResources") private UserDefinedResourcesProperties userDefinedResources; /* * List of resources that were automatically discovered as relevant to the security solution. */ - @JsonProperty(value = "autoDiscoveredResources", access = JsonProperty.Access.WRITE_ONLY) private List autoDiscoveredResources; /* * List of the configuration status for each recommendation type. */ - @JsonProperty(value = "recommendationsConfiguration") private List recommendationsConfiguration; /* * Unmasked IP address logging status */ - @JsonProperty(value = "unmaskedIpLoggingStatus") private UnmaskedIpLoggingStatus unmaskedIpLoggingStatus; /* * List of additional workspaces */ - @JsonProperty(value = "additionalWorkspaces") private List additionalWorkspaces; /** @@ -333,4 +326,89 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(IoTSecuritySolutionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeArrayField("iotHubs", this.iotHubs, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("workspace", this.workspace); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeArrayField("export", this.export, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("disabledDataSources", this.disabledDataSources, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeJsonField("userDefinedResources", this.userDefinedResources); + jsonWriter.writeArrayField("recommendationsConfiguration", this.recommendationsConfiguration, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("unmaskedIpLoggingStatus", + this.unmaskedIpLoggingStatus == null ? null : this.unmaskedIpLoggingStatus.toString()); + jsonWriter.writeArrayField("additionalWorkspaces", this.additionalWorkspaces, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IoTSecuritySolutionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IoTSecuritySolutionProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IoTSecuritySolutionProperties. + */ + public static IoTSecuritySolutionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IoTSecuritySolutionProperties deserializedIoTSecuritySolutionProperties + = new IoTSecuritySolutionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedIoTSecuritySolutionProperties.displayName = reader.getString(); + } else if ("iotHubs".equals(fieldName)) { + List iotHubs = reader.readArray(reader1 -> reader1.getString()); + deserializedIoTSecuritySolutionProperties.iotHubs = iotHubs; + } else if ("workspace".equals(fieldName)) { + deserializedIoTSecuritySolutionProperties.workspace = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedIoTSecuritySolutionProperties.status + = SecuritySolutionStatus.fromString(reader.getString()); + } else if ("export".equals(fieldName)) { + List export = reader.readArray(reader1 -> ExportData.fromString(reader1.getString())); + deserializedIoTSecuritySolutionProperties.export = export; + } else if ("disabledDataSources".equals(fieldName)) { + List disabledDataSources + = reader.readArray(reader1 -> DataSource.fromString(reader1.getString())); + deserializedIoTSecuritySolutionProperties.disabledDataSources = disabledDataSources; + } else if ("userDefinedResources".equals(fieldName)) { + deserializedIoTSecuritySolutionProperties.userDefinedResources + = UserDefinedResourcesProperties.fromJson(reader); + } else if ("autoDiscoveredResources".equals(fieldName)) { + List autoDiscoveredResources = reader.readArray(reader1 -> reader1.getString()); + deserializedIoTSecuritySolutionProperties.autoDiscoveredResources = autoDiscoveredResources; + } else if ("recommendationsConfiguration".equals(fieldName)) { + List recommendationsConfiguration + = reader.readArray(reader1 -> RecommendationConfigurationProperties.fromJson(reader1)); + deserializedIoTSecuritySolutionProperties.recommendationsConfiguration + = recommendationsConfiguration; + } else if ("unmaskedIpLoggingStatus".equals(fieldName)) { + deserializedIoTSecuritySolutionProperties.unmaskedIpLoggingStatus + = UnmaskedIpLoggingStatus.fromString(reader.getString()); + } else if ("additionalWorkspaces".equals(fieldName)) { + List additionalWorkspaces + = reader.readArray(reader1 -> AdditionalWorkspacesProperties.fromJson(reader1)); + deserializedIoTSecuritySolutionProperties.additionalWorkspaces = additionalWorkspaces; + } else { + reader.skipChildren(); + } + } + + return deserializedIoTSecuritySolutionProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyInner.java index 4d95f78766a6..b94efca0f500 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyVirtualMachine; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -19,21 +22,33 @@ public final class JitNetworkAccessPolicyInner extends ProxyResource { /* * The properties property. */ - @JsonProperty(value = "properties", required = true) private JitNetworkAccessPolicyProperties innerProperties = new JitNetworkAccessPolicyProperties(); /* * Kind of the resource */ - @JsonProperty(value = "kind") private String kind; /* * Location where the resource is stored */ - @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) private String location; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of JitNetworkAccessPolicyInner class. */ @@ -78,6 +93,36 @@ public String location() { return this.location; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the virtualMachines property: Configurations for Microsoft.Compute/virtualMachines resource type. * @@ -149,4 +194,53 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(JitNetworkAccessPolicyInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JitNetworkAccessPolicyInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JitNetworkAccessPolicyInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JitNetworkAccessPolicyInner. + */ + public static JitNetworkAccessPolicyInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JitNetworkAccessPolicyInner deserializedJitNetworkAccessPolicyInner = new JitNetworkAccessPolicyInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedJitNetworkAccessPolicyInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedJitNetworkAccessPolicyInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedJitNetworkAccessPolicyInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedJitNetworkAccessPolicyInner.innerProperties + = JitNetworkAccessPolicyProperties.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedJitNetworkAccessPolicyInner.kind = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedJitNetworkAccessPolicyInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJitNetworkAccessPolicyInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyProperties.java index 793687ba1ffd..167b827ec5df 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessPolicyProperties.java @@ -6,31 +6,32 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.JitNetworkAccessPolicyVirtualMachine; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The JitNetworkAccessPolicyProperties model. */ @Fluent -public final class JitNetworkAccessPolicyProperties { +public final class JitNetworkAccessPolicyProperties implements JsonSerializable { /* * Configurations for Microsoft.Compute/virtualMachines resource type. */ - @JsonProperty(value = "virtualMachines", required = true) private List virtualMachines; /* * The requests property. */ - @JsonProperty(value = "requests") private List requests; /* * Gets the provisioning state of the Just-in-Time policy. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private String provisioningState; /** @@ -108,4 +109,52 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(JitNetworkAccessPolicyProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("virtualMachines", this.virtualMachines, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("requests", this.requests, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JitNetworkAccessPolicyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JitNetworkAccessPolicyProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JitNetworkAccessPolicyProperties. + */ + public static JitNetworkAccessPolicyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JitNetworkAccessPolicyProperties deserializedJitNetworkAccessPolicyProperties + = new JitNetworkAccessPolicyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("virtualMachines".equals(fieldName)) { + List virtualMachines + = reader.readArray(reader1 -> JitNetworkAccessPolicyVirtualMachine.fromJson(reader1)); + deserializedJitNetworkAccessPolicyProperties.virtualMachines = virtualMachines; + } else if ("requests".equals(fieldName)) { + List requests + = reader.readArray(reader1 -> JitNetworkAccessRequestInner.fromJson(reader1)); + deserializedJitNetworkAccessPolicyProperties.requests = requests; + } else if ("provisioningState".equals(fieldName)) { + deserializedJitNetworkAccessPolicyProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJitNetworkAccessPolicyProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessRequestInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessRequestInner.java index 648d692b819c..0407efba412b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessRequestInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/JitNetworkAccessRequestInner.java @@ -5,39 +5,41 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.JitNetworkAccessRequestVirtualMachine; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * The JitNetworkAccessRequest model. */ @Fluent -public final class JitNetworkAccessRequestInner { +public final class JitNetworkAccessRequestInner implements JsonSerializable { /* * The virtualMachines property. */ - @JsonProperty(value = "virtualMachines", required = true) private List virtualMachines; /* * The start time of the request in UTC */ - @JsonProperty(value = "startTimeUtc", required = true) private OffsetDateTime startTimeUtc; /* * The identity of the person who made the request */ - @JsonProperty(value = "requestor", required = true) private String requestor; /* * The justification for making the initiate request */ - @JsonProperty(value = "justification") private String justification; /** @@ -153,4 +155,55 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(JitNetworkAccessRequestInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("virtualMachines", this.virtualMachines, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("startTimeUtc", + this.startTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTimeUtc)); + jsonWriter.writeStringField("requestor", this.requestor); + jsonWriter.writeStringField("justification", this.justification); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JitNetworkAccessRequestInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JitNetworkAccessRequestInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JitNetworkAccessRequestInner. + */ + public static JitNetworkAccessRequestInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JitNetworkAccessRequestInner deserializedJitNetworkAccessRequestInner = new JitNetworkAccessRequestInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("virtualMachines".equals(fieldName)) { + List virtualMachines + = reader.readArray(reader1 -> JitNetworkAccessRequestVirtualMachine.fromJson(reader1)); + deserializedJitNetworkAccessRequestInner.virtualMachines = virtualMachines; + } else if ("startTimeUtc".equals(fieldName)) { + deserializedJitNetworkAccessRequestInner.startTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("requestor".equals(fieldName)) { + deserializedJitNetworkAccessRequestInner.requestor = reader.getString(); + } else if ("justification".equals(fieldName)) { + deserializedJitNetworkAccessRequestInner.justification = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedJitNetworkAccessRequestInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanInner.java new file mode 100644 index 000000000000..90b0339e3e3c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanInner.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.MalwareScanProperties; +import java.io.IOException; + +/** + * Describes the state of a malware scan operation. + */ +@Fluent +public final class MalwareScanInner implements JsonSerializable { + /* + * The properties property. + */ + private MalwareScanProperties properties; + + /** + * Creates an instance of MalwareScanInner class. + */ + public MalwareScanInner() { + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public MalwareScanProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the MalwareScanInner object itself. + */ + public MalwareScanInner withProperties(MalwareScanProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MalwareScanInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MalwareScanInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MalwareScanInner. + */ + public static MalwareScanInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MalwareScanInner deserializedMalwareScanInner = new MalwareScanInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedMalwareScanInner.properties = MalwareScanProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMalwareScanInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanningProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanningProperties.java deleted file mode 100644 index fc1926b41e9e..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MalwareScanningProperties.java +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.security.models.OperationStatus; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Properties of Malware Scanning. - */ -@Fluent -public final class MalwareScanningProperties { - /* - * Properties of On Upload malware scanning. - */ - @JsonProperty(value = "onUpload") - private OnUploadProperties innerOnUpload; - - /* - * Optional. Resource id of an Event Grid Topic to send scan results to. - */ - @JsonProperty(value = "scanResultsEventGridTopicResourceId") - private String scanResultsEventGridTopicResourceId; - - /* - * Upon failure or partial success. Additional data describing Malware Scanning enable/disable operation. - */ - @JsonProperty(value = "operationStatus", access = JsonProperty.Access.WRITE_ONLY) - private OperationStatus operationStatus; - - /** - * Creates an instance of MalwareScanningProperties class. - */ - public MalwareScanningProperties() { - } - - /** - * Get the innerOnUpload property: Properties of On Upload malware scanning. - * - * @return the innerOnUpload value. - */ - private OnUploadProperties innerOnUpload() { - return this.innerOnUpload; - } - - /** - * Get the scanResultsEventGridTopicResourceId property: Optional. Resource id of an Event Grid Topic to send scan - * results to. - * - * @return the scanResultsEventGridTopicResourceId value. - */ - public String scanResultsEventGridTopicResourceId() { - return this.scanResultsEventGridTopicResourceId; - } - - /** - * Set the scanResultsEventGridTopicResourceId property: Optional. Resource id of an Event Grid Topic to send scan - * results to. - * - * @param scanResultsEventGridTopicResourceId the scanResultsEventGridTopicResourceId value to set. - * @return the MalwareScanningProperties object itself. - */ - public MalwareScanningProperties - withScanResultsEventGridTopicResourceId(String scanResultsEventGridTopicResourceId) { - this.scanResultsEventGridTopicResourceId = scanResultsEventGridTopicResourceId; - return this; - } - - /** - * Get the operationStatus property: Upon failure or partial success. Additional data describing Malware Scanning - * enable/disable operation. - * - * @return the operationStatus value. - */ - public OperationStatus operationStatus() { - return this.operationStatus; - } - - /** - * Get the isEnabled property: Indicates whether On Upload malware scanning should be enabled. - * - * @return the isEnabled value. - */ - public Boolean isEnabled() { - return this.innerOnUpload() == null ? null : this.innerOnUpload().isEnabled(); - } - - /** - * Set the isEnabled property: Indicates whether On Upload malware scanning should be enabled. - * - * @param isEnabled the isEnabled value to set. - * @return the MalwareScanningProperties object itself. - */ - public MalwareScanningProperties withIsEnabled(Boolean isEnabled) { - if (this.innerOnUpload() == null) { - this.innerOnUpload = new OnUploadProperties(); - } - this.innerOnUpload().withIsEnabled(isEnabled); - return this; - } - - /** - * Get the capGBPerMonth property: Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. - * - * @return the capGBPerMonth value. - */ - public Integer capGBPerMonth() { - return this.innerOnUpload() == null ? null : this.innerOnUpload().capGBPerMonth(); - } - - /** - * Set the capGBPerMonth property: Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. - * - * @param capGBPerMonth the capGBPerMonth value to set. - * @return the MalwareScanningProperties object itself. - */ - public MalwareScanningProperties withCapGBPerMonth(Integer capGBPerMonth) { - if (this.innerOnUpload() == null) { - this.innerOnUpload = new OnUploadProperties(); - } - this.innerOnUpload().withCapGBPerMonth(capGBPerMonth); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerOnUpload() != null) { - innerOnUpload().validate(); - } - if (operationStatus() != null) { - operationStatus().validate(); - } - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataInner.java index 3202212b2799..08ee0644c6a9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataInner.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The resource of the configuration or data needed to onboard the machine to MDE. @@ -18,9 +21,23 @@ public final class MdeOnboardingDataInner extends ProxyResource { /* * Properties of the MDE configuration or data parameter needed to onboard the machine to MDE */ - @JsonProperty(value = "properties") private MdeOnboardingDataProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of MdeOnboardingDataInner class. */ @@ -37,6 +54,36 @@ private MdeOnboardingDataProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the onboardingPackageWindows property: The onboarding package used to onboard Windows machines to MDE, coded * in base64. This can also be used for onboarding using the dedicated VM Extension. @@ -97,4 +144,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MdeOnboardingDataInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MdeOnboardingDataInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MdeOnboardingDataInner. + */ + public static MdeOnboardingDataInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MdeOnboardingDataInner deserializedMdeOnboardingDataInner = new MdeOnboardingDataInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMdeOnboardingDataInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMdeOnboardingDataInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMdeOnboardingDataInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedMdeOnboardingDataInner.innerProperties = MdeOnboardingDataProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMdeOnboardingDataInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataListInner.java index 5385060ce6a6..b52fa027c861 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataListInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataListInner.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * List of all MDE onboarding data resources. */ @Fluent -public final class MdeOnboardingDataListInner { +public final class MdeOnboardingDataListInner implements JsonSerializable { /* * List of the resources of the configuration or data needed to onboard the machine to MDE */ - @JsonProperty(value = "value") private List value; /** @@ -55,4 +58,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MdeOnboardingDataListInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MdeOnboardingDataListInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MdeOnboardingDataListInner. + */ + public static MdeOnboardingDataListInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MdeOnboardingDataListInner deserializedMdeOnboardingDataListInner = new MdeOnboardingDataListInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MdeOnboardingDataInner.fromJson(reader1)); + deserializedMdeOnboardingDataListInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedMdeOnboardingDataListInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataProperties.java index 33e75d03ff01..be730349ba3e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/MdeOnboardingDataProperties.java @@ -6,23 +6,27 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.CoreUtils; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Properties of the MDE configuration or data parameter needed to onboard the machine to MDE. */ @Fluent -public final class MdeOnboardingDataProperties { +public final class MdeOnboardingDataProperties implements JsonSerializable { /* - * The onboarding package used to onboard Windows machines to MDE, coded in base64. This can also be used for onboarding using the dedicated VM Extension + * The onboarding package used to onboard Windows machines to MDE, coded in base64. This can also be used for + * onboarding using the dedicated VM Extension */ - @JsonProperty(value = "onboardingPackageWindows") private byte[] onboardingPackageWindows; /* - * The onboarding package used to onboard Linux machines to MDE, coded in base64. This can also be used for onboarding using the dedicated VM Extension + * The onboarding package used to onboard Linux machines to MDE, coded in base64. This can also be used for + * onboarding using the dedicated VM Extension */ - @JsonProperty(value = "onboardingPackageLinux") private byte[] onboardingPackageLinux; /** @@ -82,4 +86,43 @@ public MdeOnboardingDataProperties withOnboardingPackageLinux(byte[] onboardingP */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBinaryField("onboardingPackageWindows", this.onboardingPackageWindows); + jsonWriter.writeBinaryField("onboardingPackageLinux", this.onboardingPackageLinux); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MdeOnboardingDataProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MdeOnboardingDataProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the MdeOnboardingDataProperties. + */ + public static MdeOnboardingDataProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MdeOnboardingDataProperties deserializedMdeOnboardingDataProperties = new MdeOnboardingDataProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("onboardingPackageWindows".equals(fieldName)) { + deserializedMdeOnboardingDataProperties.onboardingPackageWindows = reader.getBinary(); + } else if ("onboardingPackageLinux".equals(fieldName)) { + deserializedMdeOnboardingDataProperties.onboardingPackageLinux = reader.getBinary(); + } else { + reader.skipChildren(); + } + } + + return deserializedMdeOnboardingDataProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationInner.java index bb95b9088b5a..1e17d36a44e4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationInner.java @@ -5,32 +5,50 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.ActionType; import com.azure.resourcemanager.security.models.OperationDisplay; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.resourcemanager.security.models.Origin; +import java.io.IOException; /** - * Possible operation in the REST API of Microsoft.Security. + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. */ @Fluent -public final class OperationInner { +public final class OperationInner implements JsonSerializable { /* - * Name of the operation + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* - * Where the operation is originated + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. */ - @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) - private String origin; + private Boolean isDataAction; /* - * Security operation display + * Localized display information for this particular operation. */ - @JsonProperty(value = "display") private OperationDisplay display; + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + /** * Creates an instance of OperationInner class. */ @@ -38,7 +56,8 @@ public OperationInner() { } /** - * Get the name property: Name of the operation. + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". * * @return the name value. */ @@ -47,16 +66,17 @@ public String name() { } /** - * Get the origin property: Where the operation is originated. + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. * - * @return the origin value. + * @return the isDataAction value. */ - public String origin() { - return this.origin; + public Boolean isDataAction() { + return this.isDataAction; } /** - * Get the display property: Security operation display. + * Get the display property: Localized display information for this particular operation. * * @return the display value. */ @@ -65,7 +85,7 @@ public OperationDisplay display() { } /** - * Set the display property: Security operation display. + * Set the display property: Localized display information for this particular operation. * * @param display the display value to set. * @return the OperationInner object itself. @@ -75,6 +95,26 @@ public OperationInner withDisplay(OperationDisplay display) { return this; } + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + /** * Validates the instance. * @@ -85,4 +125,48 @@ public void validate() { display().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationResultAutoGeneratedInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationResultAutoGeneratedInner.java index 697a3841200f..f6e0d792b6de 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationResultAutoGeneratedInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationResultAutoGeneratedInner.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.OperationResult; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Long run operation status of governance rule over a given scope. */ @Immutable -public final class OperationResultAutoGeneratedInner { +public final class OperationResultAutoGeneratedInner implements JsonSerializable { /* * The status of the long run operation result of governance rule */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) private OperationResult status; /** @@ -41,4 +44,41 @@ public OperationResult status() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationResultAutoGeneratedInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationResultAutoGeneratedInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationResultAutoGeneratedInner. + */ + public static OperationResultAutoGeneratedInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationResultAutoGeneratedInner deserializedOperationResultAutoGeneratedInner + = new OperationResultAutoGeneratedInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedOperationResultAutoGeneratedInner.status + = OperationResult.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationResultAutoGeneratedInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationStatusResultInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationStatusResultInner.java index f1e68438eed6..c1afb3a124be 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationStatusResultInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/OperationStatusResultInner.java @@ -6,62 +6,60 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * The current status of an async operation. */ @Fluent -public final class OperationStatusResultInner { +public final class OperationStatusResultInner implements JsonSerializable { /* * Fully qualified ID for the async operation. */ - @JsonProperty(value = "id") private String id; /* * Name of the async operation. */ - @JsonProperty(value = "name") private String name; /* * Operation status. */ - @JsonProperty(value = "status", required = true) private String status; /* * Percent of the operation that is complete. */ - @JsonProperty(value = "percentComplete") private Float percentComplete; /* * The start time of the operation. */ - @JsonProperty(value = "startTime") private OffsetDateTime startTime; /* * The end time of the operation. */ - @JsonProperty(value = "endTime") private OffsetDateTime endTime; /* * The operations list. */ - @JsonProperty(value = "operations") private List operations; /* * If present, details of the operation error. */ - @JsonProperty(value = "error") private ManagementError error; /** @@ -247,4 +245,68 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(OperationStatusResultInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeNumberField("percentComplete", this.percentComplete); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + jsonWriter.writeArrayField("operations", this.operations, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("error", this.error); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusResultInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationStatusResultInner. + */ + public static OperationStatusResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusResultInner deserializedOperationStatusResultInner = new OperationStatusResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedOperationStatusResultInner.status = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedOperationStatusResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOperationStatusResultInner.name = reader.getString(); + } else if ("percentComplete".equals(fieldName)) { + deserializedOperationStatusResultInner.percentComplete = reader.getNullable(JsonReader::getFloat); + } else if ("startTime".equals(fieldName)) { + deserializedOperationStatusResultInner.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedOperationStatusResultInner.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("operations".equals(fieldName)) { + List operations + = reader.readArray(reader1 -> OperationStatusResultInner.fromJson(reader1)); + deserializedOperationStatusResultInner.operations = operations; + } else if ("error".equals(fieldName)) { + deserializedOperationStatusResultInner.error = ManagementError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusResultInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingInner.java index 3bb054b21f8d..ae17c656705a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingInner.java @@ -6,12 +6,15 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.Enforce; import com.azure.resourcemanager.security.models.Extension; import com.azure.resourcemanager.security.models.Inherited; import com.azure.resourcemanager.security.models.PricingTier; import com.azure.resourcemanager.security.models.ResourcesCoverageStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; import java.util.List; @@ -25,9 +28,23 @@ public final class PricingInner extends ProxyResource { /* * Pricing data */ - @JsonProperty(value = "properties") private PricingProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of PricingInner class. */ @@ -43,6 +60,36 @@ private PricingProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the pricingTier property: Indicates whether the Defender plan is enabled on the selected scope. Microsoft * Defender for Cloud is provided in two pricing tiers: free and standard. The standard tier offers advanced @@ -237,4 +284,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PricingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PricingInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PricingInner. + */ + public static PricingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PricingInner deserializedPricingInner = new PricingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPricingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPricingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPricingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPricingInner.innerProperties = PricingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPricingInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingListInner.java index ac175a33c7fa..fdaa6b5b3c4b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingListInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingListInner.java @@ -6,18 +6,21 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * List of pricing configurations response. */ @Fluent -public final class PricingListInner { +public final class PricingListInner implements JsonSerializable { /* * List of pricing configurations */ - @JsonProperty(value = "value", required = true) private List value; /** @@ -61,4 +64,42 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(PricingListInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PricingListInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PricingListInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PricingListInner. + */ + public static PricingListInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PricingListInner deserializedPricingListInner = new PricingListInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> PricingInner.fromJson(reader1)); + deserializedPricingListInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPricingListInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingProperties.java index 0887825011ae..3a4a2ad4b69d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/PricingProperties.java @@ -5,13 +5,18 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.Enforce; import com.azure.resourcemanager.security.models.Extension; import com.azure.resourcemanager.security.models.Inherited; import com.azure.resourcemanager.security.models.PricingTier; import com.azure.resourcemanager.security.models.ResourcesCoverageStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.Duration; import java.time.OffsetDateTime; import java.util.List; @@ -20,71 +25,74 @@ * Pricing properties for the relevant scope. */ @Fluent -public final class PricingProperties { +public final class PricingProperties implements JsonSerializable { /* - * Indicates whether the Defender plan is enabled on the selected scope. Microsoft Defender for Cloud is provided in two pricing tiers: free and standard. The standard tier offers advanced security capabilities, while the free tier offers basic security features. + * Indicates whether the Defender plan is enabled on the selected scope. Microsoft Defender for Cloud is provided in + * two pricing tiers: free and standard. The standard tier offers advanced security capabilities, while the free + * tier offers basic security features. */ - @JsonProperty(value = "pricingTier", required = true) private PricingTier pricingTier; /* - * The sub-plan selected for a Standard pricing configuration, when more than one sub-plan is available. Each sub-plan enables a set of security features. When not specified, full plan is applied. For VirtualMachines plan, available sub plans are 'P1' & 'P2', where for resource level only 'P1' sub plan is supported. + * The sub-plan selected for a Standard pricing configuration, when more than one sub-plan is available. Each + * sub-plan enables a set of security features. When not specified, full plan is applied. For VirtualMachines plan, + * available sub plans are 'P1' & 'P2', where for resource level only 'P1' sub plan is supported. */ - @JsonProperty(value = "subPlan") private String subPlan; /* * The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S). */ - @JsonProperty(value = "freeTrialRemainingTime", access = JsonProperty.Access.WRITE_ONLY) private Duration freeTrialRemainingTime; /* - * Optional. If `pricingTier` is `Standard` then this property holds the date of the last time the `pricingTier` was set to `Standard`, when available (e.g 2023-03-01T12:42:42.1921106Z). + * Optional. If `pricingTier` is `Standard` then this property holds the date of the last time the `pricingTier` was + * set to `Standard`, when available (e.g 2023-03-01T12:42:42.1921106Z). */ - @JsonProperty(value = "enablementTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime enablementTime; /* - * If set to "False", it allows the descendants of this scope to override the pricing configuration set on this scope (allows setting inherited="False"). If set to "True", it prevents overrides and forces this pricing configuration on all the descendants of this scope. This field is only available for subscription-level pricing. + * If set to "False", it allows the descendants of this scope to override the pricing configuration set on this + * scope (allows setting inherited="False"). If set to "True", it prevents overrides and forces this pricing + * configuration on all the descendants of this scope. This field is only available for subscription-level pricing. */ - @JsonProperty(value = "enforce") private Enforce enforce; /* - * "inherited" = "True" indicates that the current scope inherits its pricing configuration from its parent. The ID of the parent scope that provides the inherited configuration is displayed in the "inheritedFrom" field. On the other hand, "inherited" = "False" indicates that the current scope has its own pricing configuration explicitly set, and does not inherit from its parent. This field is read only and available only for resource-level pricing. + * "inherited" = "True" indicates that the current scope inherits its pricing configuration from its parent. The ID + * of the parent scope that provides the inherited configuration is displayed in the "inheritedFrom" field. On the + * other hand, "inherited" = "False" indicates that the current scope has its own pricing configuration explicitly + * set, and does not inherit from its parent. This field is read only and available only for resource-level pricing. */ - @JsonProperty(value = "inherited", access = JsonProperty.Access.WRITE_ONLY) private Inherited inherited; /* - * The id of the scope inherited from. "Null" if not inherited. This field is only available for resource-level pricing. + * The id of the scope inherited from. "Null" if not inherited. This field is only available for resource-level + * pricing. */ - @JsonProperty(value = "inheritedFrom", access = JsonProperty.Access.WRITE_ONLY) private String inheritedFrom; /* - * This field is available for subscription-level only, and reflects the coverage status of the resources under the subscription. Please note: The "pricingTier" field reflects the plan status of the subscription. However, since the plan status can also be defined at the resource level, there might be misalignment between the subscription's plan status and the resource status. This field helps indicate the coverage status of the resources. + * This field is available for subscription-level only, and reflects the coverage status of the resources under the + * subscription. Please note: The "pricingTier" field reflects the plan status of the subscription. However, since + * the plan status can also be defined at the resource level, there might be misalignment between the subscription's + * plan status and the resource status. This field helps indicate the coverage status of the resources. */ - @JsonProperty(value = "resourcesCoverageStatus", access = JsonProperty.Access.WRITE_ONLY) private ResourcesCoverageStatus resourcesCoverageStatus; /* * Optional. List of extensions offered under a plan. */ - @JsonProperty(value = "extensions") private List extensions; /* * Optional. True if the plan is deprecated. If there are replacing plans they will appear in `replacedBy` property */ - @JsonProperty(value = "deprecated", access = JsonProperty.Access.WRITE_ONLY) private Boolean deprecated; /* * Optional. List of plans that replace this plan. This property exists only if this plan is deprecated. */ - @JsonProperty(value = "replacedBy", access = JsonProperty.Access.WRITE_ONLY) private List replacedBy; /** @@ -281,4 +289,69 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(PricingProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("pricingTier", this.pricingTier == null ? null : this.pricingTier.toString()); + jsonWriter.writeStringField("subPlan", this.subPlan); + jsonWriter.writeStringField("enforce", this.enforce == null ? null : this.enforce.toString()); + jsonWriter.writeArrayField("extensions", this.extensions, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PricingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PricingProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PricingProperties. + */ + public static PricingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PricingProperties deserializedPricingProperties = new PricingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("pricingTier".equals(fieldName)) { + deserializedPricingProperties.pricingTier = PricingTier.fromString(reader.getString()); + } else if ("subPlan".equals(fieldName)) { + deserializedPricingProperties.subPlan = reader.getString(); + } else if ("freeTrialRemainingTime".equals(fieldName)) { + deserializedPricingProperties.freeTrialRemainingTime + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("enablementTime".equals(fieldName)) { + deserializedPricingProperties.enablementTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("enforce".equals(fieldName)) { + deserializedPricingProperties.enforce = Enforce.fromString(reader.getString()); + } else if ("inherited".equals(fieldName)) { + deserializedPricingProperties.inherited = Inherited.fromString(reader.getString()); + } else if ("inheritedFrom".equals(fieldName)) { + deserializedPricingProperties.inheritedFrom = reader.getString(); + } else if ("resourcesCoverageStatus".equals(fieldName)) { + deserializedPricingProperties.resourcesCoverageStatus + = ResourcesCoverageStatus.fromString(reader.getString()); + } else if ("extensions".equals(fieldName)) { + List extensions = reader.readArray(reader1 -> Extension.fromJson(reader1)); + deserializedPricingProperties.extensions = extensions; + } else if ("deprecated".equals(fieldName)) { + deserializedPricingProperties.deprecated = reader.getNullable(JsonReader::getBoolean); + } else if ("replacedBy".equals(fieldName)) { + List replacedBy = reader.readArray(reader1 -> reader1.getString()); + deserializedPricingProperties.replacedBy = replacedBy; + } else { + reader.skipChildren(); + } + } + + return deserializedPricingProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentInner.java index f954272f0662..db1ceabcf8cb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.State; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Regulatory compliance assessment details and state. @@ -17,9 +20,23 @@ public final class RegulatoryComplianceAssessmentInner extends ProxyResource { /* * Regulatory compliance assessment data */ - @JsonProperty(value = "properties") private RegulatoryComplianceAssessmentProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of RegulatoryComplianceAssessmentInner class. */ @@ -35,6 +52,36 @@ private RegulatoryComplianceAssessmentProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the description property: The description of the regulatory compliance assessment. * @@ -132,4 +179,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegulatoryComplianceAssessmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegulatoryComplianceAssessmentInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RegulatoryComplianceAssessmentInner. + */ + public static RegulatoryComplianceAssessmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegulatoryComplianceAssessmentInner deserializedRegulatoryComplianceAssessmentInner + = new RegulatoryComplianceAssessmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentInner.innerProperties + = RegulatoryComplianceAssessmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRegulatoryComplianceAssessmentInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentProperties.java index 693742fff110..fe1aae6b2b07 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceAssessmentProperties.java @@ -5,60 +5,57 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.State; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Regulatory compliance assessment data. */ @Fluent -public final class RegulatoryComplianceAssessmentProperties { +public final class RegulatoryComplianceAssessmentProperties + implements JsonSerializable { /* * The description of the regulatory compliance assessment */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * The expected type of assessment contained in the AssessmentDetailsLink */ - @JsonProperty(value = "assessmentType", access = JsonProperty.Access.WRITE_ONLY) private String assessmentType; /* * Link to more detailed assessment results data. The response type will be according to the assessmentType field */ - @JsonProperty(value = "assessmentDetailsLink", access = JsonProperty.Access.WRITE_ONLY) private String assessmentDetailsLink; /* * Aggregative state based on the assessment's scanned resources states */ - @JsonProperty(value = "state") private State state; /* * The given assessment's related resources count with passed state. */ - @JsonProperty(value = "passedResources", access = JsonProperty.Access.WRITE_ONLY) private Integer passedResources; /* * The given assessment's related resources count with failed state. */ - @JsonProperty(value = "failedResources", access = JsonProperty.Access.WRITE_ONLY) private Integer failedResources; /* * The given assessment's related resources count with skipped state. */ - @JsonProperty(value = "skippedResources", access = JsonProperty.Access.WRITE_ONLY) private Integer skippedResources; /* * The given assessment's related resources count with unsupported state. */ - @JsonProperty(value = "unsupportedResources", access = JsonProperty.Access.WRITE_ONLY) private Integer unsupportedResources; /** @@ -158,4 +155,59 @@ public Integer unsupportedResources() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegulatoryComplianceAssessmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegulatoryComplianceAssessmentProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RegulatoryComplianceAssessmentProperties. + */ + public static RegulatoryComplianceAssessmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegulatoryComplianceAssessmentProperties deserializedRegulatoryComplianceAssessmentProperties + = new RegulatoryComplianceAssessmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentProperties.description = reader.getString(); + } else if ("assessmentType".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentProperties.assessmentType = reader.getString(); + } else if ("assessmentDetailsLink".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentProperties.assessmentDetailsLink = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentProperties.state = State.fromString(reader.getString()); + } else if ("passedResources".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentProperties.passedResources + = reader.getNullable(JsonReader::getInt); + } else if ("failedResources".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentProperties.failedResources + = reader.getNullable(JsonReader::getInt); + } else if ("skippedResources".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentProperties.skippedResources + = reader.getNullable(JsonReader::getInt); + } else if ("unsupportedResources".equals(fieldName)) { + deserializedRegulatoryComplianceAssessmentProperties.unsupportedResources + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedRegulatoryComplianceAssessmentProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlInner.java index b92479007f61..7d016a07c7e9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.State; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Regulatory compliance control details and state. @@ -17,9 +20,23 @@ public final class RegulatoryComplianceControlInner extends ProxyResource { /* * Regulatory compliance control data */ - @JsonProperty(value = "properties") private RegulatoryComplianceControlProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of RegulatoryComplianceControlInner class. */ @@ -35,6 +52,36 @@ private RegulatoryComplianceControlProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the description property: The description of the regulatory compliance control. * @@ -107,4 +154,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegulatoryComplianceControlInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegulatoryComplianceControlInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RegulatoryComplianceControlInner. + */ + public static RegulatoryComplianceControlInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegulatoryComplianceControlInner deserializedRegulatoryComplianceControlInner + = new RegulatoryComplianceControlInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRegulatoryComplianceControlInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRegulatoryComplianceControlInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRegulatoryComplianceControlInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRegulatoryComplianceControlInner.innerProperties + = RegulatoryComplianceControlProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRegulatoryComplianceControlInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlProperties.java index 07fd3539ba94..57f20f4c41b7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceControlProperties.java @@ -5,42 +5,42 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.State; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Regulatory compliance control data. */ @Fluent -public final class RegulatoryComplianceControlProperties { +public final class RegulatoryComplianceControlProperties + implements JsonSerializable { /* * The description of the regulatory compliance control */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * Aggregative state based on the control's supported assessments states */ - @JsonProperty(value = "state") private State state; /* * The number of supported regulatory compliance assessments of the given control with a passed state */ - @JsonProperty(value = "passedAssessments", access = JsonProperty.Access.WRITE_ONLY) private Integer passedAssessments; /* * The number of supported regulatory compliance assessments of the given control with a failed state */ - @JsonProperty(value = "failedAssessments", access = JsonProperty.Access.WRITE_ONLY) private Integer failedAssessments; /* * The number of supported regulatory compliance assessments of the given control with a skipped state */ - @JsonProperty(value = "skippedAssessments", access = JsonProperty.Access.WRITE_ONLY) private Integer skippedAssessments; /** @@ -115,4 +115,52 @@ public Integer skippedAssessments() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegulatoryComplianceControlProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegulatoryComplianceControlProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RegulatoryComplianceControlProperties. + */ + public static RegulatoryComplianceControlProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegulatoryComplianceControlProperties deserializedRegulatoryComplianceControlProperties + = new RegulatoryComplianceControlProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedRegulatoryComplianceControlProperties.description = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedRegulatoryComplianceControlProperties.state = State.fromString(reader.getString()); + } else if ("passedAssessments".equals(fieldName)) { + deserializedRegulatoryComplianceControlProperties.passedAssessments + = reader.getNullable(JsonReader::getInt); + } else if ("failedAssessments".equals(fieldName)) { + deserializedRegulatoryComplianceControlProperties.failedAssessments + = reader.getNullable(JsonReader::getInt); + } else if ("skippedAssessments".equals(fieldName)) { + deserializedRegulatoryComplianceControlProperties.skippedAssessments + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedRegulatoryComplianceControlProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardInner.java index cb2a3663524d..7614a7dc7c31 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.State; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Regulatory compliance standard details and state. @@ -17,9 +20,23 @@ public final class RegulatoryComplianceStandardInner extends ProxyResource { /* * Regulatory compliance standard data */ - @JsonProperty(value = "properties") private RegulatoryComplianceStandardProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of RegulatoryComplianceStandardInner class. */ @@ -35,6 +52,36 @@ private RegulatoryComplianceStandardProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the state property: Aggregative state based on the standard's supported controls states. * @@ -108,4 +155,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegulatoryComplianceStandardInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegulatoryComplianceStandardInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RegulatoryComplianceStandardInner. + */ + public static RegulatoryComplianceStandardInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegulatoryComplianceStandardInner deserializedRegulatoryComplianceStandardInner + = new RegulatoryComplianceStandardInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRegulatoryComplianceStandardInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRegulatoryComplianceStandardInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRegulatoryComplianceStandardInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRegulatoryComplianceStandardInner.innerProperties + = RegulatoryComplianceStandardProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRegulatoryComplianceStandardInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardProperties.java index c9edfe2c1e62..ec8c16ee114d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RegulatoryComplianceStandardProperties.java @@ -5,42 +5,42 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.State; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Regulatory compliance standard data. */ @Fluent -public final class RegulatoryComplianceStandardProperties { +public final class RegulatoryComplianceStandardProperties + implements JsonSerializable { /* * Aggregative state based on the standard's supported controls states */ - @JsonProperty(value = "state") private State state; /* * The number of supported regulatory compliance controls of the given standard with a passed state */ - @JsonProperty(value = "passedControls", access = JsonProperty.Access.WRITE_ONLY) private Integer passedControls; /* * The number of supported regulatory compliance controls of the given standard with a failed state */ - @JsonProperty(value = "failedControls", access = JsonProperty.Access.WRITE_ONLY) private Integer failedControls; /* * The number of supported regulatory compliance controls of the given standard with a skipped state */ - @JsonProperty(value = "skippedControls", access = JsonProperty.Access.WRITE_ONLY) private Integer skippedControls; /* * The number of regulatory compliance controls of the given standard which are unsupported by automated assessments */ - @JsonProperty(value = "unsupportedControls", access = JsonProperty.Access.WRITE_ONLY) private Integer unsupportedControls; /** @@ -116,4 +116,53 @@ public Integer unsupportedControls() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RegulatoryComplianceStandardProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RegulatoryComplianceStandardProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RegulatoryComplianceStandardProperties. + */ + public static RegulatoryComplianceStandardProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RegulatoryComplianceStandardProperties deserializedRegulatoryComplianceStandardProperties + = new RegulatoryComplianceStandardProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedRegulatoryComplianceStandardProperties.state = State.fromString(reader.getString()); + } else if ("passedControls".equals(fieldName)) { + deserializedRegulatoryComplianceStandardProperties.passedControls + = reader.getNullable(JsonReader::getInt); + } else if ("failedControls".equals(fieldName)) { + deserializedRegulatoryComplianceStandardProperties.failedControls + = reader.getNullable(JsonReader::getInt); + } else if ("skippedControls".equals(fieldName)) { + deserializedRegulatoryComplianceStandardProperties.skippedControls + = reader.getNullable(JsonReader::getInt); + } else if ("unsupportedControls".equals(fieldName)) { + deserializedRegulatoryComplianceStandardProperties.unsupportedControls + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedRegulatoryComplianceStandardProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RuleResultsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RuleResultsInner.java index 7ccd3cff0ea8..78fa700f2ab2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RuleResultsInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RuleResultsInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.RuleResultsProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Rule results. @@ -17,9 +20,23 @@ public final class RuleResultsInner extends ProxyResource { /* * Rule results properties. */ - @JsonProperty(value = "properties") private RuleResultsProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of RuleResultsInner class. */ @@ -46,6 +63,36 @@ public RuleResultsInner withProperties(RuleResultsProperties properties) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -56,4 +103,47 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RuleResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RuleResultsInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RuleResultsInner. + */ + public static RuleResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RuleResultsInner deserializedRuleResultsInner = new RuleResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRuleResultsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRuleResultsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRuleResultsInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRuleResultsInner.properties = RuleResultsProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRuleResultsInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java index ea3f8d28ad6b..648fbdef0bf0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/RulesResultsInner.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * A list of rules results. */ @Fluent -public final class RulesResultsInner { +public final class RulesResultsInner implements JsonSerializable { /* * List of rule results. */ - @JsonProperty(value = "value") private List value; /** @@ -55,4 +58,41 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RulesResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RulesResultsInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RulesResultsInner. + */ + public static RulesResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RulesResultsInner deserializedRulesResultsInner = new RulesResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> RuleResultsInner.fromJson(reader1)); + deserializedRulesResultsInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRulesResultsInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java index 72374ef25f0f..230b3172f5a9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ScanProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * A vulnerability assessment scan record. @@ -17,9 +20,23 @@ public final class ScanInner extends ProxyResource { /* * A vulnerability assessment scan record properties. */ - @JsonProperty(value = "properties") private ScanProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ScanInner class. */ @@ -46,6 +63,36 @@ public ScanInner withProperties(ScanProperties properties) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -56,4 +103,47 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScanInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScanInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ScanInner. + */ + public static ScanInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScanInner deserializedScanInner = new ScanInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedScanInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedScanInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedScanInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedScanInner.properties = ScanProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScanInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java index b43faa716bd6..321a1461e182 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ScanResultProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * A vulnerability assessment scan result for a single rule. @@ -17,9 +20,23 @@ public final class ScanResultInner extends ProxyResource { /* * A vulnerability assessment scan result properties for a single rule. */ - @JsonProperty(value = "properties") private ScanResultProperties properties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ScanResultInner class. */ @@ -46,6 +63,36 @@ public ScanResultInner withProperties(ScanResultProperties properties) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -56,4 +103,47 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScanResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScanResultInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ScanResultInner. + */ + public static ScanResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScanResultInner deserializedScanResultInner = new ScanResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedScanResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedScanResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedScanResultInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedScanResultInner.properties = ScanResultProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScanResultInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java index 90d05e1ce0c1..708e4f7ce8b8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScanResultsInner.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * A list of vulnerability assessment scan results. */ @Fluent -public final class ScanResultsInner { +public final class ScanResultsInner implements JsonSerializable { /* * List of vulnerability assessment scan results. */ - @JsonProperty(value = "value") private List value; /** @@ -55,4 +58,41 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScanResultsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScanResultsInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ScanResultsInner. + */ + public static ScanResultsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScanResultsInner deserializedScanResultsInner = new ScanResultsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ScanResultInner.fromJson(reader1)); + deserializedScanResultsInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedScanResultsInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java index 250deedf95ac..4d49a998e3a9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScansInner.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * A list of vulnerability assessment scan records. */ @Fluent -public final class ScansInner { +public final class ScansInner implements JsonSerializable { /* * List of vulnerability assessment scan records. */ - @JsonProperty(value = "value") private List value; /** @@ -55,4 +58,41 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScansInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScansInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the ScansInner. + */ + public static ScansInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScansInner deserializedScansInner = new ScansInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ScanInner.fromJson(reader1)); + deserializedScansInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedScansInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScoreDetails.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScoreDetails.java index 3189d73d2403..f652042448a1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScoreDetails.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ScoreDetails.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Calculation result data. */ @Immutable -public final class ScoreDetails { +public final class ScoreDetails implements JsonSerializable { /* * Maximum score available */ - @JsonProperty(value = "max", access = JsonProperty.Access.WRITE_ONLY) private Integer max; /* * Current score */ - @JsonProperty(value = "current", access = JsonProperty.Access.WRITE_ONLY) private Double current; /* * Ratio of the current score divided by the maximum. Rounded to 4 digits after the decimal point */ - @JsonProperty(value = "percentage", access = JsonProperty.Access.WRITE_ONLY) private Double percentage; /** @@ -71,4 +72,43 @@ public Double percentage() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScoreDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScoreDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ScoreDetails. + */ + public static ScoreDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScoreDetails deserializedScoreDetails = new ScoreDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("max".equals(fieldName)) { + deserializedScoreDetails.max = reader.getNullable(JsonReader::getInt); + } else if ("current".equals(fieldName)) { + deserializedScoreDetails.current = reader.getNullable(JsonReader::getDouble); + } else if ("percentage".equals(fieldName)) { + deserializedScoreDetails.percentage = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedScoreDetails; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemInner.java index f667855532f8..3689eaa93965 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemInner.java @@ -6,9 +6,12 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AzureResourceLink; import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionSource; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -19,9 +22,23 @@ public final class SecureScoreControlDefinitionItemInner extends ProxyResource { /* * Security Control Definition Properties. */ - @JsonProperty(value = "properties") private SecureScoreControlDefinitionItemProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecureScoreControlDefinitionItemInner class. */ @@ -37,6 +54,36 @@ private SecureScoreControlDefinitionItemProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the displayName property: User friendly display name of the control. * @@ -93,4 +140,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecureScoreControlDefinitionItemInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecureScoreControlDefinitionItemInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecureScoreControlDefinitionItemInner. + */ + public static SecureScoreControlDefinitionItemInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecureScoreControlDefinitionItemInner deserializedSecureScoreControlDefinitionItemInner + = new SecureScoreControlDefinitionItemInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecureScoreControlDefinitionItemInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecureScoreControlDefinitionItemInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecureScoreControlDefinitionItemInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecureScoreControlDefinitionItemInner.innerProperties + = SecureScoreControlDefinitionItemProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecureScoreControlDefinitionItemInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemProperties.java index 86186c34049b..175d6f0f4ff5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDefinitionItemProperties.java @@ -5,44 +5,44 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AzureResourceLink; import com.azure.resourcemanager.security.models.SecureScoreControlDefinitionSource; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Security Control Definition Properties. */ @Immutable -public final class SecureScoreControlDefinitionItemProperties { +public final class SecureScoreControlDefinitionItemProperties + implements JsonSerializable { /* * User friendly display name of the control */ - @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) private String displayName; /* * User friendly description of the control */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * Maximum control score (0..10) */ - @JsonProperty(value = "maxScore", access = JsonProperty.Access.WRITE_ONLY) private Integer maxScore; /* * Source object from which the control was created */ - @JsonProperty(value = "source", access = JsonProperty.Access.WRITE_ONLY) private SecureScoreControlDefinitionSource source; /* * Array of assessments metadata IDs that are included in this security control */ - @JsonProperty(value = "assessmentDefinitions", access = JsonProperty.Access.WRITE_ONLY) private List assessmentDefinitions; /** @@ -110,4 +110,53 @@ public void validate() { assessmentDefinitions().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecureScoreControlDefinitionItemProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecureScoreControlDefinitionItemProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SecureScoreControlDefinitionItemProperties. + */ + public static SecureScoreControlDefinitionItemProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecureScoreControlDefinitionItemProperties deserializedSecureScoreControlDefinitionItemProperties + = new SecureScoreControlDefinitionItemProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedSecureScoreControlDefinitionItemProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSecureScoreControlDefinitionItemProperties.description = reader.getString(); + } else if ("maxScore".equals(fieldName)) { + deserializedSecureScoreControlDefinitionItemProperties.maxScore + = reader.getNullable(JsonReader::getInt); + } else if ("source".equals(fieldName)) { + deserializedSecureScoreControlDefinitionItemProperties.source + = SecureScoreControlDefinitionSource.fromJson(reader); + } else if ("assessmentDefinitions".equals(fieldName)) { + List assessmentDefinitions + = reader.readArray(reader1 -> AzureResourceLink.fromJson(reader1)); + deserializedSecureScoreControlDefinitionItemProperties.assessmentDefinitions + = assessmentDefinitions; + } else { + reader.skipChildren(); + } + } + + return deserializedSecureScoreControlDefinitionItemProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDetailsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDetailsInner.java index 14ddcbb0eab4..83f54e87b37f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDetailsInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlDetailsInner.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Details of the security control, its score, and the health status of the relevant resources. @@ -16,9 +19,23 @@ public final class SecureScoreControlDetailsInner extends ProxyResource { /* * Calculation result data in control level */ - @JsonProperty(value = "properties") private SecureScoreControlScoreDetailsInner innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecureScoreControlDetailsInner class. */ @@ -34,6 +51,36 @@ private SecureScoreControlScoreDetailsInner innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the displayName property: User friendly display name of the control. * @@ -141,4 +188,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecureScoreControlDetailsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecureScoreControlDetailsInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecureScoreControlDetailsInner. + */ + public static SecureScoreControlDetailsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecureScoreControlDetailsInner deserializedSecureScoreControlDetailsInner + = new SecureScoreControlDetailsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecureScoreControlDetailsInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecureScoreControlDetailsInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecureScoreControlDetailsInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecureScoreControlDetailsInner.innerProperties + = SecureScoreControlScoreDetailsInner.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecureScoreControlDetailsInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlScoreDetailsInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlScoreDetailsInner.java index 4a31dc8eeda7..3c934221bfb1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlScoreDetailsInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreControlScoreDetailsInner.java @@ -5,53 +5,52 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Calculation result data in control level. */ @Fluent -public final class SecureScoreControlScoreDetailsInner { +public final class SecureScoreControlScoreDetailsInner + implements JsonSerializable { /* * User friendly display name of the control */ - @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) private String displayName; /* * Actual score object for the control */ - @JsonProperty(value = "score", access = JsonProperty.Access.WRITE_ONLY) private ScoreDetails innerScore; /* * Number of healthy resources in the control */ - @JsonProperty(value = "healthyResourceCount", access = JsonProperty.Access.WRITE_ONLY) private Integer healthyResourceCount; /* * Number of unhealthy resources in the control */ - @JsonProperty(value = "unhealthyResourceCount", access = JsonProperty.Access.WRITE_ONLY) private Integer unhealthyResourceCount; /* * Number of not applicable resources in the control */ - @JsonProperty(value = "notApplicableResourceCount", access = JsonProperty.Access.WRITE_ONLY) private Integer notApplicableResourceCount; /* - * The relative weight for this specific control in each of your subscriptions. Used when calculating an aggregated score for this control across all of your subscriptions. + * The relative weight for this specific control in each of your subscriptions. Used when calculating an aggregated + * score for this control across all of your subscriptions. */ - @JsonProperty(value = "weight", access = JsonProperty.Access.WRITE_ONLY) private Long weight; /* * Information about the security control. */ - @JsonProperty(value = "definition") private SecureScoreControlDefinitionItemInner definition; /** @@ -176,4 +175,57 @@ public void validate() { definition().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("definition", this.definition); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecureScoreControlScoreDetailsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecureScoreControlScoreDetailsInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SecureScoreControlScoreDetailsInner. + */ + public static SecureScoreControlScoreDetailsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecureScoreControlScoreDetailsInner deserializedSecureScoreControlScoreDetailsInner + = new SecureScoreControlScoreDetailsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedSecureScoreControlScoreDetailsInner.displayName = reader.getString(); + } else if ("score".equals(fieldName)) { + deserializedSecureScoreControlScoreDetailsInner.innerScore = ScoreDetails.fromJson(reader); + } else if ("healthyResourceCount".equals(fieldName)) { + deserializedSecureScoreControlScoreDetailsInner.healthyResourceCount + = reader.getNullable(JsonReader::getInt); + } else if ("unhealthyResourceCount".equals(fieldName)) { + deserializedSecureScoreControlScoreDetailsInner.unhealthyResourceCount + = reader.getNullable(JsonReader::getInt); + } else if ("notApplicableResourceCount".equals(fieldName)) { + deserializedSecureScoreControlScoreDetailsInner.notApplicableResourceCount + = reader.getNullable(JsonReader::getInt); + } else if ("weight".equals(fieldName)) { + deserializedSecureScoreControlScoreDetailsInner.weight = reader.getNullable(JsonReader::getLong); + } else if ("definition".equals(fieldName)) { + deserializedSecureScoreControlScoreDetailsInner.definition + = SecureScoreControlDefinitionItemInner.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecureScoreControlScoreDetailsInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemInner.java index 92e59606bbe8..3ac1d2a6a8f8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemInner.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Secure score item data model. @@ -16,9 +19,23 @@ public final class SecureScoreItemInner extends ProxyResource { /* * Secure score item */ - @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private SecureScoreItemProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecureScoreItemInner class. */ @@ -34,6 +51,36 @@ private SecureScoreItemProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the displayName property: The initiative’s name. * @@ -91,4 +138,46 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecureScoreItemInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecureScoreItemInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecureScoreItemInner. + */ + public static SecureScoreItemInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecureScoreItemInner deserializedSecureScoreItemInner = new SecureScoreItemInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecureScoreItemInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecureScoreItemInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecureScoreItemInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecureScoreItemInner.innerProperties = SecureScoreItemProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecureScoreItemInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemProperties.java index 692867ae5947..2ca1dbc7de3b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecureScoreItemProperties.java @@ -5,29 +5,31 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Describes properties of a calculated secure score. */ @Immutable -public final class SecureScoreItemProperties { +public final class SecureScoreItemProperties implements JsonSerializable { /* * The initiative’s name */ - @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) private String displayName; /* * score object */ - @JsonProperty(value = "score", access = JsonProperty.Access.WRITE_ONLY) private ScoreDetails innerScore; /* - * The relative weight for each subscription. Used when calculating an aggregated secure score for multiple subscriptions. + * The relative weight for each subscription. Used when calculating an aggregated secure score for multiple + * subscriptions. */ - @JsonProperty(value = "weight", access = JsonProperty.Access.WRITE_ONLY) private Long weight; /** @@ -102,4 +104,43 @@ public void validate() { innerScore().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecureScoreItemProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecureScoreItemProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SecureScoreItemProperties. + */ + public static SecureScoreItemProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecureScoreItemProperties deserializedSecureScoreItemProperties = new SecureScoreItemProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedSecureScoreItemProperties.displayName = reader.getString(); + } else if ("score".equals(fieldName)) { + deserializedSecureScoreItemProperties.innerScore = ScoreDetails.fromJson(reader); + } else if ("weight".equals(fieldName)) { + deserializedSecureScoreItemProperties.weight = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedSecureScoreItemProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataProperties.java index 9f2ccbf6076c..352807140289 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataProperties.java @@ -6,6 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AssessmentType; import com.azure.resourcemanager.security.models.Categories; import com.azure.resourcemanager.security.models.ImplementationEffort; @@ -13,84 +17,73 @@ import com.azure.resourcemanager.security.models.Severity; import com.azure.resourcemanager.security.models.Threats; import com.azure.resourcemanager.security.models.UserImpact; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Describes properties of an assessment metadata. */ @Fluent -public class SecurityAssessmentMetadataProperties { +public class SecurityAssessmentMetadataProperties implements JsonSerializable { /* * User friendly display name of the assessment */ - @JsonProperty(value = "displayName", required = true) private String displayName; /* * Azure resource ID of the policy definition that turns this assessment calculation on */ - @JsonProperty(value = "policyDefinitionId", access = JsonProperty.Access.WRITE_ONLY) private String policyDefinitionId; /* * Human readable description of the assessment */ - @JsonProperty(value = "description") private String description; /* * Human readable description of what you should do to mitigate this security issue */ - @JsonProperty(value = "remediationDescription") private String remediationDescription; /* * The categories property. */ - @JsonProperty(value = "categories") private List categories; /* * The severity level of the assessment */ - @JsonProperty(value = "severity", required = true) private Severity severity; /* * The user impact of the assessment */ - @JsonProperty(value = "userImpact") private UserImpact userImpact; /* * The implementation effort required to remediate this assessment */ - @JsonProperty(value = "implementationEffort") private ImplementationEffort implementationEffort; /* * The threats property. */ - @JsonProperty(value = "threats") private List threats; /* * True if this assessment is in preview release status */ - @JsonProperty(value = "preview") private Boolean preview; /* - * BuiltIn if the assessment based on built-in Azure Policy definition, Custom if the assessment based on custom Azure Policy definition + * BuiltIn if the assessment based on built-in Azure Policy definition, Custom if the assessment based on custom + * Azure Policy definition */ - @JsonProperty(value = "assessmentType", required = true) private AssessmentType assessmentType; /* * Describes the partner that created the assessment */ - @JsonProperty(value = "partnerData") private SecurityAssessmentMetadataPartnerData partnerData; /** @@ -129,6 +122,18 @@ public String policyDefinitionId() { return this.policyDefinitionId; } + /** + * Set the policyDefinitionId property: Azure resource ID of the policy definition that turns this assessment + * calculation on. + * + * @param policyDefinitionId the policyDefinitionId value to set. + * @return the SecurityAssessmentMetadataProperties object itself. + */ + SecurityAssessmentMetadataProperties withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + /** * Get the description property: Human readable description of the assessment. * @@ -360,4 +365,86 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(SecurityAssessmentMetadataProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("severity", this.severity == null ? null : this.severity.toString()); + jsonWriter.writeStringField("assessmentType", + this.assessmentType == null ? null : this.assessmentType.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("remediationDescription", this.remediationDescription); + jsonWriter.writeArrayField("categories", this.categories, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("userImpact", this.userImpact == null ? null : this.userImpact.toString()); + jsonWriter.writeStringField("implementationEffort", + this.implementationEffort == null ? null : this.implementationEffort.toString()); + jsonWriter.writeArrayField("threats", this.threats, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeBooleanField("preview", this.preview); + jsonWriter.writeJsonField("partnerData", this.partnerData); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityAssessmentMetadataProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityAssessmentMetadataProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityAssessmentMetadataProperties. + */ + public static SecurityAssessmentMetadataProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityAssessmentMetadataProperties deserializedSecurityAssessmentMetadataProperties + = new SecurityAssessmentMetadataProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.displayName = reader.getString(); + } else if ("severity".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.severity = Severity.fromString(reader.getString()); + } else if ("assessmentType".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.assessmentType + = AssessmentType.fromString(reader.getString()); + } else if ("policyDefinitionId".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.policyDefinitionId = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.description = reader.getString(); + } else if ("remediationDescription".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.remediationDescription = reader.getString(); + } else if ("categories".equals(fieldName)) { + List categories + = reader.readArray(reader1 -> Categories.fromString(reader1.getString())); + deserializedSecurityAssessmentMetadataProperties.categories = categories; + } else if ("userImpact".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.userImpact + = UserImpact.fromString(reader.getString()); + } else if ("implementationEffort".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.implementationEffort + = ImplementationEffort.fromString(reader.getString()); + } else if ("threats".equals(fieldName)) { + List threats = reader.readArray(reader1 -> Threats.fromString(reader1.getString())); + deserializedSecurityAssessmentMetadataProperties.threats = threats; + } else if ("preview".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.preview + = reader.getNullable(JsonReader::getBoolean); + } else if ("partnerData".equals(fieldName)) { + deserializedSecurityAssessmentMetadataProperties.partnerData + = SecurityAssessmentMetadataPartnerData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityAssessmentMetadataProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataPropertiesResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataPropertiesResponse.java index 3d30e4db6209..a1d27885dc55 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataPropertiesResponse.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataPropertiesResponse.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AssessmentType; import com.azure.resourcemanager.security.models.Categories; import com.azure.resourcemanager.security.models.ImplementationEffort; @@ -15,7 +19,7 @@ import com.azure.resourcemanager.security.models.Techniques; import com.azure.resourcemanager.security.models.Threats; import com.azure.resourcemanager.security.models.UserImpact; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -26,27 +30,28 @@ public final class SecurityAssessmentMetadataPropertiesResponse extends Security /* * The publishDates property. */ - @JsonProperty(value = "publishDates") private SecurityAssessmentMetadataPropertiesResponsePublishDates publishDates; /* * The plannedDeprecationDate property. */ - @JsonProperty(value = "plannedDeprecationDate") private String plannedDeprecationDate; /* * The tactics property. */ - @JsonProperty(value = "tactics") private List tactics; /* * The techniques property. */ - @JsonProperty(value = "techniques") private List techniques; + /* + * Azure resource ID of the policy definition that turns this assessment calculation on + */ + private String policyDefinitionId; + /** * Creates an instance of SecurityAssessmentMetadataPropertiesResponse class. */ @@ -134,6 +139,17 @@ public SecurityAssessmentMetadataPropertiesResponse withTechniques(List writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("userImpact", userImpact() == null ? null : userImpact().toString()); + jsonWriter.writeStringField("implementationEffort", + implementationEffort() == null ? null : implementationEffort().toString()); + jsonWriter.writeArrayField("threats", threats(), + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeBooleanField("preview", preview()); + jsonWriter.writeJsonField("partnerData", partnerData()); + jsonWriter.writeJsonField("publishDates", this.publishDates); + jsonWriter.writeStringField("plannedDeprecationDate", this.plannedDeprecationDate); + jsonWriter.writeArrayField("tactics", this.tactics, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeArrayField("techniques", this.techniques, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityAssessmentMetadataPropertiesResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityAssessmentMetadataPropertiesResponse if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityAssessmentMetadataPropertiesResponse. + */ + public static SecurityAssessmentMetadataPropertiesResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityAssessmentMetadataPropertiesResponse deserializedSecurityAssessmentMetadataPropertiesResponse + = new SecurityAssessmentMetadataPropertiesResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse.withDisplayName(reader.getString()); + } else if ("severity".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse + .withSeverity(Severity.fromString(reader.getString())); + } else if ("assessmentType".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse + .withAssessmentType(AssessmentType.fromString(reader.getString())); + } else if ("policyDefinitionId".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse.policyDefinitionId = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse.withDescription(reader.getString()); + } else if ("remediationDescription".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse + .withRemediationDescription(reader.getString()); + } else if ("categories".equals(fieldName)) { + List categories + = reader.readArray(reader1 -> Categories.fromString(reader1.getString())); + deserializedSecurityAssessmentMetadataPropertiesResponse.withCategories(categories); + } else if ("userImpact".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse + .withUserImpact(UserImpact.fromString(reader.getString())); + } else if ("implementationEffort".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse + .withImplementationEffort(ImplementationEffort.fromString(reader.getString())); + } else if ("threats".equals(fieldName)) { + List threats = reader.readArray(reader1 -> Threats.fromString(reader1.getString())); + deserializedSecurityAssessmentMetadataPropertiesResponse.withThreats(threats); + } else if ("preview".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse + .withPreview(reader.getNullable(JsonReader::getBoolean)); + } else if ("partnerData".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse + .withPartnerData(SecurityAssessmentMetadataPartnerData.fromJson(reader)); + } else if ("publishDates".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse.publishDates + = SecurityAssessmentMetadataPropertiesResponsePublishDates.fromJson(reader); + } else if ("plannedDeprecationDate".equals(fieldName)) { + deserializedSecurityAssessmentMetadataPropertiesResponse.plannedDeprecationDate + = reader.getString(); + } else if ("tactics".equals(fieldName)) { + List tactics = reader.readArray(reader1 -> Tactics.fromString(reader1.getString())); + deserializedSecurityAssessmentMetadataPropertiesResponse.tactics = tactics; + } else if ("techniques".equals(fieldName)) { + List techniques + = reader.readArray(reader1 -> Techniques.fromString(reader1.getString())); + deserializedSecurityAssessmentMetadataPropertiesResponse.techniques = techniques; + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityAssessmentMetadataPropertiesResponse; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataResponseInner.java index eb0cb48a1e91..37ee2335bf03 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataResponseInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentMetadataResponseInner.java @@ -6,6 +6,9 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AssessmentType; import com.azure.resourcemanager.security.models.Categories; import com.azure.resourcemanager.security.models.ImplementationEffort; @@ -16,7 +19,7 @@ import com.azure.resourcemanager.security.models.Techniques; import com.azure.resourcemanager.security.models.Threats; import com.azure.resourcemanager.security.models.UserImpact; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -27,9 +30,23 @@ public final class SecurityAssessmentMetadataResponseInner extends ProxyResource /* * Describes properties of an assessment metadata response. */ - @JsonProperty(value = "properties") private SecurityAssessmentMetadataPropertiesResponse innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecurityAssessmentMetadataResponseInner class. */ @@ -45,6 +62,36 @@ private SecurityAssessmentMetadataPropertiesResponse innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the publishDates property: The publishDates property. * @@ -415,4 +462,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityAssessmentMetadataResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityAssessmentMetadataResponseInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityAssessmentMetadataResponseInner. + */ + public static SecurityAssessmentMetadataResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityAssessmentMetadataResponseInner deserializedSecurityAssessmentMetadataResponseInner + = new SecurityAssessmentMetadataResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityAssessmentMetadataResponseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecurityAssessmentMetadataResponseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecurityAssessmentMetadataResponseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecurityAssessmentMetadataResponseInner.innerProperties + = SecurityAssessmentMetadataPropertiesResponse.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityAssessmentMetadataResponseInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentProperties.java index 1481cfcb9690..fc5f1ecdc3c9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentProperties.java @@ -6,11 +6,15 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AssessmentLinks; import com.azure.resourcemanager.security.models.AssessmentStatus; import com.azure.resourcemanager.security.models.ResourceDetails; import com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData; import com.azure.resourcemanager.security.models.SecurityAssessmentPropertiesBase; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -21,9 +25,18 @@ public final class SecurityAssessmentProperties extends SecurityAssessmentProper /* * The result of the assessment */ - @JsonProperty(value = "status", required = true) private AssessmentStatus status; + /* + * Links relevant to the assessment + */ + private AssessmentLinks links; + + /* + * User friendly display name of the assessment + */ + private String displayName; + /** * Creates an instance of SecurityAssessmentProperties class. */ @@ -50,6 +63,26 @@ public SecurityAssessmentProperties withStatus(AssessmentStatus status) { return this; } + /** + * Get the links property: Links relevant to the assessment. + * + * @return the links value. + */ + @Override + public AssessmentLinks links() { + return this.links; + } + + /** + * Get the displayName property: User friendly display name of the assessment. + * + * @return the displayName value. + */ + @Override + public String displayName() { + return this.displayName; + } + /** * {@inheritDoc} */ @@ -93,7 +126,6 @@ public SecurityAssessmentProperties withPartnersData(SecurityAssessmentPartnerDa */ @Override public void validate() { - super.validate(); if (status() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -101,7 +133,79 @@ public void validate() { } else { status().validate(); } + if (resourceDetails() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceDetails in model SecurityAssessmentProperties")); + } else { + resourceDetails().validate(); + } + if (links() != null) { + links().validate(); + } + if (metadata() != null) { + metadata().validate(); + } + if (partnersData() != null) { + partnersData().validate(); + } } private static final ClientLogger LOGGER = new ClientLogger(SecurityAssessmentProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resourceDetails", resourceDetails()); + jsonWriter.writeMapField("additionalData", additionalData(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("metadata", metadata()); + jsonWriter.writeJsonField("partnersData", partnersData()); + jsonWriter.writeJsonField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityAssessmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityAssessmentProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityAssessmentProperties. + */ + public static SecurityAssessmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityAssessmentProperties deserializedSecurityAssessmentProperties = new SecurityAssessmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceDetails".equals(fieldName)) { + deserializedSecurityAssessmentProperties.withResourceDetails(ResourceDetails.fromJson(reader)); + } else if ("displayName".equals(fieldName)) { + deserializedSecurityAssessmentProperties.displayName = reader.getString(); + } else if ("additionalData".equals(fieldName)) { + Map additionalData = reader.readMap(reader1 -> reader1.getString()); + deserializedSecurityAssessmentProperties.withAdditionalData(additionalData); + } else if ("links".equals(fieldName)) { + deserializedSecurityAssessmentProperties.links = AssessmentLinks.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + deserializedSecurityAssessmentProperties + .withMetadata(SecurityAssessmentMetadataProperties.fromJson(reader)); + } else if ("partnersData".equals(fieldName)) { + deserializedSecurityAssessmentProperties + .withPartnersData(SecurityAssessmentPartnerData.fromJson(reader)); + } else if ("status".equals(fieldName)) { + deserializedSecurityAssessmentProperties.status = AssessmentStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityAssessmentProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentPropertiesResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentPropertiesResponse.java index 3647f0f904d8..9aac9f03b59c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentPropertiesResponse.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentPropertiesResponse.java @@ -6,11 +6,15 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AssessmentLinks; import com.azure.resourcemanager.security.models.AssessmentStatusResponse; import com.azure.resourcemanager.security.models.ResourceDetails; import com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData; import com.azure.resourcemanager.security.models.SecurityAssessmentPropertiesBase; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -21,9 +25,18 @@ public final class SecurityAssessmentPropertiesResponse extends SecurityAssessme /* * The result of the assessment */ - @JsonProperty(value = "status", required = true) private AssessmentStatusResponse status; + /* + * Links relevant to the assessment + */ + private AssessmentLinks links; + + /* + * User friendly display name of the assessment + */ + private String displayName; + /** * Creates an instance of SecurityAssessmentPropertiesResponse class. */ @@ -50,6 +63,26 @@ public SecurityAssessmentPropertiesResponse withStatus(AssessmentStatusResponse return this; } + /** + * Get the links property: Links relevant to the assessment. + * + * @return the links value. + */ + @Override + public AssessmentLinks links() { + return this.links; + } + + /** + * Get the displayName property: User friendly display name of the assessment. + * + * @return the displayName value. + */ + @Override + public String displayName() { + return this.displayName; + } + /** * {@inheritDoc} */ @@ -93,7 +126,6 @@ public SecurityAssessmentPropertiesResponse withPartnersData(SecurityAssessmentP */ @Override public void validate() { - super.validate(); if (status() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -101,7 +133,81 @@ public void validate() { } else { status().validate(); } + if (resourceDetails() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceDetails in model SecurityAssessmentPropertiesResponse")); + } else { + resourceDetails().validate(); + } + if (links() != null) { + links().validate(); + } + if (metadata() != null) { + metadata().validate(); + } + if (partnersData() != null) { + partnersData().validate(); + } } private static final ClientLogger LOGGER = new ClientLogger(SecurityAssessmentPropertiesResponse.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("resourceDetails", resourceDetails()); + jsonWriter.writeMapField("additionalData", additionalData(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("metadata", metadata()); + jsonWriter.writeJsonField("partnersData", partnersData()); + jsonWriter.writeJsonField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityAssessmentPropertiesResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityAssessmentPropertiesResponse if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityAssessmentPropertiesResponse. + */ + public static SecurityAssessmentPropertiesResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityAssessmentPropertiesResponse deserializedSecurityAssessmentPropertiesResponse + = new SecurityAssessmentPropertiesResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceDetails".equals(fieldName)) { + deserializedSecurityAssessmentPropertiesResponse + .withResourceDetails(ResourceDetails.fromJson(reader)); + } else if ("displayName".equals(fieldName)) { + deserializedSecurityAssessmentPropertiesResponse.displayName = reader.getString(); + } else if ("additionalData".equals(fieldName)) { + Map additionalData = reader.readMap(reader1 -> reader1.getString()); + deserializedSecurityAssessmentPropertiesResponse.withAdditionalData(additionalData); + } else if ("links".equals(fieldName)) { + deserializedSecurityAssessmentPropertiesResponse.links = AssessmentLinks.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + deserializedSecurityAssessmentPropertiesResponse + .withMetadata(SecurityAssessmentMetadataProperties.fromJson(reader)); + } else if ("partnersData".equals(fieldName)) { + deserializedSecurityAssessmentPropertiesResponse + .withPartnersData(SecurityAssessmentPartnerData.fromJson(reader)); + } else if ("status".equals(fieldName)) { + deserializedSecurityAssessmentPropertiesResponse.status = AssessmentStatusResponse.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityAssessmentPropertiesResponse; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentResponseInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentResponseInner.java index 4400e64eb587..14ba020c6b43 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentResponseInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityAssessmentResponseInner.java @@ -6,11 +6,14 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AssessmentLinks; import com.azure.resourcemanager.security.models.AssessmentStatusResponse; import com.azure.resourcemanager.security.models.ResourceDetails; import com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; /** @@ -21,9 +24,23 @@ public final class SecurityAssessmentResponseInner extends ProxyResource { /* * Describes properties of an assessment. */ - @JsonProperty(value = "properties") private SecurityAssessmentPropertiesResponse innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecurityAssessmentResponseInner class. */ @@ -39,6 +56,36 @@ private SecurityAssessmentPropertiesResponse innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the status property: The result of the assessment. * @@ -182,4 +229,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityAssessmentResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityAssessmentResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityAssessmentResponseInner. + */ + public static SecurityAssessmentResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityAssessmentResponseInner deserializedSecurityAssessmentResponseInner + = new SecurityAssessmentResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityAssessmentResponseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecurityAssessmentResponseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecurityAssessmentResponseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecurityAssessmentResponseInner.innerProperties + = SecurityAssessmentPropertiesResponse.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityAssessmentResponseInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorInner.java index 3c61bfdcb308..1478b56eeb65 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorInner.java @@ -7,10 +7,13 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.CloudName; import com.azure.resourcemanager.security.models.CloudOffering; import com.azure.resourcemanager.security.models.EnvironmentData; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; import java.util.Map; @@ -23,15 +26,28 @@ public final class SecurityConnectorInner extends Resource { /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * Security connector data */ - @JsonProperty(value = "properties") private SecurityConnectorProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecurityConnectorInner class. */ @@ -56,6 +72,36 @@ private SecurityConnectorProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * {@inheritDoc} */ @@ -188,4 +234,56 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityConnectorInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityConnectorInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityConnectorInner. + */ + public static SecurityConnectorInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityConnectorInner deserializedSecurityConnectorInner = new SecurityConnectorInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityConnectorInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecurityConnectorInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecurityConnectorInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSecurityConnectorInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSecurityConnectorInner.withTags(tags); + } else if ("systemData".equals(fieldName)) { + deserializedSecurityConnectorInner.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedSecurityConnectorInner.innerProperties = SecurityConnectorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityConnectorInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorProperties.java index 7c9687b0934a..2b7129557a4a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityConnectorProperties.java @@ -5,10 +5,15 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.CloudName; import com.azure.resourcemanager.security.models.CloudOffering; import com.azure.resourcemanager.security.models.EnvironmentData; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -16,35 +21,32 @@ * A set of properties that defines the security connector configuration. */ @Fluent -public final class SecurityConnectorProperties { +public final class SecurityConnectorProperties implements JsonSerializable { /* - * The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). + * The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP + * connector). */ - @JsonProperty(value = "hierarchyIdentifier") private String hierarchyIdentifier; /* - * The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to payed offerings. + * The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading to + * payed offerings. */ - @JsonProperty(value = "hierarchyIdentifierTrialEndDate", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime hierarchyIdentifierTrialEndDate; /* * The multi cloud resource's cloud name. */ - @JsonProperty(value = "environmentName") private CloudName environmentName; /* * A collection of offerings for the security connector. */ - @JsonProperty(value = "offerings") private List offerings; /* * The security connector environment data. */ - @JsonProperty(value = "environmentData") private EnvironmentData environmentData; /** @@ -158,4 +160,54 @@ public void validate() { environmentData().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("hierarchyIdentifier", this.hierarchyIdentifier); + jsonWriter.writeStringField("environmentName", + this.environmentName == null ? null : this.environmentName.toString()); + jsonWriter.writeArrayField("offerings", this.offerings, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("environmentData", this.environmentData); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityConnectorProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SecurityConnectorProperties. + */ + public static SecurityConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityConnectorProperties deserializedSecurityConnectorProperties = new SecurityConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("hierarchyIdentifier".equals(fieldName)) { + deserializedSecurityConnectorProperties.hierarchyIdentifier = reader.getString(); + } else if ("hierarchyIdentifierTrialEndDate".equals(fieldName)) { + deserializedSecurityConnectorProperties.hierarchyIdentifierTrialEndDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("environmentName".equals(fieldName)) { + deserializedSecurityConnectorProperties.environmentName = CloudName.fromString(reader.getString()); + } else if ("offerings".equals(fieldName)) { + List offerings = reader.readArray(reader1 -> CloudOffering.fromJson(reader1)); + deserializedSecurityConnectorProperties.offerings = offerings; + } else if ("environmentData".equals(fieldName)) { + deserializedSecurityConnectorProperties.environmentData = EnvironmentData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityConnectorProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactInner.java index c8e234311656..54c610dd3394 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactInner.java @@ -6,9 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.NotificationsSource; import com.azure.resourcemanager.security.models.SecurityContactPropertiesNotificationsByRole; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** @@ -19,9 +22,23 @@ public final class SecurityContactInner extends ProxyResource { /* * Security contact data */ - @JsonProperty(value = "properties") private SecurityContactProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecurityContactInner class. */ @@ -37,6 +54,36 @@ private SecurityContactProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the emails property: List of email addresses which will get notifications from Microsoft Defender for Cloud * by the configurations defined in this security contact. @@ -167,4 +214,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityContactInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityContactInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityContactInner. + */ + public static SecurityContactInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityContactInner deserializedSecurityContactInner = new SecurityContactInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityContactInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecurityContactInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecurityContactInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecurityContactInner.innerProperties = SecurityContactProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityContactInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactProperties.java index 574e9d503cda..0aad3efbe046 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityContactProperties.java @@ -5,44 +5,45 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.NotificationsSource; import com.azure.resourcemanager.security.models.SecurityContactPropertiesNotificationsByRole; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Describes security contact properties. */ @Fluent -public final class SecurityContactProperties { +public final class SecurityContactProperties implements JsonSerializable { /* - * List of email addresses which will get notifications from Microsoft Defender for Cloud by the configurations defined in this security contact. + * List of email addresses which will get notifications from Microsoft Defender for Cloud by the configurations + * defined in this security contact. */ - @JsonProperty(value = "emails") private String emails; /* * The security contact's phone number */ - @JsonProperty(value = "phone") private String phone; /* * Indicates whether the security contact is enabled. */ - @JsonProperty(value = "isEnabled") private Boolean isEnabled; /* * A collection of sources types which evaluate the email notification. */ - @JsonProperty(value = "notificationsSources") private List notificationsSources; /* - * Defines whether to send email notifications from Microsoft Defender for Cloud to persons with specific RBAC roles on the subscription. + * Defines whether to send email notifications from Microsoft Defender for Cloud to persons with specific RBAC roles + * on the subscription. */ - @JsonProperty(value = "notificationsByRole") private SecurityContactPropertiesNotificationsByRole notificationsByRole; /** @@ -169,4 +170,56 @@ public void validate() { notificationsByRole().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("emails", this.emails); + jsonWriter.writeStringField("phone", this.phone); + jsonWriter.writeBooleanField("isEnabled", this.isEnabled); + jsonWriter.writeArrayField("notificationsSources", this.notificationsSources, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("notificationsByRole", this.notificationsByRole); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityContactProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityContactProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SecurityContactProperties. + */ + public static SecurityContactProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityContactProperties deserializedSecurityContactProperties = new SecurityContactProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("emails".equals(fieldName)) { + deserializedSecurityContactProperties.emails = reader.getString(); + } else if ("phone".equals(fieldName)) { + deserializedSecurityContactProperties.phone = reader.getString(); + } else if ("isEnabled".equals(fieldName)) { + deserializedSecurityContactProperties.isEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("notificationsSources".equals(fieldName)) { + List notificationsSources + = reader.readArray(reader1 -> NotificationsSource.fromJson(reader1)); + deserializedSecurityContactProperties.notificationsSources = notificationsSources; + } else if ("notificationsByRole".equals(fieldName)) { + deserializedSecurityContactProperties.notificationsByRole + = SecurityContactPropertiesNotificationsByRole.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityContactProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorInner.java index f879cf9eb6b7..da7865a572e5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.Identity; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Security operator under a given subscription and pricing. @@ -17,9 +20,23 @@ public final class SecurityOperatorInner extends ProxyResource { /* * Identity for the resource. */ - @JsonProperty(value = "identity") private Identity identity; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecurityOperatorInner class. */ @@ -46,6 +63,36 @@ public SecurityOperatorInner withIdentity(Identity identity) { return this; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -56,4 +103,47 @@ public void validate() { identity().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityOperatorInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityOperatorInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityOperatorInner. + */ + public static SecurityOperatorInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityOperatorInner deserializedSecurityOperatorInner = new SecurityOperatorInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityOperatorInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecurityOperatorInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecurityOperatorInner.type = reader.getString(); + } else if ("identity".equals(fieldName)) { + deserializedSecurityOperatorInner.identity = Identity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityOperatorInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorListInner.java index 9251ea062c2d..139626de7dd7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorListInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityOperatorListInner.java @@ -6,18 +6,21 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * List of SecurityOperator response. */ @Fluent -public final class SecurityOperatorListInner { +public final class SecurityOperatorListInner implements JsonSerializable { /* * List of SecurityOperator configurations */ - @JsonProperty(value = "value", required = true) private List value; /** @@ -62,4 +65,43 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(SecurityOperatorListInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityOperatorListInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityOperatorListInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityOperatorListInner. + */ + public static SecurityOperatorListInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityOperatorListInner deserializedSecurityOperatorListInner = new SecurityOperatorListInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SecurityOperatorInner.fromJson(reader1)); + deserializedSecurityOperatorListInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityOperatorListInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionInner.java index 062b8b0c2c1b..908a926108c7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionInner.java @@ -6,9 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ProvisioningState; import com.azure.resourcemanager.security.models.SecurityFamily; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The SecuritySolution model. @@ -18,15 +21,28 @@ public final class SecuritySolutionInner extends ProxyResource { /* * The properties property. */ - @JsonProperty(value = "properties") private SecuritySolutionProperties innerProperties; /* * Location where the resource is stored */ - @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) private String location; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecuritySolutionInner class. */ @@ -51,6 +67,36 @@ public String location() { return this.location; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the securityFamily property: The security family of the security solution. * @@ -153,4 +199,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecuritySolutionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecuritySolutionInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecuritySolutionInner. + */ + public static SecuritySolutionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecuritySolutionInner deserializedSecuritySolutionInner = new SecuritySolutionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecuritySolutionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecuritySolutionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecuritySolutionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecuritySolutionInner.innerProperties = SecuritySolutionProperties.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedSecuritySolutionInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecuritySolutionInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionProperties.java index 32cfa0fc016c..a699203e8388 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionProperties.java @@ -6,37 +6,37 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ProvisioningState; import com.azure.resourcemanager.security.models.SecurityFamily; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The SecuritySolutionProperties model. */ @Fluent -public final class SecuritySolutionProperties { +public final class SecuritySolutionProperties implements JsonSerializable { /* * The security family of the security solution */ - @JsonProperty(value = "securityFamily", required = true) private SecurityFamily securityFamily; /* * The security family provisioning State */ - @JsonProperty(value = "provisioningState", required = true) private ProvisioningState provisioningState; /* * The security solutions' template */ - @JsonProperty(value = "template", required = true) private String template; /* * The security solutions' status */ - @JsonProperty(value = "protectionStatus", required = true) private String protectionStatus; /** @@ -154,4 +154,54 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(SecuritySolutionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("securityFamily", + this.securityFamily == null ? null : this.securityFamily.toString()); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeStringField("template", this.template); + jsonWriter.writeStringField("protectionStatus", this.protectionStatus); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecuritySolutionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecuritySolutionProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecuritySolutionProperties. + */ + public static SecuritySolutionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecuritySolutionProperties deserializedSecuritySolutionProperties = new SecuritySolutionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("securityFamily".equals(fieldName)) { + deserializedSecuritySolutionProperties.securityFamily + = SecurityFamily.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedSecuritySolutionProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("template".equals(fieldName)) { + deserializedSecuritySolutionProperties.template = reader.getString(); + } else if ("protectionStatus".equals(fieldName)) { + deserializedSecuritySolutionProperties.protectionStatus = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecuritySolutionProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataListInner.java index 812ad1b2dbce..126858aa6a70 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataListInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataListInner.java @@ -5,19 +5,23 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.SecuritySolutionsReferenceData; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The SecuritySolutionsReferenceDataList model. */ @Fluent -public final class SecuritySolutionsReferenceDataListInner { +public final class SecuritySolutionsReferenceDataListInner + implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value") private List value; /** @@ -56,4 +60,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecuritySolutionsReferenceDataListInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecuritySolutionsReferenceDataListInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SecuritySolutionsReferenceDataListInner. + */ + public static SecuritySolutionsReferenceDataListInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecuritySolutionsReferenceDataListInner deserializedSecuritySolutionsReferenceDataListInner + = new SecuritySolutionsReferenceDataListInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SecuritySolutionsReferenceData.fromJson(reader1)); + deserializedSecuritySolutionsReferenceDataListInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedSecuritySolutionsReferenceDataListInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataProperties.java index 9480da5018e9..811148c1246d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySolutionsReferenceDataProperties.java @@ -6,54 +6,52 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.SecurityFamily; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * The SecuritySolutionsReferenceDataProperties model. */ @Fluent -public final class SecuritySolutionsReferenceDataProperties { +public final class SecuritySolutionsReferenceDataProperties + implements JsonSerializable { /* * The security family of the security solution */ - @JsonProperty(value = "securityFamily", required = true) private SecurityFamily securityFamily; /* * The security solutions' vendor name */ - @JsonProperty(value = "alertVendorName", required = true) private String alertVendorName; /* * The security solutions' package info url */ - @JsonProperty(value = "packageInfoUrl", required = true) private String packageInfoUrl; /* * The security solutions' product name */ - @JsonProperty(value = "productName", required = true) private String productName; /* * The security solutions' publisher */ - @JsonProperty(value = "publisher", required = true) private String publisher; /* * The security solutions' publisher display name */ - @JsonProperty(value = "publisherDisplayName", required = true) private String publisherDisplayName; /* * The security solutions' template */ - @JsonProperty(value = "template", required = true) private String template; /** @@ -246,4 +244,62 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(SecuritySolutionsReferenceDataProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("securityFamily", + this.securityFamily == null ? null : this.securityFamily.toString()); + jsonWriter.writeStringField("alertVendorName", this.alertVendorName); + jsonWriter.writeStringField("packageInfoUrl", this.packageInfoUrl); + jsonWriter.writeStringField("productName", this.productName); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("publisherDisplayName", this.publisherDisplayName); + jsonWriter.writeStringField("template", this.template); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecuritySolutionsReferenceDataProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecuritySolutionsReferenceDataProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecuritySolutionsReferenceDataProperties. + */ + public static SecuritySolutionsReferenceDataProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecuritySolutionsReferenceDataProperties deserializedSecuritySolutionsReferenceDataProperties + = new SecuritySolutionsReferenceDataProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("securityFamily".equals(fieldName)) { + deserializedSecuritySolutionsReferenceDataProperties.securityFamily + = SecurityFamily.fromString(reader.getString()); + } else if ("alertVendorName".equals(fieldName)) { + deserializedSecuritySolutionsReferenceDataProperties.alertVendorName = reader.getString(); + } else if ("packageInfoUrl".equals(fieldName)) { + deserializedSecuritySolutionsReferenceDataProperties.packageInfoUrl = reader.getString(); + } else if ("productName".equals(fieldName)) { + deserializedSecuritySolutionsReferenceDataProperties.productName = reader.getString(); + } else if ("publisher".equals(fieldName)) { + deserializedSecuritySolutionsReferenceDataProperties.publisher = reader.getString(); + } else if ("publisherDisplayName".equals(fieldName)) { + deserializedSecuritySolutionsReferenceDataProperties.publisherDisplayName = reader.getString(); + } else if ("template".equals(fieldName)) { + deserializedSecuritySolutionsReferenceDataProperties.template = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecuritySolutionsReferenceDataProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityStandardInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityStandardInner.java new file mode 100644 index 000000000000..ad049f7516fc --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityStandardInner.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.PartialAssessmentProperties; +import com.azure.resourcemanager.security.models.StandardMetadata; +import com.azure.resourcemanager.security.models.StandardSupportedCloud; +import com.azure.resourcemanager.security.models.StandardType; +import java.io.IOException; +import java.util.List; + +/** + * Security Standard on a resource. + */ +@Fluent +public final class SecurityStandardInner extends ProxyResource { + /* + * Properties of a security standard + */ + private StandardProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SecurityStandardInner class. + */ + public SecurityStandardInner() { + } + + /** + * Get the innerProperties property: Properties of a security standard. + * + * @return the innerProperties value. + */ + private StandardProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the displayName property: Display name of the standard, equivalent to the standardId. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: Display name of the standard, equivalent to the standardId. + * + * @param displayName the displayName value to set. + * @return the SecurityStandardInner object itself. + */ + public SecurityStandardInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the standardType property: Standard type (Custom or Default or Compliance only currently). + * + * @return the standardType value. + */ + public StandardType standardType() { + return this.innerProperties() == null ? null : this.innerProperties().standardType(); + } + + /** + * Get the description property: Description of the standard. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the standard. + * + * @param description the description value to set. + * @return the SecurityStandardInner object itself. + */ + public SecurityStandardInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the assessments property: List of assessment keys to apply to standard scope. + * + * @return the assessments value. + */ + public List assessments() { + return this.innerProperties() == null ? null : this.innerProperties().assessments(); + } + + /** + * Set the assessments property: List of assessment keys to apply to standard scope. + * + * @param assessments the assessments value to set. + * @return the SecurityStandardInner object itself. + */ + public SecurityStandardInner withAssessments(List assessments) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withAssessments(assessments); + return this; + } + + /** + * Get the cloudProviders property: List of all standard supported clouds. + * + * @return the cloudProviders value. + */ + public List cloudProviders() { + return this.innerProperties() == null ? null : this.innerProperties().cloudProviders(); + } + + /** + * Set the cloudProviders property: List of all standard supported clouds. + * + * @param cloudProviders the cloudProviders value to set. + * @return the SecurityStandardInner object itself. + */ + public SecurityStandardInner withCloudProviders(List cloudProviders) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withCloudProviders(cloudProviders); + return this; + } + + /** + * Get the policySetDefinitionId property: The policy set definition id associated with the standard. + * + * @return the policySetDefinitionId value. + */ + public String policySetDefinitionId() { + return this.innerProperties() == null ? null : this.innerProperties().policySetDefinitionId(); + } + + /** + * Set the policySetDefinitionId property: The policy set definition id associated with the standard. + * + * @param policySetDefinitionId the policySetDefinitionId value to set. + * @return the SecurityStandardInner object itself. + */ + public SecurityStandardInner withPolicySetDefinitionId(String policySetDefinitionId) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withPolicySetDefinitionId(policySetDefinitionId); + return this; + } + + /** + * Get the metadata property: The security standard metadata. + * + * @return the metadata value. + */ + public StandardMetadata metadata() { + return this.innerProperties() == null ? null : this.innerProperties().metadata(); + } + + /** + * Set the metadata property: The security standard metadata. + * + * @param metadata the metadata value to set. + * @return the SecurityStandardInner object itself. + */ + public SecurityStandardInner withMetadata(StandardMetadata metadata) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardProperties(); + } + this.innerProperties().withMetadata(metadata); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityStandardInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityStandardInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityStandardInner. + */ + public static SecurityStandardInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityStandardInner deserializedSecurityStandardInner = new SecurityStandardInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityStandardInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecurityStandardInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecurityStandardInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecurityStandardInner.innerProperties = StandardProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityStandardInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentInner.java index 8a591aca0bbd..bb81440fefe9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentInner.java @@ -6,10 +6,13 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AdditionalData; import com.azure.resourcemanager.security.models.ResourceDetails; import com.azure.resourcemanager.security.models.SubAssessmentStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** @@ -20,9 +23,23 @@ public final class SecuritySubAssessmentInner extends ProxyResource { /* * Describes properties of an sub-assessment. */ - @JsonProperty(value = "properties") private SecuritySubAssessmentProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecuritySubAssessmentInner class. */ @@ -38,6 +55,36 @@ private SecuritySubAssessmentProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the id property: Vulnerability ID. * @@ -180,4 +227,48 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecuritySubAssessmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecuritySubAssessmentInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecuritySubAssessmentInner. + */ + public static SecuritySubAssessmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecuritySubAssessmentInner deserializedSecuritySubAssessmentInner = new SecuritySubAssessmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecuritySubAssessmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecuritySubAssessmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecuritySubAssessmentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecuritySubAssessmentInner.innerProperties + = SecuritySubAssessmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecuritySubAssessmentInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentProperties.java index 2dd01e8f64ec..91117c88d7a1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecuritySubAssessmentProperties.java @@ -5,75 +5,70 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AdditionalData; import com.azure.resourcemanager.security.models.ResourceDetails; import com.azure.resourcemanager.security.models.SubAssessmentStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** * Describes properties of an sub-assessment. */ @Fluent -public final class SecuritySubAssessmentProperties { +public final class SecuritySubAssessmentProperties implements JsonSerializable { /* * Vulnerability ID */ - @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /* * User friendly display name of the sub-assessment */ - @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) private String displayName; /* * Status of the sub-assessment */ - @JsonProperty(value = "status") private SubAssessmentStatus status; /* * Information on how to remediate this sub-assessment */ - @JsonProperty(value = "remediation", access = JsonProperty.Access.WRITE_ONLY) private String remediation; /* * Description of the impact of this sub-assessment */ - @JsonProperty(value = "impact", access = JsonProperty.Access.WRITE_ONLY) private String impact; /* * Category of the sub-assessment */ - @JsonProperty(value = "category", access = JsonProperty.Access.WRITE_ONLY) private String category; /* * Human readable description of the assessment status */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * The date and time the sub-assessment was generated */ - @JsonProperty(value = "timeGenerated", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime timeGenerated; /* * Details of the resource that was assessed */ - @JsonProperty(value = "resourceDetails") private ResourceDetails resourceDetails; /* * Details of the sub-assessment */ - @JsonProperty(value = "additionalData") private AdditionalData additionalData; /** @@ -221,4 +216,62 @@ public void validate() { additionalData().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("status", this.status); + jsonWriter.writeJsonField("resourceDetails", this.resourceDetails); + jsonWriter.writeJsonField("additionalData", this.additionalData); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecuritySubAssessmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecuritySubAssessmentProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SecuritySubAssessmentProperties. + */ + public static SecuritySubAssessmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecuritySubAssessmentProperties deserializedSecuritySubAssessmentProperties + = new SecuritySubAssessmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.id = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.displayName = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.status = SubAssessmentStatus.fromJson(reader); + } else if ("remediation".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.remediation = reader.getString(); + } else if ("impact".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.impact = reader.getString(); + } else if ("category".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.category = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.description = reader.getString(); + } else if ("timeGenerated".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.timeGenerated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("resourceDetails".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.resourceDetails = ResourceDetails.fromJson(reader); + } else if ("additionalData".equals(fieldName)) { + deserializedSecuritySubAssessmentProperties.additionalData = AdditionalData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecuritySubAssessmentProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskInner.java index cbf7f9f9e037..4fc28dc4a262 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.SecurityTaskParameters; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** @@ -18,9 +21,23 @@ public final class SecurityTaskInner extends ProxyResource { /* * Describes properties of a task. */ - @JsonProperty(value = "properties") private SecurityTaskProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SecurityTaskInner class. */ @@ -36,6 +53,36 @@ private SecurityTaskProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the state property: State of the task (Active, Resolved etc.). * @@ -107,4 +154,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityTaskInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityTaskInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityTaskInner. + */ + public static SecurityTaskInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityTaskInner deserializedSecurityTaskInner = new SecurityTaskInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityTaskInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecurityTaskInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecurityTaskInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecurityTaskInner.innerProperties = SecurityTaskProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityTaskInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskProperties.java index aba632f8e492..304fcb6ef724 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SecurityTaskProperties.java @@ -5,43 +5,43 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.SecurityTaskParameters; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; /** * Describes properties of a task. */ @Fluent -public final class SecurityTaskProperties { +public final class SecurityTaskProperties implements JsonSerializable { /* * State of the task (Active, Resolved etc.) */ - @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) private String state; /* * The time this task was discovered in UTC */ - @JsonProperty(value = "creationTimeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime creationTimeUtc; /* * Changing set of properties, depending on the task type that is derived from the name field */ - @JsonProperty(value = "securityTaskParameters") private SecurityTaskParameters securityTaskParameters; /* * The time this task's details were last changed in UTC */ - @JsonProperty(value = "lastStateChangeTimeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastStateChangeTimeUtc; /* * Additional data on the state of the task */ - @JsonProperty(value = "subState", access = JsonProperty.Access.WRITE_ONLY) private String subState; /** @@ -118,4 +118,50 @@ public void validate() { securityTaskParameters().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("securityTaskParameters", this.securityTaskParameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityTaskProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityTaskProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SecurityTaskProperties. + */ + public static SecurityTaskProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityTaskProperties deserializedSecurityTaskProperties = new SecurityTaskProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedSecurityTaskProperties.state = reader.getString(); + } else if ("creationTimeUtc".equals(fieldName)) { + deserializedSecurityTaskProperties.creationTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("securityTaskParameters".equals(fieldName)) { + deserializedSecurityTaskProperties.securityTaskParameters = SecurityTaskParameters.fromJson(reader); + } else if ("lastStateChangeTimeUtc".equals(fieldName)) { + deserializedSecurityTaskProperties.lastStateChangeTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("subState".equals(fieldName)) { + deserializedSecurityTaskProperties.subState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityTaskProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SensitiveDataDiscoveryProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SensitiveDataDiscoveryProperties.java deleted file mode 100644 index b80bc48c0c66..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SensitiveDataDiscoveryProperties.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.security.models.OperationStatus; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Properties of Sensitive Data Discovery. - */ -@Fluent -public final class SensitiveDataDiscoveryProperties { - /* - * Indicates whether Sensitive Data Discovery should be enabled. - */ - @JsonProperty(value = "isEnabled") - private Boolean isEnabled; - - /* - * Upon failure or partial success. Additional data describing Sensitive Data Discovery enable/disable operation. - */ - @JsonProperty(value = "operationStatus", access = JsonProperty.Access.WRITE_ONLY) - private OperationStatus operationStatus; - - /** - * Creates an instance of SensitiveDataDiscoveryProperties class. - */ - public SensitiveDataDiscoveryProperties() { - } - - /** - * Get the isEnabled property: Indicates whether Sensitive Data Discovery should be enabled. - * - * @return the isEnabled value. - */ - public Boolean isEnabled() { - return this.isEnabled; - } - - /** - * Set the isEnabled property: Indicates whether Sensitive Data Discovery should be enabled. - * - * @param isEnabled the isEnabled value to set. - * @return the SensitiveDataDiscoveryProperties object itself. - */ - public SensitiveDataDiscoveryProperties withIsEnabled(Boolean isEnabled) { - this.isEnabled = isEnabled; - return this; - } - - /** - * Get the operationStatus property: Upon failure or partial success. Additional data describing Sensitive Data - * Discovery enable/disable operation. - * - * @return the operationStatus value. - */ - public OperationStatus operationStatus() { - return this.operationStatus; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (operationStatus() != null) { - operationStatus().validate(); - } - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentInner.java index 9df7e826ac70..3fa335b52741 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentPropertiesProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Describes the server vulnerability assessment details on a resource. @@ -17,9 +20,23 @@ public final class ServerVulnerabilityAssessmentInner extends ProxyResource { /* * describes ServerVulnerabilityAssessment properties. */ - @JsonProperty(value = "properties") private ServerVulnerabilityAssessmentProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ServerVulnerabilityAssessmentInner class. */ @@ -35,6 +52,36 @@ private ServerVulnerabilityAssessmentProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the provisioningState property: The provisioningState of the vulnerability assessment capability on the VM. * @@ -54,4 +101,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerVulnerabilityAssessmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerVulnerabilityAssessmentInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerVulnerabilityAssessmentInner. + */ + public static ServerVulnerabilityAssessmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerVulnerabilityAssessmentInner deserializedServerVulnerabilityAssessmentInner + = new ServerVulnerabilityAssessmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentInner.innerProperties + = ServerVulnerabilityAssessmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServerVulnerabilityAssessmentInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentProperties.java index d20a0bbc26b2..00606cbdf4ab 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentProperties.java @@ -5,18 +5,22 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentPropertiesProvisioningState; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * describes ServerVulnerabilityAssessment properties. */ @Immutable -public final class ServerVulnerabilityAssessmentProperties { +public final class ServerVulnerabilityAssessmentProperties + implements JsonSerializable { /* * The provisioningState of the vulnerability assessment capability on the VM */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private ServerVulnerabilityAssessmentPropertiesProvisioningState provisioningState; /** @@ -41,4 +45,41 @@ public ServerVulnerabilityAssessmentPropertiesProvisioningState provisioningStat */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerVulnerabilityAssessmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerVulnerabilityAssessmentProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerVulnerabilityAssessmentProperties. + */ + public static ServerVulnerabilityAssessmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerVulnerabilityAssessmentProperties deserializedServerVulnerabilityAssessmentProperties + = new ServerVulnerabilityAssessmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentProperties.provisioningState + = ServerVulnerabilityAssessmentPropertiesProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServerVulnerabilityAssessmentProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsAzureSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsAzureSettingProperties.java index 234aeeea94d9..6c4354abd1a4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsAzureSettingProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsAzureSettingProperties.java @@ -6,18 +6,22 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsAzureSettingSelectedProvider; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Describes the vulnerability assessments setting properties on Azure servers in the defined scope. */ @Fluent -public final class ServerVulnerabilityAssessmentsAzureSettingProperties { +public final class ServerVulnerabilityAssessmentsAzureSettingProperties + implements JsonSerializable { /* * The selected vulnerability assessments provider on Azure servers in the defined scope. */ - @JsonProperty(value = "selectedProvider", required = true) private ServerVulnerabilityAssessmentsAzureSettingSelectedProvider selectedProvider; /** @@ -64,4 +68,45 @@ public void validate() { private static final ClientLogger LOGGER = new ClientLogger(ServerVulnerabilityAssessmentsAzureSettingProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("selectedProvider", + this.selectedProvider == null ? null : this.selectedProvider.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerVulnerabilityAssessmentsAzureSettingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerVulnerabilityAssessmentsAzureSettingProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerVulnerabilityAssessmentsAzureSettingProperties. + */ + public static ServerVulnerabilityAssessmentsAzureSettingProperties fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + ServerVulnerabilityAssessmentsAzureSettingProperties deserializedServerVulnerabilityAssessmentsAzureSettingProperties + = new ServerVulnerabilityAssessmentsAzureSettingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("selectedProvider".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentsAzureSettingProperties.selectedProvider + = ServerVulnerabilityAssessmentsAzureSettingSelectedProvider.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServerVulnerabilityAssessmentsAzureSettingProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsListInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsListInner.java index fc2ca2f3d51a..3a39c833028a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsListInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsListInner.java @@ -5,18 +5,22 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * List of server vulnerability assessments. */ @Fluent -public final class ServerVulnerabilityAssessmentsListInner { +public final class ServerVulnerabilityAssessmentsListInner + implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value") private List value; /** @@ -55,4 +59,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerVulnerabilityAssessmentsListInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerVulnerabilityAssessmentsListInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerVulnerabilityAssessmentsListInner. + */ + public static ServerVulnerabilityAssessmentsListInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerVulnerabilityAssessmentsListInner deserializedServerVulnerabilityAssessmentsListInner + = new ServerVulnerabilityAssessmentsListInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ServerVulnerabilityAssessmentInner.fromJson(reader1)); + deserializedServerVulnerabilityAssessmentsListInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedServerVulnerabilityAssessmentsListInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsSettingInner.java index 51d03d25179b..c2bb9f5311b9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsSettingInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/ServerVulnerabilityAssessmentsSettingInner.java @@ -7,44 +7,48 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AzureServersSetting; import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKind; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * A base vulnerability assessments setting on servers in the defined scope. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "kind", - defaultImpl = ServerVulnerabilityAssessmentsSettingInner.class, - visible = true) -@JsonTypeName("ServerVulnerabilityAssessmentsSetting") -@JsonSubTypes({ @JsonSubTypes.Type(name = "AzureServersSetting", value = AzureServersSetting.class) }) @Immutable public class ServerVulnerabilityAssessmentsSettingInner extends ProxyResource { /* * The kind of the server vulnerability assessments setting. */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) - private ServerVulnerabilityAssessmentsSettingKind kind; + private ServerVulnerabilityAssessmentsSettingKind kind + = ServerVulnerabilityAssessmentsSettingKind.fromString("ServerVulnerabilityAssessmentsSetting"); /* * Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of ServerVulnerabilityAssessmentsSettingInner class. */ public ServerVulnerabilityAssessmentsSettingInner() { - this.kind = ServerVulnerabilityAssessmentsSettingKind.fromString("ServerVulnerabilityAssessmentsSetting"); } /** @@ -65,6 +69,47 @@ public SystemData systemData() { return this.systemData; } + /** + * Set the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @param systemData the systemData value to set. + * @return the ServerVulnerabilityAssessmentsSettingInner object itself. + */ + ServerVulnerabilityAssessmentsSettingInner withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -72,4 +117,77 @@ public SystemData systemData() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerVulnerabilityAssessmentsSettingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerVulnerabilityAssessmentsSettingInner if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerVulnerabilityAssessmentsSettingInner. + */ + public static ServerVulnerabilityAssessmentsSettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureServersSetting".equals(discriminatorValue)) { + return AzureServersSetting.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ServerVulnerabilityAssessmentsSettingInner fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + ServerVulnerabilityAssessmentsSettingInner deserializedServerVulnerabilityAssessmentsSettingInner + = new ServerVulnerabilityAssessmentsSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentsSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentsSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentsSettingInner.type = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentsSettingInner.kind + = ServerVulnerabilityAssessmentsSettingKind.fromString(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedServerVulnerabilityAssessmentsSettingInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServerVulnerabilityAssessmentsSettingInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SettingInner.java index 512d209304f3..b0cc33254d4e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SettingInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SettingInner.java @@ -6,37 +6,43 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.AlertSyncSettings; import com.azure.resourcemanager.security.models.DataExportSettings; import com.azure.resourcemanager.security.models.SettingKind; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * The kind of the security setting. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "kind", defaultImpl = SettingInner.class, visible = true) -@JsonTypeName("Setting") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "DataExportSettings", value = DataExportSettings.class), - @JsonSubTypes.Type(name = "AlertSyncSettings", value = AlertSyncSettings.class) }) @Immutable public class SettingInner extends ProxyResource { /* * the kind of the settings string */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) - private SettingKind kind; + private SettingKind kind = SettingKind.fromString("Setting"); + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; /** * Creates an instance of SettingInner class. */ public SettingInner() { - this.kind = SettingKind.fromString("Setting"); } /** @@ -48,6 +54,36 @@ public SettingKind kind() { return this.kind; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -55,4 +91,74 @@ public SettingKind kind() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SettingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SettingInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SettingInner. + */ + public static SettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("DataExportSettings".equals(discriminatorValue)) { + return DataExportSettings.fromJson(readerToUse.reset()); + } else if ("AlertSyncSettings".equals(discriminatorValue)) { + return AlertSyncSettings.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static SettingInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SettingInner deserializedSettingInner = new SettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSettingInner.type = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedSettingInner.kind = SettingKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSettingInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareInner.java index 3aad75836344..4efd7f5a975c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareInner.java @@ -7,8 +7,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.EndOfSupportStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Represents a software data. @@ -18,9 +21,23 @@ public final class SoftwareInner extends ProxyResource { /* * Properties of the Software Inventory resource */ - @JsonProperty(value = "properties", required = true) private SoftwareProperties innerProperties = new SoftwareProperties(); + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of SoftwareInner class. */ @@ -36,6 +53,36 @@ private SoftwareProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the deviceId property: Unique identifier for the virtual machine in the service. * @@ -258,4 +305,47 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(SoftwareInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SoftwareInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SoftwareInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SoftwareInner. + */ + public static SoftwareInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SoftwareInner deserializedSoftwareInner = new SoftwareInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSoftwareInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSoftwareInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSoftwareInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSoftwareInner.innerProperties = SoftwareProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSoftwareInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareProperties.java index e36a96fc48e7..523cb90edb9b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/SoftwareProperties.java @@ -5,66 +5,61 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.EndOfSupportStatus; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Software Inventory resource properties. */ @Fluent -public final class SoftwareProperties { +public final class SoftwareProperties implements JsonSerializable { /* * Unique identifier for the virtual machine in the service. */ - @JsonProperty(value = "deviceId") private String deviceId; /* * Platform of the operating system running on the device. */ - @JsonProperty(value = "osPlatform") private String osPlatform; /* * Name of the software vendor. */ - @JsonProperty(value = "vendor") private String vendor; /* * Name of the software product. */ - @JsonProperty(value = "softwareName") private String softwareName; /* * Version number of the software product. */ - @JsonProperty(value = "version") private String version; /* * End of support status. */ - @JsonProperty(value = "endOfSupportStatus") private EndOfSupportStatus endOfSupportStatus; /* * The end of support date in case the product is upcoming end of support. */ - @JsonProperty(value = "endOfSupportDate") private String endOfSupportDate; /* * Number of weaknesses. */ - @JsonProperty(value = "numberOfKnownVulnerabilities") private Integer numberOfKnownVulnerabilities; /* * First time that the software was seen in the device. */ - @JsonProperty(value = "firstSeenAt") private String firstSeenAt; /** @@ -260,4 +255,67 @@ public SoftwareProperties withFirstSeenAt(String firstSeenAt) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deviceId", this.deviceId); + jsonWriter.writeStringField("osPlatform", this.osPlatform); + jsonWriter.writeStringField("vendor", this.vendor); + jsonWriter.writeStringField("softwareName", this.softwareName); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("endOfSupportStatus", + this.endOfSupportStatus == null ? null : this.endOfSupportStatus.toString()); + jsonWriter.writeStringField("endOfSupportDate", this.endOfSupportDate); + jsonWriter.writeNumberField("numberOfKnownVulnerabilities", this.numberOfKnownVulnerabilities); + jsonWriter.writeStringField("firstSeenAt", this.firstSeenAt); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SoftwareProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SoftwareProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SoftwareProperties. + */ + public static SoftwareProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SoftwareProperties deserializedSoftwareProperties = new SoftwareProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceId".equals(fieldName)) { + deserializedSoftwareProperties.deviceId = reader.getString(); + } else if ("osPlatform".equals(fieldName)) { + deserializedSoftwareProperties.osPlatform = reader.getString(); + } else if ("vendor".equals(fieldName)) { + deserializedSoftwareProperties.vendor = reader.getString(); + } else if ("softwareName".equals(fieldName)) { + deserializedSoftwareProperties.softwareName = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedSoftwareProperties.version = reader.getString(); + } else if ("endOfSupportStatus".equals(fieldName)) { + deserializedSoftwareProperties.endOfSupportStatus + = EndOfSupportStatus.fromString(reader.getString()); + } else if ("endOfSupportDate".equals(fieldName)) { + deserializedSoftwareProperties.endOfSupportDate = reader.getString(); + } else if ("numberOfKnownVulnerabilities".equals(fieldName)) { + deserializedSoftwareProperties.numberOfKnownVulnerabilities + = reader.getNullable(JsonReader::getInt); + } else if ("firstSeenAt".equals(fieldName)) { + deserializedSoftwareProperties.firstSeenAt = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSoftwareProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardAssignmentInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardAssignmentInner.java new file mode 100644 index 000000000000..a2c787b90b9b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardAssignmentInner.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AssignedStandardItem; +import com.azure.resourcemanager.security.models.Effect; +import com.azure.resourcemanager.security.models.StandardAssignmentMetadata; +import com.azure.resourcemanager.security.models.StandardAssignmentPropertiesAttestationData; +import com.azure.resourcemanager.security.models.StandardAssignmentPropertiesExemptionData; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Security Assignment on a resource group over a given scope. + */ +@Fluent +public final class StandardAssignmentInner extends ProxyResource { + /* + * Properties of a standard assignments assignment + */ + private StandardAssignmentProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of StandardAssignmentInner class. + */ + public StandardAssignmentInner() { + } + + /** + * Get the innerProperties property: Properties of a standard assignments assignment. + * + * @return the innerProperties value. + */ + private StandardAssignmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the displayName property: Display name of the standardAssignment. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: Display name of the standardAssignment. + * + * @param displayName the displayName value to set. + * @return the StandardAssignmentInner object itself. + */ + public StandardAssignmentInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardAssignmentProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the description property: Description of the standardAssignment. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the standardAssignment. + * + * @param description the description value to set. + * @return the StandardAssignmentInner object itself. + */ + public StandardAssignmentInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardAssignmentProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the assignedStandard property: Standard item with key as applied to this standard assignment over the given + * scope. + * + * @return the assignedStandard value. + */ + public AssignedStandardItem assignedStandard() { + return this.innerProperties() == null ? null : this.innerProperties().assignedStandard(); + } + + /** + * Set the assignedStandard property: Standard item with key as applied to this standard assignment over the given + * scope. + * + * @param assignedStandard the assignedStandard value to set. + * @return the StandardAssignmentInner object itself. + */ + public StandardAssignmentInner withAssignedStandard(AssignedStandardItem assignedStandard) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardAssignmentProperties(); + } + this.innerProperties().withAssignedStandard(assignedStandard); + return this; + } + + /** + * Get the effect property: Expected effect of this assignment (Audit/Exempt/Attest). + * + * @return the effect value. + */ + public Effect effect() { + return this.innerProperties() == null ? null : this.innerProperties().effect(); + } + + /** + * Set the effect property: Expected effect of this assignment (Audit/Exempt/Attest). + * + * @param effect the effect value to set. + * @return the StandardAssignmentInner object itself. + */ + public StandardAssignmentInner withEffect(Effect effect) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardAssignmentProperties(); + } + this.innerProperties().withEffect(effect); + return this; + } + + /** + * Get the excludedScopes property: Excluded scopes, filter out the descendants of the scope (on management scopes). + * + * @return the excludedScopes value. + */ + public List excludedScopes() { + return this.innerProperties() == null ? null : this.innerProperties().excludedScopes(); + } + + /** + * Set the excludedScopes property: Excluded scopes, filter out the descendants of the scope (on management scopes). + * + * @param excludedScopes the excludedScopes value to set. + * @return the StandardAssignmentInner object itself. + */ + public StandardAssignmentInner withExcludedScopes(List excludedScopes) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardAssignmentProperties(); + } + this.innerProperties().withExcludedScopes(excludedScopes); + return this; + } + + /** + * Get the expiresOn property: Expiration date of this assignment as a full ISO date. + * + * @return the expiresOn value. + */ + public OffsetDateTime expiresOn() { + return this.innerProperties() == null ? null : this.innerProperties().expiresOn(); + } + + /** + * Set the expiresOn property: Expiration date of this assignment as a full ISO date. + * + * @param expiresOn the expiresOn value to set. + * @return the StandardAssignmentInner object itself. + */ + public StandardAssignmentInner withExpiresOn(OffsetDateTime expiresOn) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardAssignmentProperties(); + } + this.innerProperties().withExpiresOn(expiresOn); + return this; + } + + /** + * Get the exemptionData property: Additional data about assignment that has Exempt effect. + * + * @return the exemptionData value. + */ + public StandardAssignmentPropertiesExemptionData exemptionData() { + return this.innerProperties() == null ? null : this.innerProperties().exemptionData(); + } + + /** + * Set the exemptionData property: Additional data about assignment that has Exempt effect. + * + * @param exemptionData the exemptionData value to set. + * @return the StandardAssignmentInner object itself. + */ + public StandardAssignmentInner withExemptionData(StandardAssignmentPropertiesExemptionData exemptionData) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardAssignmentProperties(); + } + this.innerProperties().withExemptionData(exemptionData); + return this; + } + + /** + * Get the attestationData property: Additional data about assignment that has Attest effect. + * + * @return the attestationData value. + */ + public StandardAssignmentPropertiesAttestationData attestationData() { + return this.innerProperties() == null ? null : this.innerProperties().attestationData(); + } + + /** + * Set the attestationData property: Additional data about assignment that has Attest effect. + * + * @param attestationData the attestationData value to set. + * @return the StandardAssignmentInner object itself. + */ + public StandardAssignmentInner withAttestationData(StandardAssignmentPropertiesAttestationData attestationData) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardAssignmentProperties(); + } + this.innerProperties().withAttestationData(attestationData); + return this; + } + + /** + * Get the metadata property: The standard assignment metadata. + * + * @return the metadata value. + */ + public StandardAssignmentMetadata metadata() { + return this.innerProperties() == null ? null : this.innerProperties().metadata(); + } + + /** + * Set the metadata property: The standard assignment metadata. + * + * @param metadata the metadata value to set. + * @return the StandardAssignmentInner object itself. + */ + public StandardAssignmentInner withMetadata(StandardAssignmentMetadata metadata) { + if (this.innerProperties() == null) { + this.innerProperties = new StandardAssignmentProperties(); + } + this.innerProperties().withMetadata(metadata); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StandardAssignmentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StandardAssignmentInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StandardAssignmentInner. + */ + public static StandardAssignmentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StandardAssignmentInner deserializedStandardAssignmentInner = new StandardAssignmentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedStandardAssignmentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedStandardAssignmentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedStandardAssignmentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedStandardAssignmentInner.innerProperties = StandardAssignmentProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStandardAssignmentInner; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardAssignmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardAssignmentProperties.java new file mode 100644 index 000000000000..3dd48b2911a8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardAssignmentProperties.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.AssignedStandardItem; +import com.azure.resourcemanager.security.models.Effect; +import com.azure.resourcemanager.security.models.StandardAssignmentMetadata; +import com.azure.resourcemanager.security.models.StandardAssignmentPropertiesAttestationData; +import com.azure.resourcemanager.security.models.StandardAssignmentPropertiesExemptionData; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Describes the properties of a standardAssignment. + */ +@Fluent +public final class StandardAssignmentProperties implements JsonSerializable { + /* + * Display name of the standardAssignment + */ + private String displayName; + + /* + * Description of the standardAssignment + */ + private String description; + + /* + * Standard item with key as applied to this standard assignment over the given scope + */ + private AssignedStandardItem assignedStandard; + + /* + * Expected effect of this assignment (Audit/Exempt/Attest) + */ + private Effect effect; + + /* + * Excluded scopes, filter out the descendants of the scope (on management scopes) + */ + private List excludedScopes; + + /* + * Expiration date of this assignment as a full ISO date + */ + private OffsetDateTime expiresOn; + + /* + * Additional data about assignment that has Exempt effect + */ + private StandardAssignmentPropertiesExemptionData exemptionData; + + /* + * Additional data about assignment that has Attest effect + */ + private StandardAssignmentPropertiesAttestationData attestationData; + + /* + * The standard assignment metadata. + */ + private StandardAssignmentMetadata metadata; + + /** + * Creates an instance of StandardAssignmentProperties class. + */ + public StandardAssignmentProperties() { + } + + /** + * Get the displayName property: Display name of the standardAssignment. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the standardAssignment. + * + * @param displayName the displayName value to set. + * @return the StandardAssignmentProperties object itself. + */ + public StandardAssignmentProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: Description of the standardAssignment. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the standardAssignment. + * + * @param description the description value to set. + * @return the StandardAssignmentProperties object itself. + */ + public StandardAssignmentProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the assignedStandard property: Standard item with key as applied to this standard assignment over the given + * scope. + * + * @return the assignedStandard value. + */ + public AssignedStandardItem assignedStandard() { + return this.assignedStandard; + } + + /** + * Set the assignedStandard property: Standard item with key as applied to this standard assignment over the given + * scope. + * + * @param assignedStandard the assignedStandard value to set. + * @return the StandardAssignmentProperties object itself. + */ + public StandardAssignmentProperties withAssignedStandard(AssignedStandardItem assignedStandard) { + this.assignedStandard = assignedStandard; + return this; + } + + /** + * Get the effect property: Expected effect of this assignment (Audit/Exempt/Attest). + * + * @return the effect value. + */ + public Effect effect() { + return this.effect; + } + + /** + * Set the effect property: Expected effect of this assignment (Audit/Exempt/Attest). + * + * @param effect the effect value to set. + * @return the StandardAssignmentProperties object itself. + */ + public StandardAssignmentProperties withEffect(Effect effect) { + this.effect = effect; + return this; + } + + /** + * Get the excludedScopes property: Excluded scopes, filter out the descendants of the scope (on management scopes). + * + * @return the excludedScopes value. + */ + public List excludedScopes() { + return this.excludedScopes; + } + + /** + * Set the excludedScopes property: Excluded scopes, filter out the descendants of the scope (on management scopes). + * + * @param excludedScopes the excludedScopes value to set. + * @return the StandardAssignmentProperties object itself. + */ + public StandardAssignmentProperties withExcludedScopes(List excludedScopes) { + this.excludedScopes = excludedScopes; + return this; + } + + /** + * Get the expiresOn property: Expiration date of this assignment as a full ISO date. + * + * @return the expiresOn value. + */ + public OffsetDateTime expiresOn() { + return this.expiresOn; + } + + /** + * Set the expiresOn property: Expiration date of this assignment as a full ISO date. + * + * @param expiresOn the expiresOn value to set. + * @return the StandardAssignmentProperties object itself. + */ + public StandardAssignmentProperties withExpiresOn(OffsetDateTime expiresOn) { + this.expiresOn = expiresOn; + return this; + } + + /** + * Get the exemptionData property: Additional data about assignment that has Exempt effect. + * + * @return the exemptionData value. + */ + public StandardAssignmentPropertiesExemptionData exemptionData() { + return this.exemptionData; + } + + /** + * Set the exemptionData property: Additional data about assignment that has Exempt effect. + * + * @param exemptionData the exemptionData value to set. + * @return the StandardAssignmentProperties object itself. + */ + public StandardAssignmentProperties withExemptionData(StandardAssignmentPropertiesExemptionData exemptionData) { + this.exemptionData = exemptionData; + return this; + } + + /** + * Get the attestationData property: Additional data about assignment that has Attest effect. + * + * @return the attestationData value. + */ + public StandardAssignmentPropertiesAttestationData attestationData() { + return this.attestationData; + } + + /** + * Set the attestationData property: Additional data about assignment that has Attest effect. + * + * @param attestationData the attestationData value to set. + * @return the StandardAssignmentProperties object itself. + */ + public StandardAssignmentProperties + withAttestationData(StandardAssignmentPropertiesAttestationData attestationData) { + this.attestationData = attestationData; + return this; + } + + /** + * Get the metadata property: The standard assignment metadata. + * + * @return the metadata value. + */ + public StandardAssignmentMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The standard assignment metadata. + * + * @param metadata the metadata value to set. + * @return the StandardAssignmentProperties object itself. + */ + public StandardAssignmentProperties withMetadata(StandardAssignmentMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (assignedStandard() != null) { + assignedStandard().validate(); + } + if (exemptionData() != null) { + exemptionData().validate(); + } + if (attestationData() != null) { + attestationData().validate(); + } + if (metadata() != null) { + metadata().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("assignedStandard", this.assignedStandard); + jsonWriter.writeStringField("effect", this.effect == null ? null : this.effect.toString()); + jsonWriter.writeArrayField("excludedScopes", this.excludedScopes, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("expiresOn", + this.expiresOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiresOn)); + jsonWriter.writeJsonField("exemptionData", this.exemptionData); + jsonWriter.writeJsonField("attestationData", this.attestationData); + jsonWriter.writeJsonField("metadata", this.metadata); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StandardAssignmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StandardAssignmentProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the StandardAssignmentProperties. + */ + public static StandardAssignmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StandardAssignmentProperties deserializedStandardAssignmentProperties = new StandardAssignmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedStandardAssignmentProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedStandardAssignmentProperties.description = reader.getString(); + } else if ("assignedStandard".equals(fieldName)) { + deserializedStandardAssignmentProperties.assignedStandard = AssignedStandardItem.fromJson(reader); + } else if ("effect".equals(fieldName)) { + deserializedStandardAssignmentProperties.effect = Effect.fromString(reader.getString()); + } else if ("excludedScopes".equals(fieldName)) { + List excludedScopes = reader.readArray(reader1 -> reader1.getString()); + deserializedStandardAssignmentProperties.excludedScopes = excludedScopes; + } else if ("expiresOn".equals(fieldName)) { + deserializedStandardAssignmentProperties.expiresOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("exemptionData".equals(fieldName)) { + deserializedStandardAssignmentProperties.exemptionData + = StandardAssignmentPropertiesExemptionData.fromJson(reader); + } else if ("attestationData".equals(fieldName)) { + deserializedStandardAssignmentProperties.attestationData + = StandardAssignmentPropertiesAttestationData.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + deserializedStandardAssignmentProperties.metadata = StandardAssignmentMetadata.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStandardAssignmentProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardProperties.java new file mode 100644 index 000000000000..88ca50e38a2f --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/StandardProperties.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.models.PartialAssessmentProperties; +import com.azure.resourcemanager.security.models.StandardMetadata; +import com.azure.resourcemanager.security.models.StandardSupportedCloud; +import com.azure.resourcemanager.security.models.StandardType; +import java.io.IOException; +import java.util.List; + +/** + * Describes properties of a standard. + */ +@Fluent +public final class StandardProperties implements JsonSerializable { + /* + * Display name of the standard, equivalent to the standardId + */ + private String displayName; + + /* + * Standard type (Custom or Default or Compliance only currently) + */ + private StandardType standardType; + + /* + * Description of the standard + */ + private String description; + + /* + * List of assessment keys to apply to standard scope. + */ + private List assessments; + + /* + * List of all standard supported clouds. + */ + private List cloudProviders; + + /* + * The policy set definition id associated with the standard. + */ + private String policySetDefinitionId; + + /* + * The security standard metadata. + */ + private StandardMetadata metadata; + + /** + * Creates an instance of StandardProperties class. + */ + public StandardProperties() { + } + + /** + * Get the displayName property: Display name of the standard, equivalent to the standardId. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the standard, equivalent to the standardId. + * + * @param displayName the displayName value to set. + * @return the StandardProperties object itself. + */ + public StandardProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the standardType property: Standard type (Custom or Default or Compliance only currently). + * + * @return the standardType value. + */ + public StandardType standardType() { + return this.standardType; + } + + /** + * Get the description property: Description of the standard. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the standard. + * + * @param description the description value to set. + * @return the StandardProperties object itself. + */ + public StandardProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the assessments property: List of assessment keys to apply to standard scope. + * + * @return the assessments value. + */ + public List assessments() { + return this.assessments; + } + + /** + * Set the assessments property: List of assessment keys to apply to standard scope. + * + * @param assessments the assessments value to set. + * @return the StandardProperties object itself. + */ + public StandardProperties withAssessments(List assessments) { + this.assessments = assessments; + return this; + } + + /** + * Get the cloudProviders property: List of all standard supported clouds. + * + * @return the cloudProviders value. + */ + public List cloudProviders() { + return this.cloudProviders; + } + + /** + * Set the cloudProviders property: List of all standard supported clouds. + * + * @param cloudProviders the cloudProviders value to set. + * @return the StandardProperties object itself. + */ + public StandardProperties withCloudProviders(List cloudProviders) { + this.cloudProviders = cloudProviders; + return this; + } + + /** + * Get the policySetDefinitionId property: The policy set definition id associated with the standard. + * + * @return the policySetDefinitionId value. + */ + public String policySetDefinitionId() { + return this.policySetDefinitionId; + } + + /** + * Set the policySetDefinitionId property: The policy set definition id associated with the standard. + * + * @param policySetDefinitionId the policySetDefinitionId value to set. + * @return the StandardProperties object itself. + */ + public StandardProperties withPolicySetDefinitionId(String policySetDefinitionId) { + this.policySetDefinitionId = policySetDefinitionId; + return this; + } + + /** + * Get the metadata property: The security standard metadata. + * + * @return the metadata value. + */ + public StandardMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The security standard metadata. + * + * @param metadata the metadata value to set. + * @return the StandardProperties object itself. + */ + public StandardProperties withMetadata(StandardMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (assessments() != null) { + assessments().forEach(e -> e.validate()); + } + if (metadata() != null) { + metadata().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("assessments", this.assessments, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("cloudProviders", this.cloudProviders, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("policySetDefinitionId", this.policySetDefinitionId); + jsonWriter.writeJsonField("metadata", this.metadata); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StandardProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StandardProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the StandardProperties. + */ + public static StandardProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StandardProperties deserializedStandardProperties = new StandardProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedStandardProperties.displayName = reader.getString(); + } else if ("standardType".equals(fieldName)) { + deserializedStandardProperties.standardType = StandardType.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedStandardProperties.description = reader.getString(); + } else if ("assessments".equals(fieldName)) { + List assessments + = reader.readArray(reader1 -> PartialAssessmentProperties.fromJson(reader1)); + deserializedStandardProperties.assessments = assessments; + } else if ("cloudProviders".equals(fieldName)) { + List cloudProviders + = reader.readArray(reader1 -> StandardSupportedCloud.fromString(reader1.getString())); + deserializedStandardProperties.cloudProviders = cloudProviders; + } else if ("policySetDefinitionId".equals(fieldName)) { + deserializedStandardProperties.policySetDefinitionId = reader.getString(); + } else if ("metadata".equals(fieldName)) { + deserializedStandardProperties.metadata = StandardMetadata.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStandardProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceInner.java index 7cbce9ddf504..6fde5a719571 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceInner.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.TopologySingleResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -19,15 +22,28 @@ public final class TopologyResourceInner extends ProxyResource { /* * The properties property. */ - @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) private TopologyResourceProperties innerProperties; /* * Location where the resource is stored */ - @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) private String location; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of TopologyResourceInner class. */ @@ -52,6 +68,36 @@ public String location() { return this.location; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the calculatedDateTime property: The UTC time on which the topology was calculated. * @@ -80,4 +126,48 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopologyResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopologyResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TopologyResourceInner. + */ + public static TopologyResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopologyResourceInner deserializedTopologyResourceInner = new TopologyResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTopologyResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTopologyResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTopologyResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedTopologyResourceInner.innerProperties = TopologyResourceProperties.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedTopologyResourceInner.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTopologyResourceInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceProperties.java index f224815c4710..00ca75b2a412 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/TopologyResourceProperties.java @@ -5,8 +5,13 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.TopologySingleResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -14,17 +19,15 @@ * The TopologyResourceProperties model. */ @Immutable -public final class TopologyResourceProperties { +public final class TopologyResourceProperties implements JsonSerializable { /* * The UTC time on which the topology was calculated */ - @JsonProperty(value = "calculatedDateTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime calculatedDateTime; /* * Azure resources which are part of this topology resource */ - @JsonProperty(value = "topologyResources", access = JsonProperty.Access.WRITE_ONLY) private List topologyResources; /** @@ -61,4 +64,44 @@ public void validate() { topologyResources().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopologyResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopologyResourceProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TopologyResourceProperties. + */ + public static TopologyResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopologyResourceProperties deserializedTopologyResourceProperties = new TopologyResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("calculatedDateTime".equals(fieldName)) { + deserializedTopologyResourceProperties.calculatedDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("topologyResources".equals(fieldName)) { + List topologyResources + = reader.readArray(reader1 -> TopologySingleResource.fromJson(reader1)); + deserializedTopologyResourceProperties.topologyResources = topologyResources; + } else { + reader.skipChildren(); + } + } + + return deserializedTopologyResourceProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/UpdateIoTSecuritySolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/UpdateIoTSecuritySolutionProperties.java index f8585aed96b8..395e1eeb69c1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/UpdateIoTSecuritySolutionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/UpdateIoTSecuritySolutionProperties.java @@ -5,26 +5,29 @@ package com.azure.resourcemanager.security.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.models.RecommendationConfigurationProperties; import com.azure.resourcemanager.security.models.UserDefinedResourcesProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Update Security Solution setting data. */ @Fluent -public final class UpdateIoTSecuritySolutionProperties { +public final class UpdateIoTSecuritySolutionProperties + implements JsonSerializable { /* * Properties of the IoT Security solution's user defined resources. */ - @JsonProperty(value = "userDefinedResources") private UserDefinedResourcesProperties userDefinedResources; /* * List of the configuration status for each recommendation type. */ - @JsonProperty(value = "recommendationsConfiguration") private List recommendationsConfiguration; /** @@ -88,4 +91,49 @@ public void validate() { recommendationsConfiguration().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("userDefinedResources", this.userDefinedResources); + jsonWriter.writeArrayField("recommendationsConfiguration", this.recommendationsConfiguration, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateIoTSecuritySolutionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateIoTSecuritySolutionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateIoTSecuritySolutionProperties. + */ + public static UpdateIoTSecuritySolutionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateIoTSecuritySolutionProperties deserializedUpdateIoTSecuritySolutionProperties + = new UpdateIoTSecuritySolutionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userDefinedResources".equals(fieldName)) { + deserializedUpdateIoTSecuritySolutionProperties.userDefinedResources + = UserDefinedResourcesProperties.fromJson(reader); + } else if ("recommendationsConfiguration".equals(fieldName)) { + List recommendationsConfiguration + = reader.readArray(reader1 -> RecommendationConfigurationProperties.fromJson(reader1)); + deserializedUpdateIoTSecuritySolutionProperties.recommendationsConfiguration + = recommendationsConfiguration; + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateIoTSecuritySolutionProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java index 426302aca95d..403dcdbd58a0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingInner.java @@ -6,7 +6,10 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Configures where to store the OMS agent data for workspaces under a scope. @@ -16,9 +19,23 @@ public final class WorkspaceSettingInner extends ProxyResource { /* * Workspace setting data */ - @JsonProperty(value = "properties") private WorkspaceSettingProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of WorkspaceSettingInner class. */ @@ -34,6 +51,36 @@ private WorkspaceSettingProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the workspaceId property: The full Azure ID of the workspace to save the data in. * @@ -92,4 +139,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceSettingInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceSettingInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceSettingInner. + */ + public static WorkspaceSettingInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceSettingInner deserializedWorkspaceSettingInner = new WorkspaceSettingInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspaceSettingInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspaceSettingInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspaceSettingInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedWorkspaceSettingInner.innerProperties = WorkspaceSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceSettingInner; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingProperties.java index 872897e94f07..706f12a15eab 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/fluent/models/WorkspaceSettingProperties.java @@ -6,23 +6,26 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Workspace setting data. */ @Fluent -public final class WorkspaceSettingProperties { +public final class WorkspaceSettingProperties implements JsonSerializable { /* * The full Azure ID of the workspace to save the data in */ - @JsonProperty(value = "workspaceId", required = true) private String workspaceId; /* - * All the VMs in this scope will send their security data to the mentioned workspace unless overridden by a setting with more specific scope + * All the VMs in this scope will send their security data to the mentioned workspace unless overridden by a setting + * with more specific scope */ - @JsonProperty(value = "scope", required = true) private String scope; /** @@ -92,4 +95,44 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(WorkspaceSettingProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("workspaceId", this.workspaceId); + jsonWriter.writeStringField("scope", this.scope); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceSettingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceSettingProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceSettingProperties. + */ + public static WorkspaceSettingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceSettingProperties deserializedWorkspaceSettingProperties = new WorkspaceSettingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("workspaceId".equals(fieldName)) { + deserializedWorkspaceSettingProperties.workspaceId = reader.getString(); + } else if ("scope".equals(fieldName)) { + deserializedWorkspaceSettingProperties.scope = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceSettingProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupImpl.java deleted file mode 100644 index 062002658f56..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.implementation; - -import com.azure.core.management.Region; -import com.azure.core.util.Context; -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroup; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControlIssueSummary; -import com.azure.resourcemanager.security.models.ConfigurationStatus; -import com.azure.resourcemanager.security.models.EnforcementMode; -import com.azure.resourcemanager.security.models.PathRecommendation; -import com.azure.resourcemanager.security.models.ProtectionMode; -import com.azure.resourcemanager.security.models.RecommendationStatus; -import com.azure.resourcemanager.security.models.SourceSystem; -import com.azure.resourcemanager.security.models.VmRecommendation; -import java.util.Collections; -import java.util.List; - -public final class AdaptiveApplicationControlGroupImpl implements AdaptiveApplicationControlGroup, - AdaptiveApplicationControlGroup.Definition, AdaptiveApplicationControlGroup.Update { - private AdaptiveApplicationControlGroupInner innerObject; - - private final com.azure.resourcemanager.security.SecurityManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public EnforcementMode enforcementMode() { - return this.innerModel().enforcementMode(); - } - - public ProtectionMode protectionMode() { - return this.innerModel().protectionMode(); - } - - public ConfigurationStatus configurationStatus() { - return this.innerModel().configurationStatus(); - } - - public RecommendationStatus recommendationStatus() { - return this.innerModel().recommendationStatus(); - } - - public List issues() { - List inner = this.innerModel().issues(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public SourceSystem sourceSystem() { - return this.innerModel().sourceSystem(); - } - - public List vmRecommendations() { - List inner = this.innerModel().vmRecommendations(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public List pathRecommendations() { - List inner = this.innerModel().pathRecommendations(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public AdaptiveApplicationControlGroupInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.security.SecurityManager manager() { - return this.serviceManager; - } - - private String ascLocation; - - private String groupName; - - public AdaptiveApplicationControlGroupImpl withExistingLocation(String ascLocation) { - this.ascLocation = ascLocation; - return this; - } - - public AdaptiveApplicationControlGroup create() { - this.innerObject = serviceManager.serviceClient() - .getAdaptiveApplicationControls() - .putWithResponse(ascLocation, groupName, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public AdaptiveApplicationControlGroup create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getAdaptiveApplicationControls() - .putWithResponse(ascLocation, groupName, this.innerModel(), context) - .getValue(); - return this; - } - - AdaptiveApplicationControlGroupImpl(String name, - com.azure.resourcemanager.security.SecurityManager serviceManager) { - this.innerObject = new AdaptiveApplicationControlGroupInner(); - this.serviceManager = serviceManager; - this.groupName = name; - } - - public AdaptiveApplicationControlGroupImpl update() { - return this; - } - - public AdaptiveApplicationControlGroup apply() { - this.innerObject = serviceManager.serviceClient() - .getAdaptiveApplicationControls() - .putWithResponse(ascLocation, groupName, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public AdaptiveApplicationControlGroup apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getAdaptiveApplicationControls() - .putWithResponse(ascLocation, groupName, this.innerModel(), context) - .getValue(); - return this; - } - - AdaptiveApplicationControlGroupImpl(AdaptiveApplicationControlGroupInner innerObject, - com.azure.resourcemanager.security.SecurityManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.ascLocation = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "locations"); - this.groupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "applicationWhitelistings"); - } - - public AdaptiveApplicationControlGroup refresh() { - this.innerObject = serviceManager.serviceClient() - .getAdaptiveApplicationControls() - .getWithResponse(ascLocation, groupName, Context.NONE) - .getValue(); - return this; - } - - public AdaptiveApplicationControlGroup refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getAdaptiveApplicationControls() - .getWithResponse(ascLocation, groupName, context) - .getValue(); - return this; - } - - public AdaptiveApplicationControlGroupImpl withEnforcementMode(EnforcementMode enforcementMode) { - this.innerModel().withEnforcementMode(enforcementMode); - return this; - } - - public AdaptiveApplicationControlGroupImpl withProtectionMode(ProtectionMode protectionMode) { - this.innerModel().withProtectionMode(protectionMode); - return this; - } - - public AdaptiveApplicationControlGroupImpl withVmRecommendations(List vmRecommendations) { - this.innerModel().withVmRecommendations(vmRecommendations); - return this; - } - - public AdaptiveApplicationControlGroupImpl withPathRecommendations(List pathRecommendations) { - this.innerModel().withPathRecommendations(pathRecommendations); - return this; - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupsImpl.java deleted file mode 100644 index 98c7819b0d1a..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlGroupsImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.implementation; - -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroup; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroups; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public final class AdaptiveApplicationControlGroupsImpl implements AdaptiveApplicationControlGroups { - private AdaptiveApplicationControlGroupsInner innerObject; - - private final com.azure.resourcemanager.security.SecurityManager serviceManager; - - AdaptiveApplicationControlGroupsImpl(AdaptiveApplicationControlGroupsInner innerObject, - com.azure.resourcemanager.security.SecurityManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public List value() { - List inner = this.innerModel().value(); - if (inner != null) { - return Collections.unmodifiableList(inner.stream() - .map(inner1 -> new AdaptiveApplicationControlGroupImpl(inner1, this.manager())) - .collect(Collectors.toList())); - } else { - return Collections.emptyList(); - } - } - - public AdaptiveApplicationControlGroupsInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.security.SecurityManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsClientImpl.java deleted file mode 100644 index fd7da17576c0..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsClientImpl.java +++ /dev/null @@ -1,589 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.resourcemanager.security.fluent.AdaptiveApplicationControlsClient; -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in AdaptiveApplicationControlsClient. - */ -public final class AdaptiveApplicationControlsClientImpl implements AdaptiveApplicationControlsClient { - /** - * The proxy service used to perform REST calls. - */ - private final AdaptiveApplicationControlsService service; - - /** - * The service client containing this operation class. - */ - private final SecurityCenterImpl client; - - /** - * Initializes an instance of AdaptiveApplicationControlsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - AdaptiveApplicationControlsClientImpl(SecurityCenterImpl client) { - this.service = RestProxy.create(AdaptiveApplicationControlsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SecurityCenterAdaptiveApplicationControls to be used by the proxy - * service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterAdapti") - public interface AdaptiveApplicationControlsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @QueryParam("includePathRecommendations") Boolean includePathRecommendations, - @QueryParam("summary") Boolean summary, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, - @PathParam("groupName") String groupName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> put(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, - @PathParam("groupName") String groupName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") AdaptiveApplicationControlGroupInner body, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}") - @ExpectedResponses({ 200, 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("ascLocation") String ascLocation, - @PathParam("groupName") String groupName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Gets a list of application control machine groups for the subscription. - * - * @param includePathRecommendations Include the policy rules. - * @param summary Return output in a summarized form. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of application control machine groups for the subscription along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listWithResponseAsync(Boolean includePathRecommendations, Boolean summary) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, - includePathRecommendations, summary, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets a list of application control machine groups for the subscription. - * - * @param includePathRecommendations Include the policy rules. - * @param summary Return output in a summarized form. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of application control machine groups for the subscription along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listWithResponseAsync(Boolean includePathRecommendations, Boolean summary, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, - includePathRecommendations, summary, accept, context); - } - - /** - * Gets a list of application control machine groups for the subscription. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of application control machine groups for the subscription on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listAsync() { - final Boolean includePathRecommendations = null; - final Boolean summary = null; - return listWithResponseAsync(includePathRecommendations, summary) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets a list of application control machine groups for the subscription. - * - * @param includePathRecommendations Include the policy rules. - * @param summary Return output in a summarized form. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of application control machine groups for the subscription along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(Boolean includePathRecommendations, - Boolean summary, Context context) { - return listWithResponseAsync(includePathRecommendations, summary, context).block(); - } - - /** - * Gets a list of application control machine groups for the subscription. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of application control machine groups for the subscription. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AdaptiveApplicationControlGroupsInner list() { - final Boolean includePathRecommendations = null; - final Boolean summary = null; - return listWithResponse(includePathRecommendations, summary, Context.NONE).getValue(); - } - - /** - * Gets an application control VM/server group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String ascLocation, - String groupName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (groupName == null) { - return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, - groupName, apiVersion, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets an application control VM/server group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String ascLocation, - String groupName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (groupName == null) { - return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, groupName, - apiVersion, accept, context); - } - - /** - * Gets an application control VM/server group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String ascLocation, String groupName) { - return getWithResponseAsync(ascLocation, groupName).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets an application control VM/server group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String ascLocation, String groupName, - Context context) { - return getWithResponseAsync(ascLocation, groupName, context).block(); - } - - /** - * Gets an application control VM/server group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AdaptiveApplicationControlGroupInner get(String ascLocation, String groupName) { - return getWithResponse(ascLocation, groupName, Context.NONE).getValue(); - } - - /** - * Update an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> putWithResponseAsync(String ascLocation, - String groupName, AdaptiveApplicationControlGroupInner body) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (groupName == null) { - return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); - } - if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); - } else { - body.validate(); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, - groupName, apiVersion, body, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> putWithResponseAsync(String ascLocation, - String groupName, AdaptiveApplicationControlGroupInner body, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (groupName == null) { - return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); - } - if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); - } else { - body.validate(); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.put(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, groupName, - apiVersion, body, accept, context); - } - - /** - * Update an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putAsync(String ascLocation, String groupName, - AdaptiveApplicationControlGroupInner body) { - return putWithResponseAsync(ascLocation, groupName, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(String ascLocation, String groupName, - AdaptiveApplicationControlGroupInner body, Context context) { - return putWithResponseAsync(ascLocation, groupName, body, context).block(); - } - - /** - * Update an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AdaptiveApplicationControlGroupInner put(String ascLocation, String groupName, - AdaptiveApplicationControlGroupInner body) { - return putWithResponse(ascLocation, groupName, body, Context.NONE).getValue(); - } - - /** - * Delete an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String ascLocation, String groupName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (groupName == null) { - return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), - ascLocation, groupName, apiVersion, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String ascLocation, String groupName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (ascLocation == null) { - return Mono.error(new IllegalArgumentException("Parameter ascLocation is required and cannot be null.")); - } - if (groupName == null) { - return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), ascLocation, groupName, - apiVersion, accept, context); - } - - /** - * Delete an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String ascLocation, String groupName) { - return deleteWithResponseAsync(ascLocation, groupName).flatMap(ignored -> Mono.empty()); - } - - /** - * Delete an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String ascLocation, String groupName, Context context) { - return deleteWithResponseAsync(ascLocation, groupName, context).block(); - } - - /** - * Delete an application control machine group. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String ascLocation, String groupName) { - deleteWithResponse(ascLocation, groupName, Context.NONE); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsImpl.java deleted file mode 100644 index 624149443b06..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveApplicationControlsImpl.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.security.fluent.AdaptiveApplicationControlsClient; -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroup; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControlGroups; -import com.azure.resourcemanager.security.models.AdaptiveApplicationControls; - -public final class AdaptiveApplicationControlsImpl implements AdaptiveApplicationControls { - private static final ClientLogger LOGGER = new ClientLogger(AdaptiveApplicationControlsImpl.class); - - private final AdaptiveApplicationControlsClient innerClient; - - private final com.azure.resourcemanager.security.SecurityManager serviceManager; - - public AdaptiveApplicationControlsImpl(AdaptiveApplicationControlsClient innerClient, - com.azure.resourcemanager.security.SecurityManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response listWithResponse(Boolean includePathRecommendations, - Boolean summary, Context context) { - Response inner - = this.serviceClient().listWithResponse(includePathRecommendations, summary, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new AdaptiveApplicationControlGroupsImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public AdaptiveApplicationControlGroups list() { - AdaptiveApplicationControlGroupsInner inner = this.serviceClient().list(); - if (inner != null) { - return new AdaptiveApplicationControlGroupsImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response getWithResponse(String ascLocation, String groupName, - Context context) { - Response inner - = this.serviceClient().getWithResponse(ascLocation, groupName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new AdaptiveApplicationControlGroupImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public AdaptiveApplicationControlGroup get(String ascLocation, String groupName) { - AdaptiveApplicationControlGroupInner inner = this.serviceClient().get(ascLocation, groupName); - if (inner != null) { - return new AdaptiveApplicationControlGroupImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteByResourceGroupWithResponse(String ascLocation, String groupName, Context context) { - return this.serviceClient().deleteWithResponse(ascLocation, groupName, context); - } - - public void deleteByResourceGroup(String ascLocation, String groupName) { - this.serviceClient().delete(ascLocation, groupName); - } - - public AdaptiveApplicationControlGroup getById(String id) { - String ascLocation = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (ascLocation == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String groupName = ResourceManagerUtils.getValueFromIdByName(id, "applicationWhitelistings"); - if (groupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'applicationWhitelistings'.", id))); - } - return this.getWithResponse(ascLocation, groupName, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String ascLocation = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (ascLocation == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String groupName = ResourceManagerUtils.getValueFromIdByName(id, "applicationWhitelistings"); - if (groupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'applicationWhitelistings'.", id))); - } - return this.getWithResponse(ascLocation, groupName, context); - } - - public void deleteById(String id) { - String ascLocation = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (ascLocation == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String groupName = ResourceManagerUtils.getValueFromIdByName(id, "applicationWhitelistings"); - if (groupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'applicationWhitelistings'.", id))); - } - this.deleteByResourceGroupWithResponse(ascLocation, groupName, Context.NONE); - } - - public Response deleteByIdWithResponse(String id, Context context) { - String ascLocation = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (ascLocation == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String groupName = ResourceManagerUtils.getValueFromIdByName(id, "applicationWhitelistings"); - if (groupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'applicationWhitelistings'.", id))); - } - return this.deleteByResourceGroupWithResponse(ascLocation, groupName, context); - } - - private AdaptiveApplicationControlsClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.security.SecurityManager manager() { - return this.serviceManager; - } - - public AdaptiveApplicationControlGroupImpl define(String name) { - return new AdaptiveApplicationControlGroupImpl(name, this.manager()); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningImpl.java deleted file mode 100644 index b2b9dd401a10..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.implementation; - -import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; -import com.azure.resourcemanager.security.models.AdaptiveNetworkHardening; -import com.azure.resourcemanager.security.models.EffectiveNetworkSecurityGroups; -import com.azure.resourcemanager.security.models.Rule; -import java.time.OffsetDateTime; -import java.util.Collections; -import java.util.List; - -public final class AdaptiveNetworkHardeningImpl implements AdaptiveNetworkHardening { - private AdaptiveNetworkHardeningInner innerObject; - - private final com.azure.resourcemanager.security.SecurityManager serviceManager; - - AdaptiveNetworkHardeningImpl(AdaptiveNetworkHardeningInner innerObject, - com.azure.resourcemanager.security.SecurityManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public List rules() { - List inner = this.innerModel().rules(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public OffsetDateTime rulesCalculationTime() { - return this.innerModel().rulesCalculationTime(); - } - - public List effectiveNetworkSecurityGroups() { - List inner = this.innerModel().effectiveNetworkSecurityGroups(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public AdaptiveNetworkHardeningInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.security.SecurityManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsClientImpl.java deleted file mode 100644 index 72b53aecee97..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsClientImpl.java +++ /dev/null @@ -1,851 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.resourcemanager.security.fluent.AdaptiveNetworkHardeningsClient; -import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; -import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningEnforceRequest; -import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningsList; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in AdaptiveNetworkHardeningsClient. - */ -public final class AdaptiveNetworkHardeningsClientImpl implements AdaptiveNetworkHardeningsClient { - /** - * The proxy service used to perform REST calls. - */ - private final AdaptiveNetworkHardeningsService service; - - /** - * The service client containing this operation class. - */ - private final SecurityCenterImpl client; - - /** - * Initializes an instance of AdaptiveNetworkHardeningsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - AdaptiveNetworkHardeningsClientImpl(SecurityCenterImpl client) { - this.service = RestProxy.create(AdaptiveNetworkHardeningsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SecurityCenterAdaptiveNetworkHardenings to be used by the proxy - * service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "SecurityCenterAdapti") - public interface AdaptiveNetworkHardeningsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByExtendedResource(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, - @PathParam("resourceName") String resourceName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, - @PathParam("resourceName") String resourceName, - @PathParam("adaptiveNetworkHardeningResourceName") String adaptiveNetworkHardeningResourceName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> enforce(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceNamespace") String resourceNamespace, @PathParam("resourceType") String resourceType, - @PathParam("resourceName") String resourceName, - @PathParam("adaptiveNetworkHardeningResourceName") String adaptiveNetworkHardeningResourceName, - @PathParam("adaptiveNetworkHardeningEnforceAction") String adaptiveNetworkHardeningEnforceAction, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") AdaptiveNetworkHardeningEnforceRequest body, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByExtendedResourceNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByExtendedResourceSinglePageAsync( - String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceNamespace == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); - } - if (resourceType == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByExtendedResource(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, resourceNamespace, resourceType, resourceName, apiVersion, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByExtendedResourceSinglePageAsync( - String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceNamespace == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); - } - if (resourceType == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByExtendedResource(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - resourceNamespace, resourceType, resourceName, apiVersion, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource as paginated response - * with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByExtendedResourceAsync(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName) { - return new PagedFlux<>(() -> listByExtendedResourceSinglePageAsync(resourceGroupName, resourceNamespace, - resourceType, resourceName), nextLink -> listByExtendedResourceNextSinglePageAsync(nextLink)); - } - - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource as paginated response - * with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByExtendedResourceAsync(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, Context context) { - return new PagedFlux<>(() -> listByExtendedResourceSinglePageAsync(resourceGroupName, resourceNamespace, - resourceType, resourceName, context), - nextLink -> listByExtendedResourceNextSinglePageAsync(nextLink, context)); - } - - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource as paginated response - * with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByExtendedResource(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName) { - return new PagedIterable<>( - listByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName)); - } - - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource as paginated response - * with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByExtendedResource(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, Context context) { - return new PagedIterable<>( - listByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, context)); - } - - /** - * Gets a single Adaptive Network Hardening resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single Adaptive Network Hardening resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, - String adaptiveNetworkHardeningResourceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceNamespace == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); - } - if (resourceType == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (adaptiveNetworkHardeningResourceName == null) { - return Mono.error(new IllegalArgumentException( - "Parameter adaptiveNetworkHardeningResourceName is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, - apiVersion, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets a single Adaptive Network Hardening resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single Adaptive Network Hardening resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceNamespace == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); - } - if (resourceType == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (adaptiveNetworkHardeningResourceName == null) { - return Mono.error(new IllegalArgumentException( - "Parameter adaptiveNetworkHardeningResourceName is required and cannot be null.")); - } - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, apiVersion, accept, - context); - } - - /** - * Gets a single Adaptive Network Hardening resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single Adaptive Network Hardening resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName) { - return getWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets a single Adaptive Network Hardening resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single Adaptive Network Hardening resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, Context context) { - return getWithResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, context).block(); - } - - /** - * Gets a single Adaptive Network Hardening resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single Adaptive Network Hardening resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AdaptiveNetworkHardeningInner get(String resourceGroupName, String resourceNamespace, String resourceType, - String resourceName, String adaptiveNetworkHardeningResourceName) { - return getWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, Context.NONE).getValue(); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> enforceWithResponseAsync(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, - AdaptiveNetworkHardeningEnforceRequest body) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceNamespace == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); - } - if (resourceType == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (adaptiveNetworkHardeningResourceName == null) { - return Mono.error(new IllegalArgumentException( - "Parameter adaptiveNetworkHardeningResourceName is required and cannot be null.")); - } - if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); - } else { - body.validate(); - } - final String adaptiveNetworkHardeningEnforceAction = "enforce"; - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.enforce(this.client.getEndpoint(), this.client.getSubscriptionId(), - resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, - adaptiveNetworkHardeningEnforceAction, apiVersion, body, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> enforceWithResponseAsync(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, - AdaptiveNetworkHardeningEnforceRequest body, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceNamespace == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null.")); - } - if (resourceType == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceType is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (adaptiveNetworkHardeningResourceName == null) { - return Mono.error(new IllegalArgumentException( - "Parameter adaptiveNetworkHardeningResourceName is required and cannot be null.")); - } - if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); - } else { - body.validate(); - } - final String adaptiveNetworkHardeningEnforceAction = "enforce"; - final String apiVersion = "2020-01-01"; - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.enforce(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, - resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, - adaptiveNetworkHardeningEnforceAction, apiVersion, body, accept, context); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginEnforceAsync(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, - AdaptiveNetworkHardeningEnforceRequest body) { - Mono>> mono = enforceWithResponseAsync(resourceGroupName, resourceNamespace, - resourceType, resourceName, adaptiveNetworkHardeningResourceName, body); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginEnforceAsync(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, - AdaptiveNetworkHardeningEnforceRequest body, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = enforceWithResponseAsync(resourceGroupName, resourceNamespace, - resourceType, resourceName, adaptiveNetworkHardeningResourceName, body, context); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginEnforce(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, - AdaptiveNetworkHardeningEnforceRequest body) { - return this - .beginEnforceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, body) - .getSyncPoller(); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginEnforce(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, - AdaptiveNetworkHardeningEnforceRequest body, Context context) { - return this - .beginEnforceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, body, context) - .getSyncPoller(); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono enforceAsync(String resourceGroupName, String resourceNamespace, String resourceType, - String resourceName, String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body) { - return beginEnforceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, body).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono enforceAsync(String resourceGroupName, String resourceNamespace, String resourceType, - String resourceName, String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body, - Context context) { - return beginEnforceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, body, context).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void enforce(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, - String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body) { - enforceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, body).block(); - } - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void enforce(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, - String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body, Context context) { - enforceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, body, context).block(); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response for ListAdaptiveNetworkHardenings API service call along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByExtendedResourceNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByExtendedResourceNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return response for ListAdaptiveNetworkHardenings API service call along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByExtendedResourceNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByExtendedResourceNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsImpl.java deleted file mode 100644 index 4dfb2a246a57..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdaptiveNetworkHardeningsImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.security.fluent.AdaptiveNetworkHardeningsClient; -import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; -import com.azure.resourcemanager.security.models.AdaptiveNetworkHardening; -import com.azure.resourcemanager.security.models.AdaptiveNetworkHardeningEnforceRequest; -import com.azure.resourcemanager.security.models.AdaptiveNetworkHardenings; - -public final class AdaptiveNetworkHardeningsImpl implements AdaptiveNetworkHardenings { - private static final ClientLogger LOGGER = new ClientLogger(AdaptiveNetworkHardeningsImpl.class); - - private final AdaptiveNetworkHardeningsClient innerClient; - - private final com.azure.resourcemanager.security.SecurityManager serviceManager; - - public AdaptiveNetworkHardeningsImpl(AdaptiveNetworkHardeningsClient innerClient, - com.azure.resourcemanager.security.SecurityManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable listByExtendedResource(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName) { - PagedIterable inner = this.serviceClient() - .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AdaptiveNetworkHardeningImpl(inner1, this.manager())); - } - - public PagedIterable listByExtendedResource(String resourceGroupName, - String resourceNamespace, String resourceType, String resourceName, Context context) { - PagedIterable inner = this.serviceClient() - .listByExtendedResource(resourceGroupName, resourceNamespace, resourceType, resourceName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AdaptiveNetworkHardeningImpl(inner1, this.manager())); - } - - public Response getWithResponse(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, Context context) { - Response inner = this.serviceClient() - .getWithResponse(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new AdaptiveNetworkHardeningImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public AdaptiveNetworkHardening get(String resourceGroupName, String resourceNamespace, String resourceType, - String resourceName, String adaptiveNetworkHardeningResourceName) { - AdaptiveNetworkHardeningInner inner = this.serviceClient() - .get(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName); - if (inner != null) { - return new AdaptiveNetworkHardeningImpl(inner, this.manager()); - } else { - return null; - } - } - - public void enforce(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, - String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body) { - this.serviceClient() - .enforce(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, body); - } - - public void enforce(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, - String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body, Context context) { - this.serviceClient() - .enforce(resourceGroupName, resourceNamespace, resourceType, resourceName, - adaptiveNetworkHardeningResourceName, body, context); - } - - private AdaptiveNetworkHardeningsClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.security.SecurityManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsImpl.java index 85fd02f5b3ae..f16d95c1fbe2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AdvancedThreatProtectionsImpl.java @@ -10,8 +10,8 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.AdvancedThreatProtectionsClient; import com.azure.resourcemanager.security.fluent.models.AdvancedThreatProtectionSettingInner; -import com.azure.resourcemanager.security.models.AdvancedThreatProtections; import com.azure.resourcemanager.security.models.AdvancedThreatProtectionSetting; +import com.azure.resourcemanager.security.models.AdvancedThreatProtections; public final class AdvancedThreatProtectionsImpl implements AdvancedThreatProtections { private static final ClientLogger LOGGER = new ClientLogger(AdvancedThreatProtectionsImpl.class); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsClientImpl.java index 3aabd1ad5c27..e0df17af14ba 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsClientImpl.java @@ -2320,9 +2320,7 @@ public void simulate(String ascLocation, AlertSimulatorRequestBody alertSimulato /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2347,9 +2345,7 @@ private Mono> listNextSinglePageAsync(String nextLink) /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2375,9 +2371,7 @@ private Mono> listNextSinglePageAsync(String nextLink, /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2404,9 +2398,7 @@ private Mono> listByResourceGroupNextSinglePageAsync(S /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2432,9 +2424,7 @@ private Mono> listByResourceGroupNextSinglePageAsync(S /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2460,9 +2450,7 @@ private Mono> listSubscriptionLevelByRegionNextSingleP /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -2489,9 +2477,7 @@ private Mono> listSubscriptionLevelByRegionNextSingleP /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2517,9 +2503,7 @@ private Mono> listResourceGroupLevelByRegionNextSingle /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsImpl.java index ae319b2fb151..9f38bcef7b92 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsImpl.java @@ -12,8 +12,8 @@ import com.azure.resourcemanager.security.fluent.AlertsClient; import com.azure.resourcemanager.security.fluent.models.AlertInner; import com.azure.resourcemanager.security.models.Alert; -import com.azure.resourcemanager.security.models.Alerts; import com.azure.resourcemanager.security.models.AlertSimulatorRequestBody; +import com.azure.resourcemanager.security.models.Alerts; public final class AlertsImpl implements Alerts { private static final ClientLogger LOGGER = new ClientLogger(AlertsImpl.class); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java index 838c7900c7d5..145734ce7209 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AlertsSuppressionRulesClientImpl.java @@ -586,9 +586,7 @@ public void delete(String alertsSuppressionRuleName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -614,9 +612,7 @@ private Mono> listNextSinglePageAsync( /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsClientImpl.java index b0d4918e8229..117dd00e903c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AllowedConnectionsClientImpl.java @@ -512,9 +512,7 @@ public AllowedConnectionsResourceInner get(String resourceGroupName, String ascL /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -540,9 +538,7 @@ private Mono> listNextSinglePageA /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -570,9 +566,7 @@ private Mono> listNextSinglePageA /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -599,9 +593,7 @@ private Mono> listByHomeRegionNex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionsClientImpl.java index 32347f459c68..1edb49e9f830 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApiCollectionsClientImpl.java @@ -1195,9 +1195,7 @@ public void offboardAzureApiManagementApi(String resourceGroupName, String servi /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1225,9 +1223,7 @@ private Mono> listBySubscriptionNextSinglePage /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1255,9 +1251,7 @@ private Mono> listBySubscriptionNextSinglePage /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1285,9 +1279,7 @@ private Mono> listByResourceGroupNextSinglePag /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1315,9 +1307,7 @@ private Mono> listByResourceGroupNextSinglePag /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1346,9 +1336,7 @@ private Mono> listByResourceGroupNextSinglePag /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsClientImpl.java index e7e74aa37789..cc4a9e98d4ba 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ApplicationsClientImpl.java @@ -194,9 +194,7 @@ public PagedIterable list(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -222,9 +220,7 @@ private Mono> listNextSinglePageAsync(String nex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsClientImpl.java index fe1d978241cf..9b63d28ebdfd 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsClientImpl.java @@ -599,9 +599,7 @@ public void delete(String resourceId, String assessmentName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -627,9 +625,7 @@ private Mono> listNextSinglePageA /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasClientImpl.java index dcbe2515b0a4..2f0395e28342 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AssessmentsMetadatasClientImpl.java @@ -807,9 +807,7 @@ public void deleteInSubscription(String assessmentMetadataName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -836,9 +834,7 @@ private Mono> listNextSin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -866,9 +862,7 @@ private Mono> listNextSin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -898,9 +892,7 @@ private Mono> listNextSin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsClientImpl.java index d5562f17e13f..76b6435ce763 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutoProvisioningSettingsClientImpl.java @@ -435,9 +435,7 @@ public AutoProvisioningSettingInner create(String settingName, AutoProvisioningS /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -463,9 +461,7 @@ private Mono> listNextSinglePageAsyn /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java index b2701ff23fdc..366f73f1c391 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsClientImpl.java @@ -1095,9 +1095,7 @@ public AutomationValidationStatusInner validate(String resourceGroupName, String /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1123,9 +1121,7 @@ private Mono> listNextSinglePageAsync(String next /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1152,9 +1148,7 @@ private Mono> listNextSinglePageAsync(String next /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1182,9 +1176,7 @@ private Mono> listByResourceGroupNextSinglePageAs /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java index 1eee155f0c1b..e76dfb3dd1cb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AutomationsImpl.java @@ -13,8 +13,8 @@ import com.azure.resourcemanager.security.fluent.models.AutomationInner; import com.azure.resourcemanager.security.fluent.models.AutomationValidationStatusInner; import com.azure.resourcemanager.security.models.Automation; -import com.azure.resourcemanager.security.models.Automations; import com.azure.resourcemanager.security.models.AutomationValidationStatus; +import com.azure.resourcemanager.security.models.Automations; public final class AutomationsImpl implements Automations { private static final ClientLogger LOGGER = new ClientLogger(AutomationsImpl.class); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsClientImpl.java index 1953083741b1..97ca4a1d6b77 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsOrgsClientImpl.java @@ -164,7 +164,7 @@ private Mono> listAvailableWithRespons return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.listAvailable(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -203,7 +203,7 @@ private Mono> listAvailableWithRespons return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.listAvailable(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -289,7 +289,7 @@ private Mono> listSinglePageAsync(String reso return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -330,7 +330,7 @@ private Mono> listSinglePageAsync(String reso return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -439,7 +439,7 @@ private Mono> getWithResponseAsync(String resource if (orgName == null) { return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -481,7 +481,7 @@ private Mono> getWithResponseAsync(String resource if (orgName == null) { return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -578,7 +578,7 @@ private Mono>> createOrUpdateWithResponseAsync(String } else { azureDevOpsOrg.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -626,7 +626,7 @@ private Mono>> createOrUpdateWithResponseAsync(String } else { azureDevOpsOrg.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -834,7 +834,7 @@ private Mono>> updateWithResponseAsync(String resource } else { azureDevOpsOrg.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -882,7 +882,7 @@ private Mono>> updateWithResponseAsync(String resource } else { azureDevOpsOrg.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -1050,9 +1050,7 @@ public AzureDevOpsOrgInner update(String resourceGroupName, String securityConne /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1078,9 +1076,7 @@ private Mono> listNextSinglePageAsync(String /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectsClientImpl.java index 262be7dd5152..9417e3f734e1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsProjectsClientImpl.java @@ -158,7 +158,7 @@ private Mono> listSinglePageAsync(String if (orgName == null) { return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -203,7 +203,7 @@ private Mono> listSinglePageAsync(String if (orgName == null) { return Mono.error(new IllegalArgumentException("Parameter orgName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -322,7 +322,7 @@ private Mono> getWithResponseAsync(String reso if (projectName == null) { return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -368,7 +368,7 @@ private Mono> getWithResponseAsync(String reso if (projectName == null) { return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -475,7 +475,7 @@ private Mono>> createOrUpdateWithResponseAsync(String } else { azureDevOpsProject.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -530,7 +530,7 @@ private Mono>> createOrUpdateWithResponseAsync(String } else { azureDevOpsProject.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -759,7 +759,7 @@ private Mono>> updateWithResponseAsync(String resource } else { azureDevOpsProject.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext( @@ -814,7 +814,7 @@ private Mono>> updateWithResponseAsync(String resource } else { azureDevOpsProject.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -1000,9 +1000,7 @@ public AzureDevOpsProjectInner update(String resourceGroupName, String securityC /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1028,9 +1026,7 @@ private Mono> listNextSinglePageAsync(Str /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsReposClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsReposClientImpl.java index c4f48f74afad..43bbacc4aed1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsReposClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/AzureDevOpsReposClientImpl.java @@ -165,7 +165,7 @@ private Mono> listSinglePageAsync(Stri if (projectName == null) { return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -214,7 +214,7 @@ private Mono> listSinglePageAsync(Stri if (projectName == null) { return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -343,7 +343,7 @@ private Mono> getWithResponseAsync(String r if (repoName == null) { return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -393,7 +393,7 @@ private Mono> getWithResponseAsync(String r if (repoName == null) { return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -510,7 +510,7 @@ private Mono>> createOrUpdateWithResponseAsync(String } else { azureDevOpsRepository.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -569,7 +569,7 @@ private Mono>> createOrUpdateWithResponseAsync(String } else { azureDevOpsRepository.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -813,7 +813,7 @@ private Mono>> updateWithResponseAsync(String resource } else { azureDevOpsRepository.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -872,7 +872,7 @@ private Mono>> updateWithResponseAsync(String resource } else { azureDevOpsRepository.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -1069,9 +1069,7 @@ public AzureDevOpsRepositoryInner update(String resourceGroupName, String securi /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1097,9 +1095,7 @@ private Mono> listNextSinglePageAsync( /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsClientImpl.java index da654a6b037d..1409b6b9ba75 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ComplianceResultsClientImpl.java @@ -321,9 +321,7 @@ public ComplianceResultInner get(String resourceId, String complianceResultName) /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -349,9 +347,7 @@ private Mono> listNextSinglePageAsync(Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesClientImpl.java index bf5115ad78b8..5bd85496d03e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CompliancesClientImpl.java @@ -320,9 +320,7 @@ public ComplianceInner get(String scope, String complianceName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -348,9 +346,7 @@ private Mono> listNextSinglePageAsync(String next /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java index ff131b2b5d35..53a815f6fc9d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsClientImpl.java @@ -558,9 +558,7 @@ public void delete(String connectorName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -586,9 +584,7 @@ private Mono> listNextSinglePageAsync(Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java index a31a8528acda..b0fc9d20799e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ConnectorsImpl.java @@ -11,8 +11,8 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.ConnectorsClient; import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; -import com.azure.resourcemanager.security.models.Connectors; import com.azure.resourcemanager.security.models.ConnectorSetting; +import com.azure.resourcemanager.security.models.Connectors; public final class ConnectorsImpl implements Connectors { private static final ClientLogger LOGGER = new ClientLogger(ConnectorsImpl.class); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsClientImpl.java index e5169ac0da7f..bcf9d01be2f2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomAssessmentAutomationsClientImpl.java @@ -853,9 +853,7 @@ public PagedIterable list(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -884,9 +882,7 @@ public PagedIterable list(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -914,9 +910,7 @@ private Mono> listByResourceGroup /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -945,9 +939,7 @@ private Mono> listByResourceGroup /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsClientImpl.java index b41e3b2200f1..04ab482cf3ad 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomEntityStoreAssignmentsClientImpl.java @@ -850,9 +850,7 @@ public PagedIterable list(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -881,9 +879,7 @@ public PagedIterable list(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -911,9 +907,7 @@ public PagedIterable list(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -942,9 +936,7 @@ public PagedIterable list(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationImpl.java new file mode 100644 index 000000000000..b2af11290562 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.CustomRecommendationInner; +import com.azure.resourcemanager.security.models.CustomRecommendation; +import com.azure.resourcemanager.security.models.RecommendationSupportedClouds; +import com.azure.resourcemanager.security.models.SecurityIssue; +import com.azure.resourcemanager.security.models.SeverityEnum; +import java.util.Collections; +import java.util.List; + +public final class CustomRecommendationImpl + implements CustomRecommendation, CustomRecommendation.Definition, CustomRecommendation.Update { + private CustomRecommendationInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String query() { + return this.innerModel().query(); + } + + public List cloudProviders() { + List inner = this.innerModel().cloudProviders(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SeverityEnum severity() { + return this.innerModel().severity(); + } + + public SecurityIssue securityIssue() { + return this.innerModel().securityIssue(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String remediationDescription() { + return this.innerModel().remediationDescription(); + } + + public String assessmentKey() { + return this.innerModel().assessmentKey(); + } + + public CustomRecommendationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String scope; + + private String customRecommendationName; + + public CustomRecommendationImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public CustomRecommendation create() { + this.innerObject = serviceManager.serviceClient() + .getCustomRecommendations() + .createOrUpdateWithResponse(scope, customRecommendationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public CustomRecommendation create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCustomRecommendations() + .createOrUpdateWithResponse(scope, customRecommendationName, this.innerModel(), context) + .getValue(); + return this; + } + + CustomRecommendationImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new CustomRecommendationInner(); + this.serviceManager = serviceManager; + this.customRecommendationName = name; + } + + public CustomRecommendationImpl update() { + return this; + } + + public CustomRecommendation apply() { + this.innerObject = serviceManager.serviceClient() + .getCustomRecommendations() + .createOrUpdateWithResponse(scope, customRecommendationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public CustomRecommendation apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCustomRecommendations() + .createOrUpdateWithResponse(scope, customRecommendationName, this.innerModel(), context) + .getValue(); + return this; + } + + CustomRecommendationImpl(CustomRecommendationInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", "scope"); + this.customRecommendationName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", + "customRecommendationName"); + } + + public CustomRecommendation refresh() { + this.innerObject = serviceManager.serviceClient() + .getCustomRecommendations() + .getWithResponse(scope, customRecommendationName, Context.NONE) + .getValue(); + return this; + } + + public CustomRecommendation refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCustomRecommendations() + .getWithResponse(scope, customRecommendationName, context) + .getValue(); + return this; + } + + public CustomRecommendationImpl withQuery(String query) { + this.innerModel().withQuery(query); + return this; + } + + public CustomRecommendationImpl withCloudProviders(List cloudProviders) { + this.innerModel().withCloudProviders(cloudProviders); + return this; + } + + public CustomRecommendationImpl withSeverity(SeverityEnum severity) { + this.innerModel().withSeverity(severity); + return this; + } + + public CustomRecommendationImpl withSecurityIssue(SecurityIssue securityIssue) { + this.innerModel().withSecurityIssue(securityIssue); + return this; + } + + public CustomRecommendationImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public CustomRecommendationImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public CustomRecommendationImpl withRemediationDescription(String remediationDescription) { + this.innerModel().withRemediationDescription(remediationDescription); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationsClientImpl.java new file mode 100644 index 000000000000..a9cd5e36890c --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationsClientImpl.java @@ -0,0 +1,698 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.security.fluent.CustomRecommendationsClient; +import com.azure.resourcemanager.security.fluent.models.CustomRecommendationInner; +import com.azure.resourcemanager.security.models.CustomRecommendationsList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CustomRecommendationsClient. + */ +public final class CustomRecommendationsClientImpl implements CustomRecommendationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CustomRecommendationsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of CustomRecommendationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CustomRecommendationsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(CustomRecommendationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterCustomRecommendations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterCustom") + public interface CustomRecommendationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/customRecommendations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("customRecommendationName") String customRecommendationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("customRecommendationName") String customRecommendationName, + @BodyParam("application/json") CustomRecommendationInner customRecommendationBody, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("scope") String scope, @PathParam("customRecommendationName") String customRecommendationName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, scope, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); + } + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, + String customRecommendationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (customRecommendationName == null) { + return Mono.error( + new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, + String customRecommendationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (customRecommendationName == null) { + return Mono.error( + new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, accept, context); + } + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String customRecommendationName) { + return getWithResponseAsync(scope, customRecommendationName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String customRecommendationName, + Context context) { + return getWithResponseAsync(scope, customRecommendationName, context).block(); + } + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomRecommendationInner get(String scope, String customRecommendationName) { + return getWithResponse(scope, customRecommendationName, Context.NONE).getValue(); + } + + /** + * Creates or updates a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param customRecommendationBody Custom Recommendation body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Recommendation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, + String customRecommendationName, CustomRecommendationInner customRecommendationBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (customRecommendationName == null) { + return Mono.error( + new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); + } + if (customRecommendationBody == null) { + return Mono.error( + new IllegalArgumentException("Parameter customRecommendationBody is required and cannot be null.")); + } else { + customRecommendationBody.validate(); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, + customRecommendationName, customRecommendationBody, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param customRecommendationBody Custom Recommendation body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Recommendation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, + String customRecommendationName, CustomRecommendationInner customRecommendationBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (customRecommendationName == null) { + return Mono.error( + new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); + } + if (customRecommendationBody == null) { + return Mono.error( + new IllegalArgumentException("Parameter customRecommendationBody is required and cannot be null.")); + } else { + customRecommendationBody.validate(); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, + customRecommendationBody, accept, context); + } + + /** + * Creates or updates a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param customRecommendationBody Custom Recommendation body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Recommendation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String scope, String customRecommendationName, + CustomRecommendationInner customRecommendationBody) { + return createOrUpdateWithResponseAsync(scope, customRecommendationName, customRecommendationBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param customRecommendationBody Custom Recommendation body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Recommendation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String scope, String customRecommendationName, + CustomRecommendationInner customRecommendationBody, Context context) { + return createOrUpdateWithResponseAsync(scope, customRecommendationName, customRecommendationBody, context) + .block(); + } + + /** + * Creates or updates a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param customRecommendationBody Custom Recommendation body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom Recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomRecommendationInner createOrUpdate(String scope, String customRecommendationName, + CustomRecommendationInner customRecommendationBody) { + return createOrUpdateWithResponse(scope, customRecommendationName, customRecommendationBody, Context.NONE) + .getValue(); + } + + /** + * Delete a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, String customRecommendationName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (customRecommendationName == null) { + return Mono.error( + new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, scope, + customRecommendationName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, String customRecommendationName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (customRecommendationName == null) { + return Mono.error( + new IllegalArgumentException("Parameter customRecommendationName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, scope, customRecommendationName, accept, context); + } + + /** + * Delete a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope, String customRecommendationName) { + return deleteWithResponseAsync(scope, customRecommendationName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String scope, String customRecommendationName, Context context) { + return deleteWithResponseAsync(scope, customRecommendationName, context).block(); + } + + /** + * Delete a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope, String customRecommendationName) { + deleteWithResponse(scope, customRecommendationName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Custom Recommendations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationsImpl.java new file mode 100644 index 000000000000..0f06b04bd943 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/CustomRecommendationsImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.CustomRecommendationsClient; +import com.azure.resourcemanager.security.fluent.models.CustomRecommendationInner; +import com.azure.resourcemanager.security.models.CustomRecommendation; +import com.azure.resourcemanager.security.models.CustomRecommendations; + +public final class CustomRecommendationsImpl implements CustomRecommendations { + private static final ClientLogger LOGGER = new ClientLogger(CustomRecommendationsImpl.class); + + private final CustomRecommendationsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public CustomRecommendationsImpl(CustomRecommendationsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CustomRecommendationImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CustomRecommendationImpl(inner1, this.manager())); + } + + public Response getWithResponse(String scope, String customRecommendationName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(scope, customRecommendationName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CustomRecommendationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CustomRecommendation get(String scope, String customRecommendationName) { + CustomRecommendationInner inner = this.serviceClient().get(scope, customRecommendationName); + if (inner != null) { + return new CustomRecommendationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String scope, String customRecommendationName, + Context context) { + return this.serviceClient().deleteWithResponse(scope, customRecommendationName, context); + } + + public void deleteByResourceGroup(String scope, String customRecommendationName) { + this.serviceClient().delete(scope, customRecommendationName); + } + + public CustomRecommendation getById(String id) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String customRecommendationName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", + "customRecommendationName"); + if (customRecommendationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'customRecommendations'.", id))); + } + return this.getWithResponse(scope, customRecommendationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String customRecommendationName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", + "customRecommendationName"); + if (customRecommendationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'customRecommendations'.", id))); + } + return this.getWithResponse(scope, customRecommendationName, context); + } + + public void deleteById(String id) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String customRecommendationName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", + "customRecommendationName"); + if (customRecommendationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'customRecommendations'.", id))); + } + this.deleteByResourceGroupWithResponse(scope, customRecommendationName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String customRecommendationName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}", + "customRecommendationName"); + if (customRecommendationName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'customRecommendations'.", id))); + } + return this.deleteByResourceGroupWithResponse(scope, customRecommendationName, context); + } + + private CustomRecommendationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public CustomRecommendationImpl define(String name) { + return new CustomRecommendationImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStorageSettingImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStorageSettingImpl.java index 9d0552b99d53..b62ddb109c7a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStorageSettingImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStorageSettingImpl.java @@ -4,10 +4,12 @@ package com.azure.resourcemanager.security.implementation; +import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner; import com.azure.resourcemanager.security.models.DefenderForStorageSetting; -import com.azure.resourcemanager.security.models.OperationStatus; +import com.azure.resourcemanager.security.models.DefenderForStorageSettingProperties; +import com.azure.resourcemanager.security.models.MalwareScan; import com.azure.resourcemanager.security.models.SettingName; public final class DefenderForStorageSettingImpl @@ -34,36 +36,8 @@ public String type() { return this.innerModel().type(); } - public Boolean isEnabled() { - return this.innerModel().isEnabled(); - } - - public Boolean overrideSubscriptionLevelSettings() { - return this.innerModel().overrideSubscriptionLevelSettings(); - } - - public String scanResultsEventGridTopicResourceId() { - return this.innerModel().scanResultsEventGridTopicResourceId(); - } - - public OperationStatus operationStatus() { - return this.innerModel().operationStatus(); - } - - public Boolean isEnabledMalwareScanningIsEnabled() { - return this.innerModel().isEnabledMalwareScanningIsEnabled(); - } - - public Integer capGBPerMonth() { - return this.innerModel().capGBPerMonth(); - } - - public Boolean isEnabledSensitiveDataDiscoveryIsEnabled() { - return this.innerModel().isEnabledSensitiveDataDiscoveryIsEnabled(); - } - - public OperationStatus operationStatusSensitiveDataDiscoveryOperationStatus() { - return this.innerModel().operationStatusSensitiveDataDiscoveryOperationStatus(); + public DefenderForStorageSettingProperties properties() { + return this.innerModel().properties(); } public DefenderForStorageSettingInner innerModel() { @@ -121,37 +95,16 @@ public DefenderForStorageSetting refresh(Context context) { return this; } - public DefenderForStorageSettingImpl withIsEnabled(Boolean isEnabled) { - this.innerModel().withIsEnabled(isEnabled); - return this; - } - - public DefenderForStorageSettingImpl - withOverrideSubscriptionLevelSettings(Boolean overrideSubscriptionLevelSettings) { - this.innerModel().withOverrideSubscriptionLevelSettings(overrideSubscriptionLevelSettings); - return this; - } - - public DefenderForStorageSettingImpl - withScanResultsEventGridTopicResourceId(String scanResultsEventGridTopicResourceId) { - this.innerModel().withScanResultsEventGridTopicResourceId(scanResultsEventGridTopicResourceId); - return this; - } - - public DefenderForStorageSettingImpl - withIsEnabledMalwareScanningIsEnabled(Boolean isEnabledMalwareScanningIsEnabled) { - this.innerModel().withIsEnabledMalwareScanningIsEnabled(isEnabledMalwareScanningIsEnabled); - return this; + public Response startMalwareScanWithResponse(Context context) { + return serviceManager.defenderForStorages().startMalwareScanWithResponse(resourceId, settingName, context); } - public DefenderForStorageSettingImpl withCapGBPerMonth(Integer capGBPerMonth) { - this.innerModel().withCapGBPerMonth(capGBPerMonth); - return this; + public MalwareScan startMalwareScan() { + return serviceManager.defenderForStorages().startMalwareScan(resourceId, settingName); } - public DefenderForStorageSettingImpl - withIsEnabledSensitiveDataDiscoveryIsEnabled(Boolean isEnabledSensitiveDataDiscoveryIsEnabled) { - this.innerModel().withIsEnabledSensitiveDataDiscoveryIsEnabled(isEnabledSensitiveDataDiscoveryIsEnabled); + public DefenderForStorageSettingImpl withProperties(DefenderForStorageSettingProperties properties) { + this.innerModel().withProperties(properties); return this; } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesClientImpl.java index 8e825be60930..4fa38711b410 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesClientImpl.java @@ -12,6 +12,7 @@ import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; @@ -25,6 +26,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.DefenderForStoragesClient; import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner; +import com.azure.resourcemanager.security.fluent.models.MalwareScanInner; import com.azure.resourcemanager.security.models.SettingName; import reactor.core.publisher.Mono; @@ -79,6 +81,35 @@ Mono> create(@HostParam("$host") String @PathParam("settingName") SettingName settingName, @BodyParam("application/json") DefenderForStorageSettingInner defenderForStorageSetting, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/startMalwareScan") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> startMalwareScan(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingName settingName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}/cancelMalwareScan") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelMalwareScan(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingName settingName, @PathParam("scanId") String scanId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMalwareScan(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("settingName") SettingName settingName, @PathParam("scanId") String scanId, + @HeaderParam("Accept") String accept, Context context); } /** @@ -105,7 +136,7 @@ private Mono> getWithResponseAsync(Stri if (settingName == null) { return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); } - final String apiVersion = "2022-12-01-preview"; + final String apiVersion = "2024-10-01-preview"; final String accept = "application/json"; return FluxUtil .withContext( @@ -138,7 +169,7 @@ private Mono> getWithResponseAsync(Stri if (settingName == null) { return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); } - final String apiVersion = "2022-12-01-preview"; + final String apiVersion = "2024-10-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, context); @@ -222,7 +253,7 @@ private Mono> createWithResponseAsync(S } else { defenderForStorageSetting.validate(); } - final String apiVersion = "2022-12-01-preview"; + final String apiVersion = "2024-10-01-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, @@ -261,7 +292,7 @@ private Mono> createWithResponseAsync(S } else { defenderForStorageSetting.validate(); } - final String apiVersion = "2022-12-01-preview"; + final String apiVersion = "2024-10-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.create(this.client.getEndpoint(), apiVersion, resourceId, settingName, defenderForStorageSetting, @@ -320,4 +351,363 @@ public DefenderForStorageSettingInner create(String resourceId, SettingName sett DefenderForStorageSettingInner defenderForStorageSetting) { return createWithResponse(resourceId, settingName, defenderForStorageSetting, Context.NONE).getValue(); } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startMalwareScanWithResponseAsync(String resourceId, + SettingName settingName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2024-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.startMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, + settingName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startMalwareScanWithResponseAsync(String resourceId, + SettingName settingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + final String apiVersion = "2024-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.startMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, settingName, accept, + context); + } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startMalwareScanAsync(String resourceId, SettingName settingName) { + return startMalwareScanWithResponseAsync(resourceId, settingName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startMalwareScanWithResponse(String resourceId, SettingName settingName, + Context context) { + return startMalwareScanWithResponseAsync(resourceId, settingName, context).block(); + } + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MalwareScanInner startMalwareScan(String resourceId, SettingName settingName) { + return startMalwareScanWithResponse(resourceId, settingName, Context.NONE).getValue(); + } + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelMalwareScanWithResponseAsync(String resourceId, + SettingName settingName, String scanId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + final String apiVersion = "2024-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.cancelMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, + settingName, scanId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelMalwareScanWithResponseAsync(String resourceId, + SettingName settingName, String scanId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + final String apiVersion = "2024-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.cancelMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, settingName, scanId, accept, + context); + } + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelMalwareScanAsync(String resourceId, SettingName settingName, String scanId) { + return cancelMalwareScanWithResponseAsync(resourceId, settingName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelMalwareScanWithResponse(String resourceId, SettingName settingName, + String scanId, Context context) { + return cancelMalwareScanWithResponseAsync(resourceId, settingName, scanId, context).block(); + } + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MalwareScanInner cancelMalwareScan(String resourceId, SettingName settingName, String scanId) { + return cancelMalwareScanWithResponse(resourceId, settingName, scanId, Context.NONE).getValue(); + } + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMalwareScanWithResponseAsync(String resourceId, SettingName settingName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + final String apiVersion = "2024-10-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, + settingName, scanId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMalwareScanWithResponseAsync(String resourceId, SettingName settingName, + String scanId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (settingName == null) { + return Mono.error(new IllegalArgumentException("Parameter settingName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + final String apiVersion = "2024-10-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getMalwareScan(this.client.getEndpoint(), apiVersion, resourceId, settingName, scanId, accept, + context); + } + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMalwareScanAsync(String resourceId, SettingName settingName, String scanId) { + return getMalwareScanWithResponseAsync(resourceId, settingName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMalwareScanWithResponse(String resourceId, SettingName settingName, + String scanId, Context context) { + return getMalwareScanWithResponseAsync(resourceId, settingName, scanId, context).block(); + } + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MalwareScanInner getMalwareScan(String resourceId, SettingName settingName, String scanId) { + return getMalwareScanWithResponse(resourceId, settingName, scanId, Context.NONE).getValue(); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesImpl.java index afa740748fca..442711129edb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DefenderForStoragesImpl.java @@ -10,8 +10,10 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.security.fluent.DefenderForStoragesClient; import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner; -import com.azure.resourcemanager.security.models.DefenderForStorages; +import com.azure.resourcemanager.security.fluent.models.MalwareScanInner; import com.azure.resourcemanager.security.models.DefenderForStorageSetting; +import com.azure.resourcemanager.security.models.DefenderForStorages; +import com.azure.resourcemanager.security.models.MalwareScan; import com.azure.resourcemanager.security.models.SettingName; public final class DefenderForStoragesImpl implements DefenderForStorages { @@ -48,6 +50,69 @@ public DefenderForStorageSetting get(String resourceId, SettingName settingName) } } + public Response startMalwareScanWithResponse(String resourceId, SettingName settingName, + Context context) { + Response inner + = this.serviceClient().startMalwareScanWithResponse(resourceId, settingName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MalwareScanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MalwareScan startMalwareScan(String resourceId, SettingName settingName) { + MalwareScanInner inner = this.serviceClient().startMalwareScan(resourceId, settingName); + if (inner != null) { + return new MalwareScanImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelMalwareScanWithResponse(String resourceId, SettingName settingName, + String scanId, Context context) { + Response inner + = this.serviceClient().cancelMalwareScanWithResponse(resourceId, settingName, scanId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MalwareScanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MalwareScan cancelMalwareScan(String resourceId, SettingName settingName, String scanId) { + MalwareScanInner inner = this.serviceClient().cancelMalwareScan(resourceId, settingName, scanId); + if (inner != null) { + return new MalwareScanImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMalwareScanWithResponse(String resourceId, SettingName settingName, String scanId, + Context context) { + Response inner + = this.serviceClient().getMalwareScanWithResponse(resourceId, settingName, scanId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MalwareScanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MalwareScan getMalwareScan(String resourceId, SettingName settingName, String scanId) { + MalwareScanInner inner = this.serviceClient().getMalwareScan(resourceId, settingName, scanId); + if (inner != null) { + return new MalwareScanImpl(inner, this.manager()); + } else { + return null; + } + } + public DefenderForStorageSetting getById(String id) { String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}", "resourceId"); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsClientImpl.java index 199658ee82da..7a4687319612 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsConfigurationsClientImpl.java @@ -164,7 +164,7 @@ private Mono> listSinglePageAsync(String return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -205,7 +205,7 @@ private Mono> listSinglePageAsync(String return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -310,7 +310,7 @@ private Mono> getWithResponseAsync(String res return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -348,7 +348,7 @@ private Mono> getWithResponseAsync(String res return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -439,7 +439,7 @@ private Mono>> createOrUpdateWithResponseAsync(String } else { devOpsConfiguration.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -484,7 +484,7 @@ private Mono>> createOrUpdateWithResponseAsync(String } else { devOpsConfiguration.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -681,7 +681,7 @@ private Mono>> updateWithResponseAsync(String resource } else { devOpsConfiguration.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -726,7 +726,7 @@ private Mono>> updateWithResponseAsync(String resource } else { devOpsConfiguration.validate(); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -915,7 +915,7 @@ private Mono>> deleteWithResponseAsync(String resource return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -953,7 +953,7 @@ private Mono>> deleteWithResponseAsync(String resource return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -1096,9 +1096,7 @@ public void delete(String resourceGroupName, String securityConnectorName, Conte /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1124,9 +1122,7 @@ private Mono> listNextSinglePageAsync(St /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsClientImpl.java index efe1b368b753..37a673528a2e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsOperationResultsClientImpl.java @@ -104,7 +104,7 @@ private Mono> getWithResponseAsync(String r return Mono .error(new IllegalArgumentException("Parameter operationResultId is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -148,7 +148,7 @@ private Mono> getWithResponseAsync(String r return Mono .error(new IllegalArgumentException("Parameter operationResultId is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPoliciesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPoliciesClientImpl.java new file mode 100644 index 000000000000..08d346c5cdd6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPoliciesClientImpl.java @@ -0,0 +1,454 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.security.fluent.DevOpsPoliciesClient; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyInner; +import com.azure.resourcemanager.security.models.DevOpsPolicyListResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DevOpsPoliciesClient. + */ +public final class DevOpsPoliciesClientImpl implements DevOpsPoliciesClient { + /** + * The proxy service used to perform REST calls. + */ + private final DevOpsPoliciesService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DevOpsPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevOpsPoliciesClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(DevOpsPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDevOpsPolicies to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterDevOps") + public interface DevOpsPoliciesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/policies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("devOpsPolicyType") String devOpsPolicyType, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/policies/{policyName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("policyName") String policyName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName, String devOpsPolicyType) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, devOpsPolicyType, apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName, String devOpsPolicyType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, + devOpsPolicyType, apiVersion, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, devOpsPolicyType), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName) { + final String devOpsPolicyType = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, securityConnectorName, devOpsPolicyType), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, securityConnectorName, devOpsPolicyType, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + final String devOpsPolicyType = null; + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, devOpsPolicyType)); + } + + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, devOpsPolicyType, context)); + } + + /** + * Returns a DevOps Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, policyName, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a DevOps Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, policyName, apiVersion, accept, context); + } + + /** + * Returns a DevOps Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, + String policyName) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, policyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a DevOps Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String policyName, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, policyName, context).block(); + } + + /** + * Returns a DevOps Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsPolicyInner get(String resourceGroupName, String securityConnectorName, String policyName) { + return getWithResponse(resourceGroupName, securityConnectorName, policyName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPoliciesImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPoliciesImpl.java new file mode 100644 index 000000000000..0d738cb1b82b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPoliciesImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DevOpsPoliciesClient; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyInner; +import com.azure.resourcemanager.security.models.DevOpsPolicies; +import com.azure.resourcemanager.security.models.DevOpsPolicy; + +public final class DevOpsPoliciesImpl implements DevOpsPolicies { + private static final ClientLogger LOGGER = new ClientLogger(DevOpsPoliciesImpl.class); + + private final DevOpsPoliciesClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DevOpsPoliciesImpl(DevOpsPoliciesClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, securityConnectorName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DevOpsPolicyImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName, devOpsPolicyType, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DevOpsPolicyImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String policyName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, securityConnectorName, policyName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DevOpsPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DevOpsPolicy get(String resourceGroupName, String securityConnectorName, String policyName) { + DevOpsPolicyInner inner = this.serviceClient().get(resourceGroupName, securityConnectorName, policyName); + if (inner != null) { + return new DevOpsPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + private DevOpsPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentImpl.java new file mode 100644 index 000000000000..dae8ae169b17 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentImpl.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyAssignmentInner; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignment; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignmentProperties; + +public final class DevOpsPolicyAssignmentImpl + implements DevOpsPolicyAssignment, DevOpsPolicyAssignment.Definition, DevOpsPolicyAssignment.Update { + private DevOpsPolicyAssignmentInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public DevOpsPolicyAssignmentProperties properties() { + return this.innerModel().properties(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DevOpsPolicyAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String securityConnectorName; + + private String policyAssignmentId; + + public DevOpsPolicyAssignmentImpl withExistingSecurityConnector(String resourceGroupName, + String securityConnectorName) { + this.resourceGroupName = resourceGroupName; + this.securityConnectorName = securityConnectorName; + return this; + } + + public DevOpsPolicyAssignment create() { + this.innerObject = serviceManager.serviceClient() + .getDevOpsPolicyAssignments() + .createOrUpdate(resourceGroupName, securityConnectorName, policyAssignmentId, this.innerModel(), + Context.NONE); + return this; + } + + public DevOpsPolicyAssignment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDevOpsPolicyAssignments() + .createOrUpdate(resourceGroupName, securityConnectorName, policyAssignmentId, this.innerModel(), context); + return this; + } + + DevOpsPolicyAssignmentImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new DevOpsPolicyAssignmentInner(); + this.serviceManager = serviceManager; + this.policyAssignmentId = name; + } + + public DevOpsPolicyAssignmentImpl update() { + return this; + } + + public DevOpsPolicyAssignment apply() { + this.innerObject = serviceManager.serviceClient() + .getDevOpsPolicyAssignments() + .update(resourceGroupName, securityConnectorName, policyAssignmentId, this.innerModel(), Context.NONE); + return this; + } + + public DevOpsPolicyAssignment apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDevOpsPolicyAssignments() + .update(resourceGroupName, securityConnectorName, policyAssignmentId, this.innerModel(), context); + return this; + } + + DevOpsPolicyAssignmentImpl(DevOpsPolicyAssignmentInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.securityConnectorName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "securityConnectors"); + this.policyAssignmentId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "policyAssignments"); + } + + public DevOpsPolicyAssignment refresh() { + this.innerObject = serviceManager.serviceClient() + .getDevOpsPolicyAssignments() + .getWithResponse(resourceGroupName, securityConnectorName, policyAssignmentId, Context.NONE) + .getValue(); + return this; + } + + public DevOpsPolicyAssignment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDevOpsPolicyAssignments() + .getWithResponse(resourceGroupName, securityConnectorName, policyAssignmentId, context) + .getValue(); + return this; + } + + public DevOpsPolicyAssignmentImpl withProperties(DevOpsPolicyAssignmentProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentsClientImpl.java new file mode 100644 index 000000000000..52cf58bb8f83 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentsClientImpl.java @@ -0,0 +1,1284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.security.fluent.DevOpsPolicyAssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyAssignmentInner; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignmentListResponse; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DevOpsPolicyAssignmentsClient. + */ +public final class DevOpsPolicyAssignmentsClientImpl implements DevOpsPolicyAssignmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final DevOpsPolicyAssignmentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of DevOpsPolicyAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevOpsPolicyAssignmentsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(DevOpsPolicyAssignmentsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterDevOpsPolicyAssignments to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterDevOps") + public interface DevOpsPolicyAssignmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/policyAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @QueryParam("devOpsPolicyType") String devOpsPolicyType, @QueryParam("resourceId") String resourceId, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/policyAssignments/{policyAssignmentId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("policyAssignmentId") String policyAssignmentId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/policyAssignments/{policyAssignmentId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("policyAssignmentId") String policyAssignmentId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DevOpsPolicyAssignmentInner devOpsPolicyAssignment, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/policyAssignments/{policyAssignmentId}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("policyAssignmentId") String policyAssignmentId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DevOpsPolicyAssignmentInner devOpsPolicyAssignment, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/policyAssignments/{policyAssignmentId}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("securityConnectorName") String securityConnectorName, + @PathParam("policyAssignmentId") String policyAssignmentId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns a list of DevOps Policy Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param resourceId Optional filter for listing the assignments of a specific resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName, String devOpsPolicyType, String resourceId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, devOpsPolicyType, resourceId, apiVersion, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a list of DevOps Policy Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param resourceId Optional filter for listing the assignments of a specific resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String securityConnectorName, String devOpsPolicyType, String resourceId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, securityConnectorName, + devOpsPolicyType, resourceId, apiVersion, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Returns a list of DevOps Policy Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param resourceId Optional filter for listing the assignments of a specific resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, String resourceId) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, securityConnectorName, devOpsPolicyType, resourceId), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of DevOps Policy Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName) { + final String devOpsPolicyType = null; + final String resourceId = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, securityConnectorName, devOpsPolicyType, resourceId), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns a list of DevOps Policy Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param resourceId Optional filter for listing the assignments of a specific resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, String resourceId, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, securityConnectorName, devOpsPolicyType, resourceId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns a list of DevOps Policy Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + final String devOpsPolicyType = null; + final String resourceId = null; + return new PagedIterable<>(listAsync(resourceGroupName, securityConnectorName, devOpsPolicyType, resourceId)); + } + + /** + * Returns a list of DevOps Policy Assignments. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param resourceId Optional filter for listing the assignments of a specific resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, String resourceId, Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, securityConnectorName, devOpsPolicyType, resourceId, context)); + } + + /** + * Returns a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, policyAssignmentId, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, policyAssignmentId, apiVersion, accept, context); + } + + /** + * Returns a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String securityConnectorName, + String policyAssignmentId) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, policyAssignmentId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, Context context) { + return getWithResponseAsync(resourceGroupName, securityConnectorName, policyAssignmentId, context).block(); + } + + /** + * Returns a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsPolicyAssignmentInner get(String resourceGroupName, String securityConnectorName, + String policyAssignmentId) { + return getWithResponse(resourceGroupName, securityConnectorName, policyAssignmentId, Context.NONE).getValue(); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + } + if (devOpsPolicyAssignment == null) { + return Mono.error( + new IllegalArgumentException("Parameter devOpsPolicyAssignment is required and cannot be null.")); + } else { + devOpsPolicyAssignment.validate(); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, policyAssignmentId, apiVersion, devOpsPolicyAssignment, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + } + if (devOpsPolicyAssignment == null) { + return Mono.error( + new IllegalArgumentException("Parameter devOpsPolicyAssignment is required and cannot be null.")); + } else { + devOpsPolicyAssignment.validate(); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, policyAssignmentId, apiVersion, devOpsPolicyAssignment, accept, context); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevOpsPolicyAssignmentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + securityConnectorName, policyAssignmentId, devOpsPolicyAssignment); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DevOpsPolicyAssignmentInner.class, DevOpsPolicyAssignmentInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevOpsPolicyAssignmentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + securityConnectorName, policyAssignmentId, devOpsPolicyAssignment, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DevOpsPolicyAssignmentInner.class, DevOpsPolicyAssignmentInner.class, + context); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevOpsPolicyAssignmentInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, + devOpsPolicyAssignment) + .getSyncPoller(); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevOpsPolicyAssignmentInner> beginCreateOrUpdate( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, + devOpsPolicyAssignment, context) + .getSyncPoller(); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, + devOpsPolicyAssignment).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, + devOpsPolicyAssignment, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsPolicyAssignmentInner createOrUpdate(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, devOpsPolicyAssignment) + .block(); + } + + /** + * Creates or updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsPolicyAssignmentInner createOrUpdate(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context) { + return createOrUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, devOpsPolicyAssignment, + context).block(); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + } + if (devOpsPolicyAssignment == null) { + return Mono.error( + new IllegalArgumentException("Parameter devOpsPolicyAssignment is required and cannot be null.")); + } else { + devOpsPolicyAssignment.validate(); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, policyAssignmentId, apiVersion, devOpsPolicyAssignment, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + } + if (devOpsPolicyAssignment == null) { + return Mono.error( + new IllegalArgumentException("Parameter devOpsPolicyAssignment is required and cannot be null.")); + } else { + devOpsPolicyAssignment.validate(); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, policyAssignmentId, apiVersion, devOpsPolicyAssignment, accept, context); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevOpsPolicyAssignmentInner> beginUpdateAsync( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, securityConnectorName, + policyAssignmentId, devOpsPolicyAssignment); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DevOpsPolicyAssignmentInner.class, DevOpsPolicyAssignmentInner.class, + this.client.getContext()); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DevOpsPolicyAssignmentInner> beginUpdateAsync( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, securityConnectorName, + policyAssignmentId, devOpsPolicyAssignment, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DevOpsPolicyAssignmentInner.class, DevOpsPolicyAssignmentInner.class, + context); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevOpsPolicyAssignmentInner> beginUpdate( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + return this + .beginUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, devOpsPolicyAssignment) + .getSyncPoller(); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DevOpsPolicyAssignmentInner> beginUpdate( + String resourceGroupName, String securityConnectorName, String policyAssignmentId, + DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context) { + return this + .beginUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, devOpsPolicyAssignment, + context) + .getSyncPoller(); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, devOpsPolicyAssignment) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context) { + return beginUpdateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, devOpsPolicyAssignment, + context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsPolicyAssignmentInner update(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment) { + return updateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, devOpsPolicyAssignment) + .block(); + } + + /** + * Updates a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param devOpsPolicyAssignment The DevOps Policy Assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy assignment resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DevOpsPolicyAssignmentInner update(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, DevOpsPolicyAssignmentInner devOpsPolicyAssignment, Context context) { + return updateAsync(resourceGroupName, securityConnectorName, policyAssignmentId, devOpsPolicyAssignment, + context).block(); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, securityConnectorName, policyAssignmentId, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String securityConnectorName, String policyAssignmentId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (securityConnectorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); + } + if (policyAssignmentId == null) { + return Mono + .error(new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null.")); + } + final String apiVersion = "2024-05-15-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + securityConnectorName, policyAssignmentId, apiVersion, accept, context); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String securityConnectorName, + String policyAssignmentId) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, securityConnectorName, policyAssignmentId); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, securityConnectorName, policyAssignmentId, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String securityConnectorName, + String policyAssignmentId) { + return this.beginDeleteAsync(resourceGroupName, securityConnectorName, policyAssignmentId).getSyncPoller(); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, Context context) { + return this.beginDeleteAsync(resourceGroupName, securityConnectorName, policyAssignmentId, context) + .getSyncPoller(); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String securityConnectorName, String policyAssignmentId) { + return beginDeleteAsync(resourceGroupName, securityConnectorName, policyAssignmentId).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String securityConnectorName, String policyAssignmentId, + Context context) { + return beginDeleteAsync(resourceGroupName, securityConnectorName, policyAssignmentId, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String securityConnectorName, String policyAssignmentId) { + deleteAsync(resourceGroupName, securityConnectorName, policyAssignmentId).block(); + } + + /** + * Deletes a DevOps Policy Assignment Resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String securityConnectorName, String policyAssignmentId, + Context context) { + deleteAsync(resourceGroupName, securityConnectorName, policyAssignmentId, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentsImpl.java new file mode 100644 index 000000000000..6734f58dfdd6 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyAssignmentsImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.DevOpsPolicyAssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyAssignmentInner; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignment; +import com.azure.resourcemanager.security.models.DevOpsPolicyAssignments; + +public final class DevOpsPolicyAssignmentsImpl implements DevOpsPolicyAssignments { + private static final ClientLogger LOGGER = new ClientLogger(DevOpsPolicyAssignmentsImpl.class); + + private final DevOpsPolicyAssignmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public DevOpsPolicyAssignmentsImpl(DevOpsPolicyAssignmentsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, securityConnectorName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DevOpsPolicyAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, String resourceId, Context context) { + PagedIterable inner = this.serviceClient() + .list(resourceGroupName, securityConnectorName, devOpsPolicyType, resourceId, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DevOpsPolicyAssignmentImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, securityConnectorName, policyAssignmentId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DevOpsPolicyAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DevOpsPolicyAssignment get(String resourceGroupName, String securityConnectorName, + String policyAssignmentId) { + DevOpsPolicyAssignmentInner inner + = this.serviceClient().get(resourceGroupName, securityConnectorName, policyAssignmentId); + if (inner != null) { + return new DevOpsPolicyAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String securityConnectorName, String policyAssignmentId) { + this.serviceClient().delete(resourceGroupName, securityConnectorName, policyAssignmentId); + } + + public void delete(String resourceGroupName, String securityConnectorName, String policyAssignmentId, + Context context) { + this.serviceClient().delete(resourceGroupName, securityConnectorName, policyAssignmentId, context); + } + + public DevOpsPolicyAssignment getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String securityConnectorName = ResourceManagerUtils.getValueFromIdByName(id, "securityConnectors"); + if (securityConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityConnectors'.", id))); + } + String policyAssignmentId = ResourceManagerUtils.getValueFromIdByName(id, "policyAssignments"); + if (policyAssignmentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policyAssignments'.", id))); + } + return this.getWithResponse(resourceGroupName, securityConnectorName, policyAssignmentId, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String securityConnectorName = ResourceManagerUtils.getValueFromIdByName(id, "securityConnectors"); + if (securityConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityConnectors'.", id))); + } + String policyAssignmentId = ResourceManagerUtils.getValueFromIdByName(id, "policyAssignments"); + if (policyAssignmentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policyAssignments'.", id))); + } + return this.getWithResponse(resourceGroupName, securityConnectorName, policyAssignmentId, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String securityConnectorName = ResourceManagerUtils.getValueFromIdByName(id, "securityConnectors"); + if (securityConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityConnectors'.", id))); + } + String policyAssignmentId = ResourceManagerUtils.getValueFromIdByName(id, "policyAssignments"); + if (policyAssignmentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policyAssignments'.", id))); + } + this.delete(resourceGroupName, securityConnectorName, policyAssignmentId, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String securityConnectorName = ResourceManagerUtils.getValueFromIdByName(id, "securityConnectors"); + if (securityConnectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityConnectors'.", id))); + } + String policyAssignmentId = ResourceManagerUtils.getValueFromIdByName(id, "policyAssignments"); + if (policyAssignmentId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policyAssignments'.", id))); + } + this.delete(resourceGroupName, securityConnectorName, policyAssignmentId, context); + } + + private DevOpsPolicyAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public DevOpsPolicyAssignmentImpl define(String name) { + return new DevOpsPolicyAssignmentImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyImpl.java new file mode 100644 index 000000000000..bacd17f722a7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DevOpsPolicyImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyInner; +import com.azure.resourcemanager.security.models.DevOpsPolicy; +import com.azure.resourcemanager.security.models.DevOpsPolicyProperties; + +public final class DevOpsPolicyImpl implements DevOpsPolicy { + private DevOpsPolicyInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + DevOpsPolicyImpl(DevOpsPolicyInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public DevOpsPolicyProperties properties() { + return this.innerModel().properties(); + } + + public DevOpsPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsClientImpl.java index c98232e972a1..4d9dc359fb6a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DeviceSecurityGroupsClientImpl.java @@ -595,9 +595,7 @@ public void delete(String resourceId, String deviceSecurityGroupName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -622,9 +620,7 @@ private Mono> listNextSinglePageAsync(St /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsClientImpl.java index a770cf5d2571..ef03c35e4d1c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/DiscoveredSecuritySolutionsClientImpl.java @@ -506,9 +506,7 @@ public DiscoveredSecuritySolutionInner get(String resourceGroupName, String ascL /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -533,9 +531,7 @@ private Mono> listNextSinglePageA /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -562,9 +558,7 @@ private Mono> listNextSinglePageA /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -590,9 +584,7 @@ private Mono> listByHomeRegionNex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsClientImpl.java index 0b806c14a20d..ef067c359ecd 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ExternalSecuritySolutionsClientImpl.java @@ -504,9 +504,7 @@ public ExternalSecuritySolutionInner get(String resourceGroupName, String ascLoc /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -531,9 +529,7 @@ private Mono> listNextSinglePageAsy /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -560,9 +556,7 @@ private Mono> listNextSinglePageAsy /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -588,9 +582,7 @@ private Mono> listByHomeRegionNextS /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersClientImpl.java index 132005c72852..f1df44dc5cf8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubOwnersClientImpl.java @@ -132,7 +132,7 @@ private Mono> listAvailableWithResponseAs return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.listAvailable(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -171,7 +171,7 @@ private Mono> listAvailableWithResponseAs return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.listAvailable(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -257,7 +257,7 @@ private Mono> listSinglePageAsync(String resourc return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -298,7 +298,7 @@ private Mono> listSinglePageAsync(String resourc return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -407,7 +407,7 @@ private Mono> getWithResponseAsync(String resourceGro if (ownerName == null) { return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -449,7 +449,7 @@ private Mono> getWithResponseAsync(String resourceGro if (ownerName == null) { return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -510,9 +510,7 @@ public GitHubOwnerInner get(String resourceGroupName, String securityConnectorNa /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -538,9 +536,7 @@ private Mono> listNextSinglePageAsync(String nex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposClientImpl.java index 5733bfae6856..fdb4c1bf7dfa 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitHubReposClientImpl.java @@ -126,7 +126,7 @@ private Mono> listSinglePageAsync(String re if (ownerName == null) { return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -171,7 +171,7 @@ private Mono> listSinglePageAsync(String re if (ownerName == null) { return Mono.error(new IllegalArgumentException("Parameter ownerName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -290,7 +290,7 @@ private Mono> getWithResponseAsync(String resour if (repoName == null) { return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -336,7 +336,7 @@ private Mono> getWithResponseAsync(String resour if (repoName == null) { return Mono.error(new IllegalArgumentException("Parameter repoName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -402,9 +402,7 @@ public GitHubRepositoryInner get(String resourceGroupName, String securityConnec /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -430,9 +428,7 @@ private Mono> listNextSinglePageAsync(Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsClientImpl.java index 9839637bfa57..604c2842276b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabGroupsClientImpl.java @@ -133,7 +133,7 @@ private Mono> listAvailableWithResponseAs return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.listAvailable(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -172,7 +172,7 @@ private Mono> listAvailableWithResponseAs return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.listAvailable(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -258,7 +258,7 @@ private Mono> listSinglePageAsync(String resourc return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -299,7 +299,7 @@ private Mono> listSinglePageAsync(String resourc return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -408,7 +408,7 @@ private Mono> getWithResponseAsync(String resourceGro if (groupFQName == null) { return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -450,7 +450,7 @@ private Mono> getWithResponseAsync(String resourceGro if (groupFQName == null) { return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -512,9 +512,7 @@ public GitLabGroupInner get(String resourceGroupName, String securityConnectorNa /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -540,9 +538,7 @@ private Mono> listNextSinglePageAsync(String nex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsClientImpl.java index 88c9094fb069..fdc5209d0ed9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabProjectsClientImpl.java @@ -127,7 +127,7 @@ private Mono> listSinglePageAsync(String resou if (groupFQName == null) { return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -172,7 +172,7 @@ private Mono> listSinglePageAsync(String resou if (groupFQName == null) { return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -296,7 +296,7 @@ private Mono> getWithResponseAsync(String resourceG if (projectName == null) { return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -342,7 +342,7 @@ private Mono> getWithResponseAsync(String resourceG if (projectName == null) { return Mono.error(new IllegalArgumentException("Parameter projectName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, @@ -410,9 +410,7 @@ public GitLabProjectInner get(String resourceGroupName, String securityConnector /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -438,9 +436,7 @@ private Mono> listNextSinglePageAsync(String n /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsClientImpl.java index 28133059da9b..7edb6bd323bb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GitLabSubgroupsClientImpl.java @@ -103,7 +103,7 @@ private Mono> listWithResponseAsync(Strin if (groupFQName == null) { return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), @@ -146,7 +146,7 @@ private Mono> listWithResponseAsync(Strin if (groupFQName == null) { return Mono.error(new IllegalArgumentException("Parameter groupFQName is required and cannot be null.")); } - final String apiVersion = "2024-04-01"; + final String apiVersion = "2024-05-15-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentsClientImpl.java index fc42a58cdcdb..7513c0ddc578 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceAssignmentsClientImpl.java @@ -671,9 +671,7 @@ public void delete(String scope, String assessmentName, String assignmentKey) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -699,9 +697,7 @@ private Mono> listNextSinglePageAsync(S /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRulesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRulesClientImpl.java index 9edfb6e6a036..3afd98b23e9b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRulesClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/GovernanceRulesClientImpl.java @@ -1170,9 +1170,7 @@ public OperationResultAutoGeneratedInner operationResults(String scope, String r /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1198,9 +1196,7 @@ private Mono> listNextSinglePageAsync(String /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsClientImpl.java index f1e296fdb557..b3439347d4ec 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/HealthReportsClientImpl.java @@ -326,9 +326,7 @@ public HealthReportInner get(String resourceId, String healthReportName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -353,9 +351,7 @@ private Mono> listNextSinglePageAsync(String ne /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java index 23db3021a2bd..907272011fcd 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/InformationProtectionPoliciesClientImpl.java @@ -487,9 +487,7 @@ public PagedIterable list(String scope, Contex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -515,9 +513,7 @@ private Mono> listNextSinglePage /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsImpl.java index 96fc57c380a9..269039c13994 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionAnalyticsImpl.java @@ -11,9 +11,9 @@ import com.azure.resourcemanager.security.fluent.IotSecuritySolutionAnalyticsClient; import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelInner; import com.azure.resourcemanager.security.fluent.models.IoTSecuritySolutionAnalyticsModelListInner; -import com.azure.resourcemanager.security.models.IotSecuritySolutionAnalytics; import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModel; import com.azure.resourcemanager.security.models.IoTSecuritySolutionAnalyticsModelList; +import com.azure.resourcemanager.security.models.IotSecuritySolutionAnalytics; public final class IotSecuritySolutionAnalyticsImpl implements IotSecuritySolutionAnalytics { private static final ClientLogger LOGGER = new ClientLogger(IotSecuritySolutionAnalyticsImpl.class); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.java index 6fc478c09d4f..fa845b52ee65 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsAggregatedAlertsClientImpl.java @@ -566,9 +566,7 @@ public void dismiss(String resourceGroupName, String solutionName, String aggreg /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -594,9 +592,7 @@ private Mono> listNextSinglePageA /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsClientImpl.java index 05702bd43200..509f2eb5cc46 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsClientImpl.java @@ -422,9 +422,7 @@ public PagedIterable list(String resou /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -451,9 +449,7 @@ private Mono> listNextSi /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsClientImpl.java index 7871cb9408f2..17c1d752af04 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsClientImpl.java @@ -981,9 +981,7 @@ public void delete(String resourceGroupName, String solutionName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1010,9 +1008,7 @@ private Mono> listBySubscriptionNex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1039,9 +1035,7 @@ private Mono> listBySubscriptionNex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1068,9 +1062,7 @@ private Mono> listByResourceGroupNe /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesClientImpl.java index 9d5befbcde10..08e6b4e36e46 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/JitNetworkAccessPoliciesClientImpl.java @@ -1331,9 +1331,7 @@ public JitNetworkAccessRequestInner initiate(String resourceGroupName, String as /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1358,9 +1356,7 @@ private Mono> listNextSinglePageAsync /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1386,9 +1382,7 @@ private Mono> listNextSinglePageAsync /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1414,9 +1408,7 @@ private Mono> listByRegionNextSingleP /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1443,9 +1435,7 @@ private Mono> listByRegionNextSingleP /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1472,9 +1462,7 @@ private Mono> listByResourceGroupNext /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1501,9 +1489,7 @@ private Mono> listByResourceGroupNext /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1530,9 +1516,7 @@ private Mono> listByResourceGroupNext /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsClientImpl.java index c342d7b9fcf5..0d12c312f49f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/LocationsClientImpl.java @@ -320,9 +320,7 @@ public AscLocationInner get(String ascLocation) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -348,9 +346,7 @@ private Mono> listNextSinglePageAsync(String nex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MalwareScanImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MalwareScanImpl.java new file mode 100644 index 000000000000..4c5abf408977 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/MalwareScanImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.resourcemanager.security.fluent.models.MalwareScanInner; +import com.azure.resourcemanager.security.models.MalwareScan; +import com.azure.resourcemanager.security.models.MalwareScanProperties; + +public final class MalwareScanImpl implements MalwareScan { + private MalwareScanInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + MalwareScanImpl(MalwareScanInner innerObject, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public MalwareScanProperties properties() { + return this.innerModel().properties(); + } + + public MalwareScanInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationImpl.java index 9621ea680926..75c220f621c8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationImpl.java @@ -5,8 +5,10 @@ package com.azure.resourcemanager.security.implementation; import com.azure.resourcemanager.security.fluent.models.OperationInner; +import com.azure.resourcemanager.security.models.ActionType; import com.azure.resourcemanager.security.models.Operation; import com.azure.resourcemanager.security.models.OperationDisplay; +import com.azure.resourcemanager.security.models.Origin; public final class OperationImpl implements Operation { private OperationInner innerObject; @@ -22,14 +24,22 @@ public String name() { return this.innerModel().name(); } - public String origin() { - return this.innerModel().origin(); + public Boolean isDataAction() { + return this.innerModel().isDataAction(); } public OperationDisplay display() { return this.innerModel().display(); } + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + public OperationInner innerModel() { return this.innerObject; } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java index ce9ead3feba0..fabc4191bdda 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/OperationsClientImpl.java @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.security.fluent.OperationsClient; import com.azure.resourcemanager.security.fluent.models.OperationInner; -import com.azure.resourcemanager.security.models.OperationList; +import com.azure.resourcemanager.security.models.OperationListResult; import reactor.core.publisher.Mono; /** @@ -66,14 +66,14 @@ public interface OperationsService { @Get("/providers/Microsoft.Security/operations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } @@ -82,7 +82,7 @@ Mono> listNext(@PathParam(value = "nextLink", encoded = * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider along with {@link PagedResponse} on + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -91,7 +91,7 @@ private Mono> listSinglePageAsync() { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - final String apiVersion = "2015-06-01-preview"; + final String apiVersion = "2024-10-01-preview"; final String accept = "application/json"; return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), @@ -106,7 +106,7 @@ private Mono> listSinglePageAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider along with {@link PagedResponse} on + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -115,7 +115,7 @@ private Mono> listSinglePageAsync(Context context) return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); } - final String apiVersion = "2015-06-01-preview"; + final String apiVersion = "2024-10-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.list(this.client.getEndpoint(), apiVersion, accept, context) @@ -128,7 +128,7 @@ private Mono> listSinglePageAsync(Context context) * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider as paginated response with + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -143,7 +143,7 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider as paginated response with + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -157,7 +157,7 @@ private PagedFlux listAsync(Context context) { * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider as paginated response with + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -172,7 +172,7 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider as paginated response with + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -183,13 +183,11 @@ public PagedIterable list(Context context) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider along with {@link PagedResponse} on + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -211,14 +209,12 @@ private Mono> listNextSinglePageAsync(String nextL /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of possible operations for Microsoft.Security resource provider along with {@link PagedResponse} on + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java index 4eb1f4ac74d2..b078f836e8ad 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceAssessmentsClientImpl.java @@ -418,9 +418,7 @@ public RegulatoryComplianceAssessmentInner get(String regulatoryComplianceStanda /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -446,9 +444,7 @@ private Mono> listNextSingleP /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java index 96e7ae2abab0..31ff14d5522d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceControlsClientImpl.java @@ -376,9 +376,7 @@ public RegulatoryComplianceControlInner get(String regulatoryComplianceStandardN /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -404,9 +402,7 @@ private Mono> listNextSinglePage /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java index 5682fe203485..dd500ef10426 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/RegulatoryComplianceStandardsClientImpl.java @@ -332,9 +332,7 @@ public RegulatoryComplianceStandardInner get(String regulatoryComplianceStandard /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -360,9 +358,7 @@ private Mono> listNextSinglePag /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsClientImpl.java index 162e49e2dd06..7428fdb884f3 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlDefinitionsClientImpl.java @@ -308,9 +308,7 @@ public PagedIterable listBySubscription(C /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -336,9 +334,7 @@ private Mono> listNextSingl /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -366,9 +362,7 @@ private Mono> listNextSingl /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -397,9 +391,7 @@ private Mono> listNextSingl /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsClientImpl.java index d9047aab8625..cdb179b68e28 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoreControlsClientImpl.java @@ -399,9 +399,7 @@ public PagedIterable list(ExpandControlsEnum exp /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -427,9 +425,7 @@ private Mono> listBySecureScoreNex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -456,9 +452,7 @@ private Mono> listBySecureScoreNex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -483,9 +477,7 @@ private Mono> listNextSinglePageAs /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresClientImpl.java index ca577578aae1..8178ed01dfc2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecureScoresClientImpl.java @@ -316,9 +316,7 @@ public SecureScoreItemInner get(String secureScoreName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -343,9 +341,7 @@ private Mono> listNextSinglePageAsync(String /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterImpl.java index d95d8b025c9d..7badc7ffe766 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityCenterImpl.java @@ -13,8 +13,8 @@ import com.azure.core.management.AzureEnvironment; import com.azure.core.management.exception.ManagementError; import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollerFactory; import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; @@ -23,8 +23,6 @@ import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.security.fluent.AdaptiveApplicationControlsClient; -import com.azure.resourcemanager.security.fluent.AdaptiveNetworkHardeningsClient; import com.azure.resourcemanager.security.fluent.AdvancedThreatProtectionsClient; import com.azure.resourcemanager.security.fluent.AlertsClient; import com.azure.resourcemanager.security.fluent.AlertsSuppressionRulesClient; @@ -34,8 +32,8 @@ import com.azure.resourcemanager.security.fluent.ApplicationsClient; import com.azure.resourcemanager.security.fluent.AssessmentsClient; import com.azure.resourcemanager.security.fluent.AssessmentsMetadatasClient; -import com.azure.resourcemanager.security.fluent.AutomationsClient; import com.azure.resourcemanager.security.fluent.AutoProvisioningSettingsClient; +import com.azure.resourcemanager.security.fluent.AutomationsClient; import com.azure.resourcemanager.security.fluent.AzureDevOpsOrgsClient; import com.azure.resourcemanager.security.fluent.AzureDevOpsProjectsClient; import com.azure.resourcemanager.security.fluent.AzureDevOpsReposClient; @@ -44,10 +42,13 @@ import com.azure.resourcemanager.security.fluent.ConnectorsClient; import com.azure.resourcemanager.security.fluent.CustomAssessmentAutomationsClient; import com.azure.resourcemanager.security.fluent.CustomEntityStoreAssignmentsClient; +import com.azure.resourcemanager.security.fluent.CustomRecommendationsClient; import com.azure.resourcemanager.security.fluent.DefenderForStoragesClient; -import com.azure.resourcemanager.security.fluent.DeviceSecurityGroupsClient; import com.azure.resourcemanager.security.fluent.DevOpsConfigurationsClient; import com.azure.resourcemanager.security.fluent.DevOpsOperationResultsClient; +import com.azure.resourcemanager.security.fluent.DevOpsPoliciesClient; +import com.azure.resourcemanager.security.fluent.DevOpsPolicyAssignmentsClient; +import com.azure.resourcemanager.security.fluent.DeviceSecurityGroupsClient; import com.azure.resourcemanager.security.fluent.DiscoveredSecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.ExternalSecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.GitHubOwnersClient; @@ -82,6 +83,7 @@ import com.azure.resourcemanager.security.fluent.SecurityOperatorsClient; import com.azure.resourcemanager.security.fluent.SecuritySolutionsClient; import com.azure.resourcemanager.security.fluent.SecuritySolutionsReferenceDatasClient; +import com.azure.resourcemanager.security.fluent.SecurityStandardsClient; import com.azure.resourcemanager.security.fluent.SensitivitySettingsClient; import com.azure.resourcemanager.security.fluent.ServerVulnerabilityAssessmentsClient; import com.azure.resourcemanager.security.fluent.ServerVulnerabilityAssessmentsSettingsClient; @@ -90,6 +92,7 @@ import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentBaselineRulesClient; import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScanResultsClient; import com.azure.resourcemanager.security.fluent.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.security.fluent.StandardAssignmentsClient; import com.azure.resourcemanager.security.fluent.SubAssessmentsClient; import com.azure.resourcemanager.security.fluent.TasksClient; import com.azure.resourcemanager.security.fluent.TopologiesClient; @@ -640,6 +643,174 @@ public SecurityConnectorsClient getSecurityConnectors() { return this.securityConnectors; } + /** + * The AzureDevOpsOrgsClient object to access its operations. + */ + private final AzureDevOpsOrgsClient azureDevOpsOrgs; + + /** + * Gets the AzureDevOpsOrgsClient object to access its operations. + * + * @return the AzureDevOpsOrgsClient object. + */ + public AzureDevOpsOrgsClient getAzureDevOpsOrgs() { + return this.azureDevOpsOrgs; + } + + /** + * The AzureDevOpsProjectsClient object to access its operations. + */ + private final AzureDevOpsProjectsClient azureDevOpsProjects; + + /** + * Gets the AzureDevOpsProjectsClient object to access its operations. + * + * @return the AzureDevOpsProjectsClient object. + */ + public AzureDevOpsProjectsClient getAzureDevOpsProjects() { + return this.azureDevOpsProjects; + } + + /** + * The AzureDevOpsReposClient object to access its operations. + */ + private final AzureDevOpsReposClient azureDevOpsRepos; + + /** + * Gets the AzureDevOpsReposClient object to access its operations. + * + * @return the AzureDevOpsReposClient object. + */ + public AzureDevOpsReposClient getAzureDevOpsRepos() { + return this.azureDevOpsRepos; + } + + /** + * The DevOpsConfigurationsClient object to access its operations. + */ + private final DevOpsConfigurationsClient devOpsConfigurations; + + /** + * Gets the DevOpsConfigurationsClient object to access its operations. + * + * @return the DevOpsConfigurationsClient object. + */ + public DevOpsConfigurationsClient getDevOpsConfigurations() { + return this.devOpsConfigurations; + } + + /** + * The DevOpsPoliciesClient object to access its operations. + */ + private final DevOpsPoliciesClient devOpsPolicies; + + /** + * Gets the DevOpsPoliciesClient object to access its operations. + * + * @return the DevOpsPoliciesClient object. + */ + public DevOpsPoliciesClient getDevOpsPolicies() { + return this.devOpsPolicies; + } + + /** + * The DevOpsPolicyAssignmentsClient object to access its operations. + */ + private final DevOpsPolicyAssignmentsClient devOpsPolicyAssignments; + + /** + * Gets the DevOpsPolicyAssignmentsClient object to access its operations. + * + * @return the DevOpsPolicyAssignmentsClient object. + */ + public DevOpsPolicyAssignmentsClient getDevOpsPolicyAssignments() { + return this.devOpsPolicyAssignments; + } + + /** + * The GitHubOwnersClient object to access its operations. + */ + private final GitHubOwnersClient gitHubOwners; + + /** + * Gets the GitHubOwnersClient object to access its operations. + * + * @return the GitHubOwnersClient object. + */ + public GitHubOwnersClient getGitHubOwners() { + return this.gitHubOwners; + } + + /** + * The GitHubReposClient object to access its operations. + */ + private final GitHubReposClient gitHubRepos; + + /** + * Gets the GitHubReposClient object to access its operations. + * + * @return the GitHubReposClient object. + */ + public GitHubReposClient getGitHubRepos() { + return this.gitHubRepos; + } + + /** + * The GitLabGroupsClient object to access its operations. + */ + private final GitLabGroupsClient gitLabGroups; + + /** + * Gets the GitLabGroupsClient object to access its operations. + * + * @return the GitLabGroupsClient object. + */ + public GitLabGroupsClient getGitLabGroups() { + return this.gitLabGroups; + } + + /** + * The GitLabSubgroupsClient object to access its operations. + */ + private final GitLabSubgroupsClient gitLabSubgroups; + + /** + * Gets the GitLabSubgroupsClient object to access its operations. + * + * @return the GitLabSubgroupsClient object. + */ + public GitLabSubgroupsClient getGitLabSubgroups() { + return this.gitLabSubgroups; + } + + /** + * The GitLabProjectsClient object to access its operations. + */ + private final GitLabProjectsClient gitLabProjects; + + /** + * Gets the GitLabProjectsClient object to access its operations. + * + * @return the GitLabProjectsClient object. + */ + public GitLabProjectsClient getGitLabProjects() { + return this.gitLabProjects; + } + + /** + * The DevOpsOperationResultsClient object to access its operations. + */ + private final DevOpsOperationResultsClient devOpsOperationResults; + + /** + * Gets the DevOpsOperationResultsClient object to access its operations. + * + * @return the DevOpsOperationResultsClient object. + */ + public DevOpsOperationResultsClient getDevOpsOperationResults() { + return this.devOpsOperationResults; + } + /** * The ComplianceResultsClient object to access its operations. */ @@ -738,20 +909,6 @@ public IotSecuritySolutionsClient getIotSecuritySolutions() { return this.iotSecuritySolutions; } - /** - * The AdaptiveNetworkHardeningsClient object to access its operations. - */ - private final AdaptiveNetworkHardeningsClient adaptiveNetworkHardenings; - - /** - * Gets the AdaptiveNetworkHardeningsClient object to access its operations. - * - * @return the AdaptiveNetworkHardeningsClient object. - */ - public AdaptiveNetworkHardeningsClient getAdaptiveNetworkHardenings() { - return this.adaptiveNetworkHardenings; - } - /** * The AllowedConnectionsClient object to access its operations. */ @@ -766,20 +923,6 @@ public AllowedConnectionsClient getAllowedConnections() { return this.allowedConnections; } - /** - * The AdaptiveApplicationControlsClient object to access its operations. - */ - private final AdaptiveApplicationControlsClient adaptiveApplicationControls; - - /** - * Gets the AdaptiveApplicationControlsClient object to access its operations. - * - * @return the AdaptiveApplicationControlsClient object. - */ - public AdaptiveApplicationControlsClient getAdaptiveApplicationControls() { - return this.adaptiveApplicationControls; - } - /** * The DiscoveredSecuritySolutionsClient object to access its operations. */ @@ -1019,143 +1162,45 @@ public PricingsClient getPricings() { } /** - * The AzureDevOpsOrgsClient object to access its operations. + * The SecurityStandardsClient object to access its operations. */ - private final AzureDevOpsOrgsClient azureDevOpsOrgs; + private final SecurityStandardsClient securityStandards; /** - * Gets the AzureDevOpsOrgsClient object to access its operations. + * Gets the SecurityStandardsClient object to access its operations. * - * @return the AzureDevOpsOrgsClient object. + * @return the SecurityStandardsClient object. */ - public AzureDevOpsOrgsClient getAzureDevOpsOrgs() { - return this.azureDevOpsOrgs; + public SecurityStandardsClient getSecurityStandards() { + return this.securityStandards; } /** - * The AzureDevOpsProjectsClient object to access its operations. + * The StandardAssignmentsClient object to access its operations. */ - private final AzureDevOpsProjectsClient azureDevOpsProjects; + private final StandardAssignmentsClient standardAssignments; /** - * Gets the AzureDevOpsProjectsClient object to access its operations. + * Gets the StandardAssignmentsClient object to access its operations. * - * @return the AzureDevOpsProjectsClient object. + * @return the StandardAssignmentsClient object. */ - public AzureDevOpsProjectsClient getAzureDevOpsProjects() { - return this.azureDevOpsProjects; + public StandardAssignmentsClient getStandardAssignments() { + return this.standardAssignments; } /** - * The AzureDevOpsReposClient object to access its operations. + * The CustomRecommendationsClient object to access its operations. */ - private final AzureDevOpsReposClient azureDevOpsRepos; + private final CustomRecommendationsClient customRecommendations; /** - * Gets the AzureDevOpsReposClient object to access its operations. + * Gets the CustomRecommendationsClient object to access its operations. * - * @return the AzureDevOpsReposClient object. + * @return the CustomRecommendationsClient object. */ - public AzureDevOpsReposClient getAzureDevOpsRepos() { - return this.azureDevOpsRepos; - } - - /** - * The DevOpsConfigurationsClient object to access its operations. - */ - private final DevOpsConfigurationsClient devOpsConfigurations; - - /** - * Gets the DevOpsConfigurationsClient object to access its operations. - * - * @return the DevOpsConfigurationsClient object. - */ - public DevOpsConfigurationsClient getDevOpsConfigurations() { - return this.devOpsConfigurations; - } - - /** - * The GitHubOwnersClient object to access its operations. - */ - private final GitHubOwnersClient gitHubOwners; - - /** - * Gets the GitHubOwnersClient object to access its operations. - * - * @return the GitHubOwnersClient object. - */ - public GitHubOwnersClient getGitHubOwners() { - return this.gitHubOwners; - } - - /** - * The GitHubReposClient object to access its operations. - */ - private final GitHubReposClient gitHubRepos; - - /** - * Gets the GitHubReposClient object to access its operations. - * - * @return the GitHubReposClient object. - */ - public GitHubReposClient getGitHubRepos() { - return this.gitHubRepos; - } - - /** - * The GitLabGroupsClient object to access its operations. - */ - private final GitLabGroupsClient gitLabGroups; - - /** - * Gets the GitLabGroupsClient object to access its operations. - * - * @return the GitLabGroupsClient object. - */ - public GitLabGroupsClient getGitLabGroups() { - return this.gitLabGroups; - } - - /** - * The GitLabSubgroupsClient object to access its operations. - */ - private final GitLabSubgroupsClient gitLabSubgroups; - - /** - * Gets the GitLabSubgroupsClient object to access its operations. - * - * @return the GitLabSubgroupsClient object. - */ - public GitLabSubgroupsClient getGitLabSubgroups() { - return this.gitLabSubgroups; - } - - /** - * The GitLabProjectsClient object to access its operations. - */ - private final GitLabProjectsClient gitLabProjects; - - /** - * Gets the GitLabProjectsClient object to access its operations. - * - * @return the GitLabProjectsClient object. - */ - public GitLabProjectsClient getGitLabProjects() { - return this.gitLabProjects; - } - - /** - * The DevOpsOperationResultsClient object to access its operations. - */ - private final DevOpsOperationResultsClient devOpsOperationResults; - - /** - * Gets the DevOpsOperationResultsClient object to access its operations. - * - * @return the DevOpsOperationResultsClient object. - */ - public DevOpsOperationResultsClient getDevOpsOperationResults() { - return this.devOpsOperationResults; + public CustomRecommendationsClient getCustomRecommendations() { + return this.customRecommendations; } /** @@ -1208,6 +1253,18 @@ public DevOpsOperationResultsClient getDevOpsOperationResults() { this.automations = new AutomationsClientImpl(this); this.securityContacts = new SecurityContactsClientImpl(this); this.securityConnectors = new SecurityConnectorsClientImpl(this); + this.azureDevOpsOrgs = new AzureDevOpsOrgsClientImpl(this); + this.azureDevOpsProjects = new AzureDevOpsProjectsClientImpl(this); + this.azureDevOpsRepos = new AzureDevOpsReposClientImpl(this); + this.devOpsConfigurations = new DevOpsConfigurationsClientImpl(this); + this.devOpsPolicies = new DevOpsPoliciesClientImpl(this); + this.devOpsPolicyAssignments = new DevOpsPolicyAssignmentsClientImpl(this); + this.gitHubOwners = new GitHubOwnersClientImpl(this); + this.gitHubRepos = new GitHubReposClientImpl(this); + this.gitLabGroups = new GitLabGroupsClientImpl(this); + this.gitLabSubgroups = new GitLabSubgroupsClientImpl(this); + this.gitLabProjects = new GitLabProjectsClientImpl(this); + this.devOpsOperationResults = new DevOpsOperationResultsClientImpl(this); this.complianceResults = new ComplianceResultsClientImpl(this); this.advancedThreatProtections = new AdvancedThreatProtectionsClientImpl(this); this.deviceSecurityGroups = new DeviceSecurityGroupsClientImpl(this); @@ -1217,9 +1274,7 @@ public DevOpsOperationResultsClient getDevOpsOperationResults() { this.iotSecuritySolutionsAnalyticsRecommendations = new IotSecuritySolutionsAnalyticsRecommendationsClientImpl(this); this.iotSecuritySolutions = new IotSecuritySolutionsClientImpl(this); - this.adaptiveNetworkHardenings = new AdaptiveNetworkHardeningsClientImpl(this); this.allowedConnections = new AllowedConnectionsClientImpl(this); - this.adaptiveApplicationControls = new AdaptiveApplicationControlsClientImpl(this); this.discoveredSecuritySolutions = new DiscoveredSecuritySolutionsClientImpl(this); this.externalSecuritySolutions = new ExternalSecuritySolutionsClientImpl(this); this.jitNetworkAccessPolicies = new JitNetworkAccessPoliciesClientImpl(this); @@ -1237,16 +1292,9 @@ public DevOpsOperationResultsClient getDevOpsOperationResults() { this.serverVulnerabilityAssessmentsSettings = new ServerVulnerabilityAssessmentsSettingsClientImpl(this); this.apiCollections = new ApiCollectionsClientImpl(this); this.pricings = new PricingsClientImpl(this); - this.azureDevOpsOrgs = new AzureDevOpsOrgsClientImpl(this); - this.azureDevOpsProjects = new AzureDevOpsProjectsClientImpl(this); - this.azureDevOpsRepos = new AzureDevOpsReposClientImpl(this); - this.devOpsConfigurations = new DevOpsConfigurationsClientImpl(this); - this.gitHubOwners = new GitHubOwnersClientImpl(this); - this.gitHubRepos = new GitHubReposClientImpl(this); - this.gitLabGroups = new GitLabGroupsClientImpl(this); - this.gitLabSubgroups = new GitLabSubgroupsClientImpl(this); - this.gitLabProjects = new GitLabProjectsClientImpl(this); - this.devOpsOperationResults = new DevOpsOperationResultsClientImpl(this); + this.securityStandards = new SecurityStandardsClientImpl(this); + this.standardAssignments = new StandardAssignmentsClientImpl(this); + this.customRecommendations = new CustomRecommendationsClientImpl(this); } /** diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsClientImpl.java index 80b9367cdcec..7267a2deb624 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorApplicationsClientImpl.java @@ -240,9 +240,7 @@ public PagedIterable list(String resourceGroupName, String sec /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -268,9 +266,7 @@ private Mono> listNextSinglePageAsync(String nex /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorsClientImpl.java index 2875f82f0437..2f06f9c44699 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityConnectorsClientImpl.java @@ -160,7 +160,7 @@ private Mono> listSinglePageAsync() { return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), @@ -191,7 +191,7 @@ private Mono> listSinglePageAsync(Context return Mono.error(new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) @@ -282,7 +282,7 @@ private Mono> listByResourceGroupSinglePag return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), apiVersion, @@ -320,7 +320,7 @@ private Mono> listByResourceGroupSinglePag return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service @@ -428,7 +428,7 @@ private Mono> getByResourceGroupWithResponseAsy return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, @@ -467,7 +467,7 @@ private Mono> getByResourceGroupWithResponseAsy return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.getByResourceGroup(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), @@ -564,7 +564,7 @@ private Mono> createOrUpdateWithResponseAsync(S } else { securityConnector.validate(); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, @@ -612,7 +612,7 @@ private Mono> createOrUpdateWithResponseAsync(S } else { securityConnector.validate(); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.createOrUpdate(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), @@ -717,7 +717,7 @@ private Mono> updateWithResponseAsync(String re } else { securityConnector.validate(); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; return FluxUtil .withContext( @@ -764,7 +764,7 @@ private Mono> updateWithResponseAsync(String re } else { securityConnector.validate(); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.update(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, @@ -856,7 +856,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.delete(this.client.getEndpoint(), apiVersion, @@ -895,7 +895,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S return Mono .error(new IllegalArgumentException("Parameter securityConnectorName is required and cannot be null.")); } - final String apiVersion = "2024-03-01-preview"; + final String apiVersion = "2024-08-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service.delete(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, @@ -953,9 +953,7 @@ public void delete(String resourceGroupName, String securityConnectorName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -981,9 +979,7 @@ private Mono> listNextSinglePageAsync(Stri /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1010,9 +1006,7 @@ private Mono> listNextSinglePageAsync(Stri /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1040,9 +1034,7 @@ private Mono> listByResourceGroupNextSingl /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsClientImpl.java index ac7a1e1c0e3d..be18912c5acb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityContactsClientImpl.java @@ -565,9 +565,7 @@ public void delete(SecurityContactName securityContactName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -593,9 +591,7 @@ private Mono> listNextSinglePageAsync(String /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsClientImpl.java index 5f6beef104c4..84189c7ddba7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecuritySolutionsClientImpl.java @@ -344,9 +344,7 @@ public SecuritySolutionInner get(String resourceGroupName, String ascLocation, S /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -371,9 +369,7 @@ private Mono> listNextSinglePageAsync(Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardImpl.java new file mode 100644 index 000000000000..599dc2af3a29 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.SecurityStandardInner; +import com.azure.resourcemanager.security.models.PartialAssessmentProperties; +import com.azure.resourcemanager.security.models.SecurityStandard; +import com.azure.resourcemanager.security.models.StandardMetadata; +import com.azure.resourcemanager.security.models.StandardSupportedCloud; +import com.azure.resourcemanager.security.models.StandardType; +import java.util.Collections; +import java.util.List; + +public final class SecurityStandardImpl + implements SecurityStandard, SecurityStandard.Definition, SecurityStandard.Update { + private SecurityStandardInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public StandardType standardType() { + return this.innerModel().standardType(); + } + + public String description() { + return this.innerModel().description(); + } + + public List assessments() { + List inner = this.innerModel().assessments(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List cloudProviders() { + List inner = this.innerModel().cloudProviders(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String policySetDefinitionId() { + return this.innerModel().policySetDefinitionId(); + } + + public StandardMetadata metadata() { + return this.innerModel().metadata(); + } + + public SecurityStandardInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String scope; + + private String standardId; + + public SecurityStandardImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public SecurityStandard create() { + this.innerObject = serviceManager.serviceClient() + .getSecurityStandards() + .createOrUpdateWithResponse(scope, standardId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityStandard create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityStandards() + .createOrUpdateWithResponse(scope, standardId, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityStandardImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new SecurityStandardInner(); + this.serviceManager = serviceManager; + this.standardId = name; + } + + public SecurityStandardImpl update() { + return this; + } + + public SecurityStandard apply() { + this.innerObject = serviceManager.serviceClient() + .getSecurityStandards() + .createOrUpdateWithResponse(scope, standardId, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SecurityStandard apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityStandards() + .createOrUpdateWithResponse(scope, standardId, this.innerModel(), context) + .getValue(); + return this; + } + + SecurityStandardImpl(SecurityStandardInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "scope"); + this.standardId = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "standardId"); + } + + public SecurityStandard refresh() { + this.innerObject = serviceManager.serviceClient() + .getSecurityStandards() + .getWithResponse(scope, standardId, Context.NONE) + .getValue(); + return this; + } + + public SecurityStandard refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityStandards() + .getWithResponse(scope, standardId, context) + .getValue(); + return this; + } + + public SecurityStandardImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public SecurityStandardImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public SecurityStandardImpl withAssessments(List assessments) { + this.innerModel().withAssessments(assessments); + return this; + } + + public SecurityStandardImpl withCloudProviders(List cloudProviders) { + this.innerModel().withCloudProviders(cloudProviders); + return this; + } + + public SecurityStandardImpl withPolicySetDefinitionId(String policySetDefinitionId) { + this.innerModel().withPolicySetDefinitionId(policySetDefinitionId); + return this; + } + + public SecurityStandardImpl withMetadata(StandardMetadata metadata) { + this.innerModel().withMetadata(metadata); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardsClientImpl.java new file mode 100644 index 000000000000..64e8b6052f64 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardsClientImpl.java @@ -0,0 +1,676 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.security.fluent.SecurityStandardsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityStandardInner; +import com.azure.resourcemanager.security.models.SecurityStandardList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SecurityStandardsClient. + */ +public final class SecurityStandardsClientImpl implements SecurityStandardsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SecurityStandardsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of SecurityStandardsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityStandardsClientImpl(SecurityCenterImpl client) { + this.service + = RestProxy.create(SecurityStandardsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterSecurityStandards to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterSecuri") + public interface SecurityStandardsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/securityStandards") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("standardId") String standardId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @PathParam("standardId") String standardId, @BodyParam("application/json") SecurityStandardInner standard, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{scope}/providers/Microsoft.Security/securityStandards/{standardId}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("scope") String scope, @PathParam("standardId") String standardId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant security standards over a scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant security standards over a scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, scope, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant security standards over a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant security standards over a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant security standards over a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Get a list of all relevant security standards over a scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant security standards over a scope as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); + } + + /** + * Get a specific security standard for the requested scope by standardId. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific security standard for the requested scope by standardId along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String standardId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific security standard for the requested scope by standardId. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific security standard for the requested scope by standardId along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String scope, String standardId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context); + } + + /** + * Get a specific security standard for the requested scope by standardId. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific security standard for the requested scope by standardId on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String standardId) { + return getWithResponseAsync(scope, standardId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific security standard for the requested scope by standardId. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific security standard for the requested scope by standardId along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String scope, String standardId, Context context) { + return getWithResponseAsync(scope, standardId, context).block(); + } + + /** + * Get a specific security standard for the requested scope by standardId. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific security standard for the requested scope by standardId. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityStandardInner get(String scope, String standardId) { + return getWithResponse(scope, standardId, Context.NONE).getValue(); + } + + /** + * Creates or updates a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param standard Custom security standard over a pre-defined scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Standard on a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, String standardId, + SecurityStandardInner standard) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + if (standard == null) { + return Mono.error(new IllegalArgumentException("Parameter standard is required and cannot be null.")); + } else { + standard.validate(); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, standardId, + standard, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param standard Custom security standard over a pre-defined scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Standard on a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String scope, String standardId, + SecurityStandardInner standard, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + if (standard == null) { + return Mono.error(new IllegalArgumentException("Parameter standard is required and cannot be null.")); + } else { + standard.validate(); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), apiVersion, scope, standardId, standard, accept, + context); + } + + /** + * Creates or updates a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param standard Custom security standard over a pre-defined scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Standard on a resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String scope, String standardId, + SecurityStandardInner standard) { + return createOrUpdateWithResponseAsync(scope, standardId, standard) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param standard Custom security standard over a pre-defined scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Standard on a resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String scope, String standardId, + SecurityStandardInner standard, Context context) { + return createOrUpdateWithResponseAsync(scope, standardId, standard, context).block(); + } + + /** + * Creates or updates a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param standard Custom security standard over a pre-defined scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Standard on a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityStandardInner createOrUpdate(String scope, String standardId, SecurityStandardInner standard) { + return createOrUpdateWithResponse(scope, standardId, standard, Context.NONE).getValue(); + } + + /** + * Delete a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, String standardId) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String scope, String standardId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (standardId == null) { + return Mono.error(new IllegalArgumentException("Parameter standardId is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), apiVersion, scope, standardId, accept, context); + } + + /** + * Delete a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope, String standardId) { + return deleteWithResponseAsync(scope, standardId).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String scope, String standardId, Context context) { + return deleteWithResponseAsync(scope, standardId, context).block(); + } + + /** + * Delete a security standard over a given scope. + * + * @param scope The scope of the security standard. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param standardId The Security Standard key - unique key for the standard type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope, String standardId) { + deleteWithResponse(scope, standardId, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return page of a Standard list along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return page of a Standard list along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardsImpl.java new file mode 100644 index 000000000000..b86bd0fb7901 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SecurityStandardsImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.SecurityStandardsClient; +import com.azure.resourcemanager.security.fluent.models.SecurityStandardInner; +import com.azure.resourcemanager.security.models.SecurityStandard; +import com.azure.resourcemanager.security.models.SecurityStandards; + +public final class SecurityStandardsImpl implements SecurityStandards { + private static final ClientLogger LOGGER = new ClientLogger(SecurityStandardsImpl.class); + + private final SecurityStandardsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public SecurityStandardsImpl(SecurityStandardsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityStandardImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityStandardImpl(inner1, this.manager())); + } + + public Response getWithResponse(String scope, String standardId, Context context) { + Response inner = this.serviceClient().getWithResponse(scope, standardId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityStandardImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SecurityStandard get(String scope, String standardId) { + SecurityStandardInner inner = this.serviceClient().get(scope, standardId); + if (inner != null) { + return new SecurityStandardImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String scope, String standardId, Context context) { + return this.serviceClient().deleteWithResponse(scope, standardId, context); + } + + public void deleteByResourceGroup(String scope, String standardId) { + this.serviceClient().delete(scope, standardId); + } + + public SecurityStandard getById(String id) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String standardId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "standardId"); + if (standardId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityStandards'.", id))); + } + return this.getWithResponse(scope, standardId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String standardId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "standardId"); + if (standardId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityStandards'.", id))); + } + return this.getWithResponse(scope, standardId, context); + } + + public void deleteById(String id) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String standardId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "standardId"); + if (standardId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityStandards'.", id))); + } + this.deleteByResourceGroupWithResponse(scope, standardId, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String scope = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "scope"); + if (scope == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String standardId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}", "standardId"); + if (standardId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityStandards'.", id))); + } + return this.deleteByResourceGroupWithResponse(scope, standardId, context); + } + + private SecurityStandardsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public SecurityStandardImpl define(String name) { + return new SecurityStandardImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingsClientImpl.java index d8fa6ee01d08..cbedeb40b1f5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/ServerVulnerabilityAssessmentsSettingsClientImpl.java @@ -580,9 +580,7 @@ public void delete(ServerVulnerabilityAssessmentsSettingKindName settingKind) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -612,9 +610,7 @@ public void delete(ServerVulnerabilityAssessmentsSettingKindName settingKind) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsClientImpl.java index 30ffbfa19d58..d9573c7f236d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SettingsClientImpl.java @@ -432,9 +432,7 @@ public SettingInner update(SettingNameAutoGenerated settingName, SettingInner se /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -459,9 +457,7 @@ private Mono> listNextSinglePageAsync(String nextLin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesClientImpl.java index 562260a45615..c445b9d9f37b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SoftwareInventoriesClientImpl.java @@ -576,9 +576,7 @@ public SoftwareInner get(String resourceGroupName, String resourceNamespace, Str /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -606,9 +604,7 @@ private Mono> listByExtendedResourceNextSinglePageA /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -636,9 +632,7 @@ private Mono> listByExtendedResourceNextSinglePageA /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -666,9 +660,7 @@ private Mono> listBySubscriptionNextSinglePageAsync /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentImpl.java new file mode 100644 index 000000000000..1f22bc22750b --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.StandardAssignmentInner; +import com.azure.resourcemanager.security.models.AssignedStandardItem; +import com.azure.resourcemanager.security.models.Effect; +import com.azure.resourcemanager.security.models.StandardAssignment; +import com.azure.resourcemanager.security.models.StandardAssignmentMetadata; +import com.azure.resourcemanager.security.models.StandardAssignmentPropertiesAttestationData; +import com.azure.resourcemanager.security.models.StandardAssignmentPropertiesExemptionData; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class StandardAssignmentImpl implements StandardAssignment, StandardAssignment.Definition { + private StandardAssignmentInner innerObject; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + StandardAssignmentImpl(StandardAssignmentInner innerObject, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public AssignedStandardItem assignedStandard() { + return this.innerModel().assignedStandard(); + } + + public Effect effect() { + return this.innerModel().effect(); + } + + public List excludedScopes() { + List inner = this.innerModel().excludedScopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime expiresOn() { + return this.innerModel().expiresOn(); + } + + public StandardAssignmentPropertiesExemptionData exemptionData() { + return this.innerModel().exemptionData(); + } + + public StandardAssignmentPropertiesAttestationData attestationData() { + return this.innerModel().attestationData(); + } + + public StandardAssignmentMetadata metadata() { + return this.innerModel().metadata(); + } + + public StandardAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + private String resourceId; + + private String standardAssignmentName; + + public StandardAssignmentImpl withExistingResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + public StandardAssignment create() { + this.innerObject = serviceManager.serviceClient() + .getStandardAssignments() + .createWithResponse(resourceId, standardAssignmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public StandardAssignment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStandardAssignments() + .createWithResponse(resourceId, standardAssignmentName, this.innerModel(), context) + .getValue(); + return this; + } + + StandardAssignmentImpl(String name, com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerObject = new StandardAssignmentInner(); + this.serviceManager = serviceManager; + this.standardAssignmentName = name; + } + + public StandardAssignment refresh() { + this.innerObject = serviceManager.serviceClient() + .getStandardAssignments() + .getWithResponse(resourceId, standardAssignmentName, Context.NONE) + .getValue(); + return this; + } + + public StandardAssignment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStandardAssignments() + .getWithResponse(resourceId, standardAssignmentName, context) + .getValue(); + return this; + } + + public StandardAssignmentImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public StandardAssignmentImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public StandardAssignmentImpl withAssignedStandard(AssignedStandardItem assignedStandard) { + this.innerModel().withAssignedStandard(assignedStandard); + return this; + } + + public StandardAssignmentImpl withEffect(Effect effect) { + this.innerModel().withEffect(effect); + return this; + } + + public StandardAssignmentImpl withExcludedScopes(List excludedScopes) { + this.innerModel().withExcludedScopes(excludedScopes); + return this; + } + + public StandardAssignmentImpl withExpiresOn(OffsetDateTime expiresOn) { + this.innerModel().withExpiresOn(expiresOn); + return this; + } + + public StandardAssignmentImpl withExemptionData(StandardAssignmentPropertiesExemptionData exemptionData) { + this.innerModel().withExemptionData(exemptionData); + return this; + } + + public StandardAssignmentImpl withAttestationData(StandardAssignmentPropertiesAttestationData attestationData) { + this.innerModel().withAttestationData(attestationData); + return this; + } + + public StandardAssignmentImpl withMetadata(StandardAssignmentMetadata metadata) { + this.innerModel().withMetadata(metadata); + return this; + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentsClientImpl.java new file mode 100644 index 000000000000..796a9c6fb278 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentsClientImpl.java @@ -0,0 +1,704 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.security.fluent.StandardAssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.StandardAssignmentInner; +import com.azure.resourcemanager.security.models.StandardAssignmentsList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StandardAssignmentsClient. + */ +public final class StandardAssignmentsClientImpl implements StandardAssignmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final StandardAssignmentsService service; + + /** + * The service client containing this operation class. + */ + private final SecurityCenterImpl client; + + /** + * Initializes an instance of StandardAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StandardAssignmentsClientImpl(SecurityCenterImpl client) { + this.service = RestProxy.create(StandardAssignmentsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecurityCenterStandardAssignments to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SecurityCenterStanda") + public interface StandardAssignmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("standardAssignmentName") String standardAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("standardAssignmentName") String standardAssignmentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StandardAssignmentInner standardAssignment, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam(value = "resourceId", encoded = true) String resourceId, + @PathParam("standardAssignmentName") String standardAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{scope}/providers/Microsoft.Security/standardAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("scope") String scope, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Retrieves a standard assignment. + * + * This operation retrieves a single standard assignment, given its name and the scope it was created at. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId, + String standardAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (standardAssignmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), resourceId, standardAssignmentName, + apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a standard assignment. + * + * This operation retrieves a single standard assignment, given its name and the scope it was created at. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceId, + String standardAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (standardAssignmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, accept, context); + } + + /** + * Retrieves a standard assignment. + * + * This operation retrieves a single standard assignment, given its name and the scope it was created at. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceId, String standardAssignmentName) { + return getWithResponseAsync(resourceId, standardAssignmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves a standard assignment. + * + * This operation retrieves a single standard assignment, given its name and the scope it was created at. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceId, String standardAssignmentName, + Context context) { + return getWithResponseAsync(resourceId, standardAssignmentName, context).block(); + } + + /** + * Retrieves a standard assignment. + * + * This operation retrieves a single standard assignment, given its name and the scope it was created at. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StandardAssignmentInner get(String resourceId, String standardAssignmentName) { + return getWithResponse(resourceId, standardAssignmentName, Context.NONE).getValue(); + } + + /** + * Creates or updates a standard assignment. + * + * This operation creates or updates a standard assignment with the given scope and name. standard assignments apply + * to all resources contained within their scope. For example, when you assign a policy at resource group scope, + * that policy applies to all resources in the group. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param standardAssignment Custom standard assignment over a pre-defined scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceId, + String standardAssignmentName, StandardAssignmentInner standardAssignment) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (standardAssignmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); + } + if (standardAssignment == null) { + return Mono + .error(new IllegalArgumentException("Parameter standardAssignment is required and cannot be null.")); + } else { + standardAssignment.validate(); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), resourceId, standardAssignmentName, + apiVersion, standardAssignment, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a standard assignment. + * + * This operation creates or updates a standard assignment with the given scope and name. standard assignments apply + * to all resources contained within their scope. For example, when you assign a policy at resource group scope, + * that policy applies to all resources in the group. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param standardAssignment Custom standard assignment over a pre-defined scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceId, + String standardAssignmentName, StandardAssignmentInner standardAssignment, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (standardAssignmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); + } + if (standardAssignment == null) { + return Mono + .error(new IllegalArgumentException("Parameter standardAssignment is required and cannot be null.")); + } else { + standardAssignment.validate(); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, + standardAssignment, accept, context); + } + + /** + * Creates or updates a standard assignment. + * + * This operation creates or updates a standard assignment with the given scope and name. standard assignments apply + * to all resources contained within their scope. For example, when you assign a policy at resource group scope, + * that policy applies to all resources in the group. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param standardAssignment Custom standard assignment over a pre-defined scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceId, String standardAssignmentName, + StandardAssignmentInner standardAssignment) { + return createWithResponseAsync(resourceId, standardAssignmentName, standardAssignment) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a standard assignment. + * + * This operation creates or updates a standard assignment with the given scope and name. standard assignments apply + * to all resources contained within their scope. For example, when you assign a policy at resource group scope, + * that policy applies to all resources in the group. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param standardAssignment Custom standard assignment over a pre-defined scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceId, String standardAssignmentName, + StandardAssignmentInner standardAssignment, Context context) { + return createWithResponseAsync(resourceId, standardAssignmentName, standardAssignment, context).block(); + } + + /** + * Creates or updates a standard assignment. + * + * This operation creates or updates a standard assignment with the given scope and name. standard assignments apply + * to all resources contained within their scope. For example, when you assign a policy at resource group scope, + * that policy applies to all resources in the group. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param standardAssignment Custom standard assignment over a pre-defined scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return security Assignment on a resource group over a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StandardAssignmentInner create(String resourceId, String standardAssignmentName, + StandardAssignmentInner standardAssignment) { + return createWithResponse(resourceId, standardAssignmentName, standardAssignment, Context.NONE).getValue(); + } + + /** + * Deletes a standard assignment. + * + * This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a + * standard assignment is the part of its ID preceding + * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceId, String standardAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (standardAssignmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), resourceId, standardAssignmentName, + apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a standard assignment. + * + * This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a + * standard assignment is the part of its ID preceding + * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceId, String standardAssignmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (standardAssignmentName == null) { + return Mono.error( + new IllegalArgumentException("Parameter standardAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), resourceId, standardAssignmentName, apiVersion, accept, + context); + } + + /** + * Deletes a standard assignment. + * + * This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a + * standard assignment is the part of its ID preceding + * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceId, String standardAssignmentName) { + return deleteWithResponseAsync(resourceId, standardAssignmentName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a standard assignment. + * + * This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a + * standard assignment is the part of its ID preceding + * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceId, String standardAssignmentName, Context context) { + return deleteWithResponseAsync(resourceId, standardAssignmentName, context).block(); + } + + /** + * Deletes a standard assignment. + * + * This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a + * standard assignment is the part of its ID preceding + * '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. + * + * @param resourceId The identifier of the resource. + * @param standardAssignmentName The standard assignments assignment key - unique key for the standard assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceId, String standardAssignmentName) { + deleteWithResponse(resourceId, standardAssignmentName, Context.NONE); + } + + /** + * Get a list of all relevant standard assignments over a scope. + * + * @param scope The scope of the standard assignment. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant standard assignments over a scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, scope, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all relevant standard assignments over a scope. + * + * @param scope The scope of the standard assignment. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant standard assignments over a scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String apiVersion = "2024-08-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, scope, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get a list of all relevant standard assignments over a scope. + * + * @param scope The scope of the standard assignment. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant standard assignments over a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all relevant standard assignments over a scope. + * + * @param scope The scope of the standard assignment. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant standard assignments over a scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all relevant standard assignments over a scope. + * + * @param scope The scope of the standard assignment. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant standard assignments over a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Get a list of all relevant standard assignments over a scope. + * + * @param scope The scope of the standard assignment. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant standard assignments over a scope as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return page of a standard assignment list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return page of a standard assignment list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentsImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentsImpl.java new file mode 100644 index 000000000000..5b5c54acdfb2 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/StandardAssignmentsImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.security.fluent.StandardAssignmentsClient; +import com.azure.resourcemanager.security.fluent.models.StandardAssignmentInner; +import com.azure.resourcemanager.security.models.StandardAssignment; +import com.azure.resourcemanager.security.models.StandardAssignments; + +public final class StandardAssignmentsImpl implements StandardAssignments { + private static final ClientLogger LOGGER = new ClientLogger(StandardAssignmentsImpl.class); + + private final StandardAssignmentsClient innerClient; + + private final com.azure.resourcemanager.security.SecurityManager serviceManager; + + public StandardAssignmentsImpl(StandardAssignmentsClient innerClient, + com.azure.resourcemanager.security.SecurityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceId, String standardAssignmentName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceId, standardAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StandardAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public StandardAssignment get(String resourceId, String standardAssignmentName) { + StandardAssignmentInner inner = this.serviceClient().get(resourceId, standardAssignmentName); + if (inner != null) { + return new StandardAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceId, String standardAssignmentName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceId, standardAssignmentName, context); + } + + public void deleteByResourceGroup(String resourceId, String standardAssignmentName) { + this.serviceClient().delete(resourceId, standardAssignmentName); + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StandardAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StandardAssignmentImpl(inner1, this.manager())); + } + + public StandardAssignment getById(String id) { + String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}", "resourceId"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String standardAssignmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}", + "standardAssignmentName"); + if (standardAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'standardAssignments'.", id))); + } + return this.getWithResponse(resourceId, standardAssignmentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}", "resourceId"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String standardAssignmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}", + "standardAssignmentName"); + if (standardAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'standardAssignments'.", id))); + } + return this.getWithResponse(resourceId, standardAssignmentName, context); + } + + public void deleteById(String id) { + String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}", "resourceId"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String standardAssignmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}", + "standardAssignmentName"); + if (standardAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'standardAssignments'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceId, standardAssignmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}", "resourceId"); + if (resourceId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceId'.", id))); + } + String standardAssignmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}", + "standardAssignmentName"); + if (standardAssignmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'standardAssignments'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceId, standardAssignmentName, context); + } + + private StandardAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.security.SecurityManager manager() { + return this.serviceManager; + } + + public StandardAssignmentImpl define(String name) { + return new StandardAssignmentImpl(name, this.manager()); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsClientImpl.java index bac88385900c..5e45aa84b125 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/SubAssessmentsClientImpl.java @@ -503,9 +503,7 @@ public SecuritySubAssessmentInner get(String scope, String assessmentName, Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -532,9 +530,7 @@ private Mono> listAllNextSinglePageAsy /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -562,9 +558,7 @@ private Mono> listAllNextSinglePageAsy /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -590,9 +584,7 @@ private Mono> listNextSinglePageAsync( /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java index a019dcc886b4..50e2ff302628 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksClientImpl.java @@ -1195,9 +1195,7 @@ public void updateResourceGroupLevelTaskState(String resourceGroupName, String a /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1223,9 +1221,7 @@ private Mono> listNextSinglePageAsync(String ne /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1252,9 +1248,7 @@ private Mono> listNextSinglePageAsync(String ne /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1281,9 +1275,7 @@ private Mono> listByHomeRegionNextSinglePageAsy /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1311,9 +1303,7 @@ private Mono> listByHomeRegionNextSinglePageAsy /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1341,9 +1331,7 @@ private Mono> listByResourceGroupNextSinglePage /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java index d48e25a5d48f..45ea2b27801a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TasksImpl.java @@ -12,8 +12,8 @@ import com.azure.resourcemanager.security.fluent.TasksClient; import com.azure.resourcemanager.security.fluent.models.SecurityTaskInner; import com.azure.resourcemanager.security.models.SecurityTask; -import com.azure.resourcemanager.security.models.Tasks; import com.azure.resourcemanager.security.models.TaskUpdateActionType; +import com.azure.resourcemanager.security.models.Tasks; public final class TasksImpl implements Tasks { private static final ClientLogger LOGGER = new ClientLogger(TasksImpl.class); diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesClientImpl.java index 25fc53278196..6c47435cd68d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/TopologiesClientImpl.java @@ -502,9 +502,7 @@ public TopologyResourceInner get(String resourceGroupName, String ascLocation, S /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -529,9 +527,7 @@ private Mono> listNextSinglePageAsync(Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -557,9 +553,7 @@ private Mono> listNextSinglePageAsync(Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -585,9 +579,7 @@ private Mono> listByHomeRegionNextSinglePag /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsClientImpl.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsClientImpl.java index 0ca76484bc65..744ead6e09f3 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsClientImpl.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/WorkspaceSettingsClientImpl.java @@ -715,9 +715,7 @@ public void delete(String workspaceSettingName) { /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -743,9 +741,7 @@ private Mono> listNextSinglePageAsync(Strin /** * Get the next page of items. * - * @param nextLink The URL to get the next list of items - * - * The nextLink parameter. + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityState.java index 692f9c353be2..9a554de0f695 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityState.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public AadConnectivityState() { * @param name a name to look for. * @return the corresponding AadConnectivityState. */ - @JsonCreator public static AadConnectivityState fromString(String name) { return fromString(name, AadConnectivityState.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityStateAutoGenerated.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityStateAutoGenerated.java index 11a344a01acd..713dcac7eb43 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityStateAutoGenerated.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadConnectivityStateAutoGenerated.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Describes an Azure resource with kind. */ @Fluent -public class AadConnectivityStateAutoGenerated { +public class AadConnectivityStateAutoGenerated implements JsonSerializable { /* - * The connectivity state of the external AAD solution + * The connectivity state of the external AAD solution */ - @JsonProperty(value = "connectivityState") private AadConnectivityState connectivityState; /** @@ -51,4 +54,43 @@ public AadConnectivityStateAutoGenerated withConnectivityState(AadConnectivitySt */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connectivityState", + this.connectivityState == null ? null : this.connectivityState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AadConnectivityStateAutoGenerated from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AadConnectivityStateAutoGenerated if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AadConnectivityStateAutoGenerated. + */ + public static AadConnectivityStateAutoGenerated fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AadConnectivityStateAutoGenerated deserializedAadConnectivityStateAutoGenerated + = new AadConnectivityStateAutoGenerated(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectivityState".equals(fieldName)) { + deserializedAadConnectivityStateAutoGenerated.connectivityState + = AadConnectivityState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAadConnectivityStateAutoGenerated; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadExternalSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadExternalSecuritySolution.java index 21ab819f3611..2de9ac7b3f0f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadExternalSecuritySolution.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadExternalSecuritySolution.java @@ -5,36 +5,47 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Represents an AAD identity protection solution which sends logs to an OMS workspace. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "kind", - defaultImpl = AadExternalSecuritySolution.class, - visible = true) -@JsonTypeName("AAD") @Fluent public final class AadExternalSecuritySolution extends ExternalSecuritySolutionInner { /* * The kind of the external solution */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) private ExternalSecuritySolutionKind kind = ExternalSecuritySolutionKind.AAD; /* * The external security solution properties for AAD solutions */ - @JsonProperty(value = "properties") private AadSolutionProperties properties; + /* + * Location where the resource is stored + */ + private String location; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AadExternalSecuritySolution class. */ @@ -71,6 +82,46 @@ public AadExternalSecuritySolution withProperties(AadSolutionProperties properti return this; } + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + @Override + public String location() { + return this.location; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -78,9 +129,57 @@ public AadExternalSecuritySolution withProperties(AadSolutionProperties properti */ @Override public void validate() { - super.validate(); if (properties() != null) { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AadExternalSecuritySolution from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AadExternalSecuritySolution if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AadExternalSecuritySolution. + */ + public static AadExternalSecuritySolution fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AadExternalSecuritySolution deserializedAadExternalSecuritySolution = new AadExternalSecuritySolution(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAadExternalSecuritySolution.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAadExternalSecuritySolution.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAadExternalSecuritySolution.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAadExternalSecuritySolution.location = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedAadExternalSecuritySolution.kind + = ExternalSecuritySolutionKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedAadExternalSecuritySolution.properties = AadSolutionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAadExternalSecuritySolution; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadSolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadSolutionProperties.java index 2840bf309bda..5ce006a885a0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadSolutionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AadSolutionProperties.java @@ -5,7 +5,12 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; /** * The external security solution properties for AAD solutions. @@ -13,9 +18,8 @@ @Fluent public final class AadSolutionProperties extends ExternalSecuritySolutionProperties { /* - * The connectivity state of the external AAD solution + * The connectivity state of the external AAD solution */ - @JsonProperty(value = "connectivityState") private AadConnectivityState connectivityState; /** @@ -78,6 +82,66 @@ public AadSolutionProperties withWorkspace(ConnectedWorkspace workspace) { */ @Override public void validate() { - super.validate(); + if (workspace() != null) { + workspace().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deviceVendor", deviceVendor()); + jsonWriter.writeStringField("deviceType", deviceType()); + jsonWriter.writeJsonField("workspace", workspace()); + jsonWriter.writeStringField("connectivityState", + this.connectivityState == null ? null : this.connectivityState.toString()); + if (additionalProperties() != null) { + for (Map.Entry additionalProperty : additionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AadSolutionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AadSolutionProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AadSolutionProperties. + */ + public static AadSolutionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AadSolutionProperties deserializedAadSolutionProperties = new AadSolutionProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceVendor".equals(fieldName)) { + deserializedAadSolutionProperties.withDeviceVendor(reader.getString()); + } else if ("deviceType".equals(fieldName)) { + deserializedAadSolutionProperties.withDeviceType(reader.getString()); + } else if ("workspace".equals(fieldName)) { + deserializedAadSolutionProperties.withWorkspace(ConnectedWorkspace.fromJson(reader)); + } else if ("connectivityState".equals(fieldName)) { + deserializedAadSolutionProperties.connectivityState + = AadConnectivityState.fromString(reader.getString()); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedAadSolutionProperties.withAdditionalProperties(additionalProperties); + + return deserializedAadSolutionProperties; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AccessTokenAuthentication.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AccessTokenAuthentication.java new file mode 100644 index 000000000000..5b7c5a7bdb15 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AccessTokenAuthentication.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The environment authentication details. + */ +@Fluent +public final class AccessTokenAuthentication extends Authentication { + /* + * The authentication type + */ + private AuthenticationType authenticationType = AuthenticationType.fromString("AccessToken"); + + /* + * The user name that will be used while authenticating with the onboarded environment + */ + private String username; + + /* + * The access token that will be used while authenticating with the onboarded environment + */ + private String accessToken; + + /** + * Creates an instance of AccessTokenAuthentication class. + */ + public AccessTokenAuthentication() { + } + + /** + * Get the authenticationType property: The authentication type. + * + * @return the authenticationType value. + */ + @Override + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Get the username property: The user name that will be used while authenticating with the onboarded environment. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The user name that will be used while authenticating with the onboarded environment. + * + * @param username the username value to set. + * @return the AccessTokenAuthentication object itself. + */ + public AccessTokenAuthentication withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the accessToken property: The access token that will be used while authenticating with the onboarded + * environment. + * + * @return the accessToken value. + */ + public String accessToken() { + return this.accessToken; + } + + /** + * Set the accessToken property: The access token that will be used while authenticating with the onboarded + * environment. + * + * @param accessToken the accessToken value to set. + * @return the AccessTokenAuthentication object itself. + */ + public AccessTokenAuthentication withAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + jsonWriter.writeStringField("username", this.username); + jsonWriter.writeStringField("accessToken", this.accessToken); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccessTokenAuthentication from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccessTokenAuthentication if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AccessTokenAuthentication. + */ + public static AccessTokenAuthentication fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccessTokenAuthentication deserializedAccessTokenAuthentication = new AccessTokenAuthentication(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationType".equals(fieldName)) { + deserializedAccessTokenAuthentication.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else if ("username".equals(fieldName)) { + deserializedAccessTokenAuthentication.username = reader.getString(); + } else if ("accessToken".equals(fieldName)) { + deserializedAccessTokenAuthentication.accessToken = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAccessTokenAuthentication; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java index e10d2e3b7371..219685a9c196 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionType.java @@ -5,13 +5,17 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** - * The type of the action that will be triggered by the Automation. + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + /** * Static value LogicApp for ActionType. */ @@ -42,7 +46,6 @@ public ActionType() { * @param name a name to look for. * @return the corresponding ActionType. */ - @JsonCreator public static ActionType fromString(String name) { return fromString(name, ActionType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediation.java index 38c754d0aa60..fe65667d6f03 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediation.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediation.java @@ -5,33 +5,34 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Configuration payload for PR Annotations. */ @Fluent -public final class ActionableRemediation { +public final class ActionableRemediation implements JsonSerializable { /* * ActionableRemediation Setting. * None - the setting was never set. * Enabled - ActionableRemediation is enabled. * Disabled - ActionableRemediation is disabled. */ - @JsonProperty(value = "state") private ActionableRemediationState state; /* * Gets or sets list of categories and severity levels. */ - @JsonProperty(value = "categoryConfigurations") private List categoryConfigurations; /* * Repository branch configuration for PR Annotations. */ - @JsonProperty(value = "branchConfiguration") private TargetBranchConfiguration branchConfiguration; /* @@ -40,7 +41,6 @@ public final class ActionableRemediation { * Enabled - Resource should inherit configurations from parent. * Disabled - Resource should not inherit configurations from parent. */ - @JsonProperty(value = "inheritFromParentState") private InheritFromParentState inheritFromParentState; /** @@ -154,4 +154,54 @@ public void validate() { branchConfiguration().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeArrayField("categoryConfigurations", this.categoryConfigurations, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("branchConfiguration", this.branchConfiguration); + jsonWriter.writeStringField("inheritFromParentState", + this.inheritFromParentState == null ? null : this.inheritFromParentState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActionableRemediation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActionableRemediation if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ActionableRemediation. + */ + public static ActionableRemediation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActionableRemediation deserializedActionableRemediation = new ActionableRemediation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedActionableRemediation.state = ActionableRemediationState.fromString(reader.getString()); + } else if ("categoryConfigurations".equals(fieldName)) { + List categoryConfigurations + = reader.readArray(reader1 -> CategoryConfiguration.fromJson(reader1)); + deserializedActionableRemediation.categoryConfigurations = categoryConfigurations; + } else if ("branchConfiguration".equals(fieldName)) { + deserializedActionableRemediation.branchConfiguration = TargetBranchConfiguration.fromJson(reader); + } else if ("inheritFromParentState".equals(fieldName)) { + deserializedActionableRemediation.inheritFromParentState + = InheritFromParentState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedActionableRemediation; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediationState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediationState.java index 3a7ee9c6462b..b91d0c146a17 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediationState.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActionableRemediationState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -45,7 +44,6 @@ public ActionableRemediationState() { * @param name a name to look for. * @return the corresponding ActionableRemediationState. */ - @JsonCreator public static ActionableRemediationState fromString(String name) { return fromString(name, ActionableRemediationState.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActiveConnectionsNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActiveConnectionsNotInAllowedRange.java index b6f0853fa99f..265dc5d3c004 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActiveConnectionsNotInAllowedRange.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ActiveConnectionsNotInAllowedRange.java @@ -5,28 +5,22 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; /** * Number of active connections is not in allowed range. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = ActiveConnectionsNotInAllowedRange.class, - visible = true) -@JsonTypeName("ActiveConnectionsNotInAllowedRange") @Fluent public final class ActiveConnectionsNotInAllowedRange extends TimeWindowCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "ActiveConnectionsNotInAllowedRange"; /** @@ -88,6 +82,67 @@ public ActiveConnectionsNotInAllowedRange withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); + if (timeWindowSize() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeWindowSize in model ActiveConnectionsNotInAllowedRange")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActiveConnectionsNotInAllowedRange.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeIntField("minThreshold", minThreshold()); + jsonWriter.writeIntField("maxThreshold", maxThreshold()); + jsonWriter.writeStringField("timeWindowSize", CoreUtils.durationToStringWithDays(timeWindowSize())); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActiveConnectionsNotInAllowedRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActiveConnectionsNotInAllowedRange if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActiveConnectionsNotInAllowedRange. + */ + public static ActiveConnectionsNotInAllowedRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActiveConnectionsNotInAllowedRange deserializedActiveConnectionsNotInAllowedRange + = new ActiveConnectionsNotInAllowedRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedActiveConnectionsNotInAllowedRange.withIsEnabled(reader.getBoolean()); + } else if ("minThreshold".equals(fieldName)) { + deserializedActiveConnectionsNotInAllowedRange.withMinThreshold(reader.getInt()); + } else if ("maxThreshold".equals(fieldName)) { + deserializedActiveConnectionsNotInAllowedRange.withMaxThreshold(reader.getInt()); + } else if ("timeWindowSize".equals(fieldName)) { + deserializedActiveConnectionsNotInAllowedRange.withTimeWindowSize( + reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()))); + } else if ("displayName".equals(fieldName)) { + deserializedActiveConnectionsNotInAllowedRange.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedActiveConnectionsNotInAllowedRange.withDescription(reader.getString()); + } else if ("ruleType".equals(fieldName)) { + deserializedActiveConnectionsNotInAllowedRange.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActiveConnectionsNotInAllowedRange; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroup.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroup.java deleted file mode 100644 index 7f2d4319197a..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroup.java +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.management.Region; -import com.azure.core.util.Context; -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner; -import java.util.List; - -/** - * An immutable client-side representation of AdaptiveApplicationControlGroup. - */ -public interface AdaptiveApplicationControlGroup { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: Location where the resource is stored. - * - * @return the location value. - */ - String location(); - - /** - * Gets the enforcementMode property: The application control policy enforcement/protection mode of the machine - * group. - * - * @return the enforcementMode value. - */ - EnforcementMode enforcementMode(); - - /** - * Gets the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script are used for - * Windows, Executable is used for Linux. - * - * @return the protectionMode value. - */ - ProtectionMode protectionMode(); - - /** - * Gets the configurationStatus property: The configuration status of the machines group or machine or rule. - * - * @return the configurationStatus value. - */ - ConfigurationStatus configurationStatus(); - - /** - * Gets the recommendationStatus property: The initial recommendation status of the machine group or machine. - * - * @return the recommendationStatus value. - */ - RecommendationStatus recommendationStatus(); - - /** - * Gets the issues property: The issues property. - * - * @return the issues value. - */ - List issues(); - - /** - * Gets the sourceSystem property: The source type of the machine group. - * - * @return the sourceSystem value. - */ - SourceSystem sourceSystem(); - - /** - * Gets the vmRecommendations property: The vmRecommendations property. - * - * @return the vmRecommendations value. - */ - List vmRecommendations(); - - /** - * Gets the pathRecommendations property: The pathRecommendations property. - * - * @return the pathRecommendations value. - */ - List pathRecommendations(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the inner com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupInner object. - * - * @return the inner object. - */ - AdaptiveApplicationControlGroupInner innerModel(); - - /** - * The entirety of the AdaptiveApplicationControlGroup definition. - */ - interface Definition - extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { - } - - /** - * The AdaptiveApplicationControlGroup definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the AdaptiveApplicationControlGroup definition. - */ - interface Blank extends WithParentResource { - } - - /** - * The stage of the AdaptiveApplicationControlGroup definition allowing to specify parent resource. - */ - interface WithParentResource { - /** - * Specifies ascLocation. - * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @return the next definition stage. - */ - WithCreate withExistingLocation(String ascLocation); - } - - /** - * The stage of the AdaptiveApplicationControlGroup definition which contains all the minimum required - * properties for the resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithEnforcementMode, DefinitionStages.WithProtectionMode, - DefinitionStages.WithVmRecommendations, DefinitionStages.WithPathRecommendations { - /** - * Executes the create request. - * - * @return the created resource. - */ - AdaptiveApplicationControlGroup create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - AdaptiveApplicationControlGroup create(Context context); - } - - /** - * The stage of the AdaptiveApplicationControlGroup definition allowing to specify enforcementMode. - */ - interface WithEnforcementMode { - /** - * Specifies the enforcementMode property: The application control policy enforcement/protection mode of the - * machine group. - * - * @param enforcementMode The application control policy enforcement/protection mode of the machine group. - * @return the next definition stage. - */ - WithCreate withEnforcementMode(EnforcementMode enforcementMode); - } - - /** - * The stage of the AdaptiveApplicationControlGroup definition allowing to specify protectionMode. - */ - interface WithProtectionMode { - /** - * Specifies the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script - * are used for Windows, Executable is used for Linux.. - * - * @param protectionMode The protection mode of the collection/file types. Exe/Msi/Script are used for - * Windows, Executable is used for Linux. - * @return the next definition stage. - */ - WithCreate withProtectionMode(ProtectionMode protectionMode); - } - - /** - * The stage of the AdaptiveApplicationControlGroup definition allowing to specify vmRecommendations. - */ - interface WithVmRecommendations { - /** - * Specifies the vmRecommendations property: The vmRecommendations property.. - * - * @param vmRecommendations The vmRecommendations property. - * @return the next definition stage. - */ - WithCreate withVmRecommendations(List vmRecommendations); - } - - /** - * The stage of the AdaptiveApplicationControlGroup definition allowing to specify pathRecommendations. - */ - interface WithPathRecommendations { - /** - * Specifies the pathRecommendations property: The pathRecommendations property.. - * - * @param pathRecommendations The pathRecommendations property. - * @return the next definition stage. - */ - WithCreate withPathRecommendations(List pathRecommendations); - } - } - - /** - * Begins update for the AdaptiveApplicationControlGroup resource. - * - * @return the stage of resource update. - */ - AdaptiveApplicationControlGroup.Update update(); - - /** - * The template for AdaptiveApplicationControlGroup update. - */ - interface Update extends UpdateStages.WithEnforcementMode, UpdateStages.WithProtectionMode, - UpdateStages.WithVmRecommendations, UpdateStages.WithPathRecommendations { - /** - * Executes the update request. - * - * @return the updated resource. - */ - AdaptiveApplicationControlGroup apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - AdaptiveApplicationControlGroup apply(Context context); - } - - /** - * The AdaptiveApplicationControlGroup update stages. - */ - interface UpdateStages { - /** - * The stage of the AdaptiveApplicationControlGroup update allowing to specify enforcementMode. - */ - interface WithEnforcementMode { - /** - * Specifies the enforcementMode property: The application control policy enforcement/protection mode of the - * machine group. - * - * @param enforcementMode The application control policy enforcement/protection mode of the machine group. - * @return the next definition stage. - */ - Update withEnforcementMode(EnforcementMode enforcementMode); - } - - /** - * The stage of the AdaptiveApplicationControlGroup update allowing to specify protectionMode. - */ - interface WithProtectionMode { - /** - * Specifies the protectionMode property: The protection mode of the collection/file types. Exe/Msi/Script - * are used for Windows, Executable is used for Linux.. - * - * @param protectionMode The protection mode of the collection/file types. Exe/Msi/Script are used for - * Windows, Executable is used for Linux. - * @return the next definition stage. - */ - Update withProtectionMode(ProtectionMode protectionMode); - } - - /** - * The stage of the AdaptiveApplicationControlGroup update allowing to specify vmRecommendations. - */ - interface WithVmRecommendations { - /** - * Specifies the vmRecommendations property: The vmRecommendations property.. - * - * @param vmRecommendations The vmRecommendations property. - * @return the next definition stage. - */ - Update withVmRecommendations(List vmRecommendations); - } - - /** - * The stage of the AdaptiveApplicationControlGroup update allowing to specify pathRecommendations. - */ - interface WithPathRecommendations { - /** - * Specifies the pathRecommendations property: The pathRecommendations property.. - * - * @param pathRecommendations The pathRecommendations property. - * @return the next definition stage. - */ - Update withPathRecommendations(List pathRecommendations); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - AdaptiveApplicationControlGroup refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - AdaptiveApplicationControlGroup refresh(Context context); -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroups.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroups.java deleted file mode 100644 index 259c22a7be24..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlGroups.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner; -import java.util.List; - -/** - * An immutable client-side representation of AdaptiveApplicationControlGroups. - */ -public interface AdaptiveApplicationControlGroups { - /** - * Gets the value property: The value property. - * - * @return the value value. - */ - List value(); - - /** - * Gets the inner com.azure.resourcemanager.security.fluent.models.AdaptiveApplicationControlGroupsInner object. - * - * @return the inner object. - */ - AdaptiveApplicationControlGroupsInner innerModel(); -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssue.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssue.java deleted file mode 100644 index 660a6b156bc5..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssue.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * An alert that machines within a group can have. - */ -public final class AdaptiveApplicationControlIssue extends ExpandableStringEnum { - /** - * Static value ViolationsAudited for AdaptiveApplicationControlIssue. - */ - public static final AdaptiveApplicationControlIssue VIOLATIONS_AUDITED = fromString("ViolationsAudited"); - - /** - * Static value ViolationsBlocked for AdaptiveApplicationControlIssue. - */ - public static final AdaptiveApplicationControlIssue VIOLATIONS_BLOCKED = fromString("ViolationsBlocked"); - - /** - * Static value MsiAndScriptViolationsAudited for AdaptiveApplicationControlIssue. - */ - public static final AdaptiveApplicationControlIssue MSI_AND_SCRIPT_VIOLATIONS_AUDITED - = fromString("MsiAndScriptViolationsAudited"); - - /** - * Static value MsiAndScriptViolationsBlocked for AdaptiveApplicationControlIssue. - */ - public static final AdaptiveApplicationControlIssue MSI_AND_SCRIPT_VIOLATIONS_BLOCKED - = fromString("MsiAndScriptViolationsBlocked"); - - /** - * Static value ExecutableViolationsAudited for AdaptiveApplicationControlIssue. - */ - public static final AdaptiveApplicationControlIssue EXECUTABLE_VIOLATIONS_AUDITED - = fromString("ExecutableViolationsAudited"); - - /** - * Static value RulesViolatedManually for AdaptiveApplicationControlIssue. - */ - public static final AdaptiveApplicationControlIssue RULES_VIOLATED_MANUALLY = fromString("RulesViolatedManually"); - - /** - * Creates a new instance of AdaptiveApplicationControlIssue value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public AdaptiveApplicationControlIssue() { - } - - /** - * Creates or finds a AdaptiveApplicationControlIssue from its string representation. - * - * @param name a name to look for. - * @return the corresponding AdaptiveApplicationControlIssue. - */ - @JsonCreator - public static AdaptiveApplicationControlIssue fromString(String name) { - return fromString(name, AdaptiveApplicationControlIssue.class); - } - - /** - * Gets known AdaptiveApplicationControlIssue values. - * - * @return known AdaptiveApplicationControlIssue values. - */ - public static Collection values() { - return values(AdaptiveApplicationControlIssue.class); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssueSummary.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssueSummary.java deleted file mode 100644 index dedc12ab3abf..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControlIssueSummary.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Represents a summary of the alerts of the machine group. - */ -@Fluent -public final class AdaptiveApplicationControlIssueSummary { - /* - * An alert that machines within a group can have - */ - @JsonProperty(value = "issue") - private AdaptiveApplicationControlIssue issue; - - /* - * The number of machines in the group that have this alert - */ - @JsonProperty(value = "numberOfVms") - private Float numberOfVms; - - /** - * Creates an instance of AdaptiveApplicationControlIssueSummary class. - */ - public AdaptiveApplicationControlIssueSummary() { - } - - /** - * Get the issue property: An alert that machines within a group can have. - * - * @return the issue value. - */ - public AdaptiveApplicationControlIssue issue() { - return this.issue; - } - - /** - * Set the issue property: An alert that machines within a group can have. - * - * @param issue the issue value to set. - * @return the AdaptiveApplicationControlIssueSummary object itself. - */ - public AdaptiveApplicationControlIssueSummary withIssue(AdaptiveApplicationControlIssue issue) { - this.issue = issue; - return this; - } - - /** - * Get the numberOfVms property: The number of machines in the group that have this alert. - * - * @return the numberOfVms value. - */ - public Float numberOfVms() { - return this.numberOfVms; - } - - /** - * Set the numberOfVms property: The number of machines in the group that have this alert. - * - * @param numberOfVms the numberOfVms value to set. - * @return the AdaptiveApplicationControlIssueSummary object itself. - */ - public AdaptiveApplicationControlIssueSummary withNumberOfVms(Float numberOfVms) { - this.numberOfVms = numberOfVms; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardening.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardening.java deleted file mode 100644 index 7909db507d64..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardening.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; -import java.time.OffsetDateTime; -import java.util.List; - -/** - * An immutable client-side representation of AdaptiveNetworkHardening. - */ -public interface AdaptiveNetworkHardening { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the rules property: The security rules which are recommended to be effective on the VM. - * - * @return the rules value. - */ - List rules(); - - /** - * Gets the rulesCalculationTime property: The UTC time on which the rules were calculated. - * - * @return the rulesCalculationTime value. - */ - OffsetDateTime rulesCalculationTime(); - - /** - * Gets the effectiveNetworkSecurityGroups property: The Network Security Groups effective on the network interfaces - * of the protected resource. - * - * @return the effectiveNetworkSecurityGroups value. - */ - List effectiveNetworkSecurityGroups(); - - /** - * Gets the inner com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner object. - * - * @return the inner object. - */ - AdaptiveNetworkHardeningInner innerModel(); -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningEnforceRequest.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningEnforceRequest.java deleted file mode 100644 index 65c811c377a9..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningEnforceRequest.java +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** - * The AdaptiveNetworkHardeningEnforceRequest model. - */ -@Fluent -public final class AdaptiveNetworkHardeningEnforceRequest { - /* - * The rules to enforce - */ - @JsonProperty(value = "rules", required = true) - private List rules; - - /* - * The Azure resource IDs of the effective network security groups that will be updated with the created security rules from the Adaptive Network Hardening rules - */ - @JsonProperty(value = "networkSecurityGroups", required = true) - private List networkSecurityGroups; - - /** - * Creates an instance of AdaptiveNetworkHardeningEnforceRequest class. - */ - public AdaptiveNetworkHardeningEnforceRequest() { - } - - /** - * Get the rules property: The rules to enforce. - * - * @return the rules value. - */ - public List rules() { - return this.rules; - } - - /** - * Set the rules property: The rules to enforce. - * - * @param rules the rules value to set. - * @return the AdaptiveNetworkHardeningEnforceRequest object itself. - */ - public AdaptiveNetworkHardeningEnforceRequest withRules(List rules) { - this.rules = rules; - return this; - } - - /** - * Get the networkSecurityGroups property: The Azure resource IDs of the effective network security groups that will - * be updated with the created security rules from the Adaptive Network Hardening rules. - * - * @return the networkSecurityGroups value. - */ - public List networkSecurityGroups() { - return this.networkSecurityGroups; - } - - /** - * Set the networkSecurityGroups property: The Azure resource IDs of the effective network security groups that will - * be updated with the created security rules from the Adaptive Network Hardening rules. - * - * @param networkSecurityGroups the networkSecurityGroups value to set. - * @return the AdaptiveNetworkHardeningEnforceRequest object itself. - */ - public AdaptiveNetworkHardeningEnforceRequest withNetworkSecurityGroups(List networkSecurityGroups) { - this.networkSecurityGroups = networkSecurityGroups; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (rules() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property rules in model AdaptiveNetworkHardeningEnforceRequest")); - } else { - rules().forEach(e -> e.validate()); - } - if (networkSecurityGroups() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property networkSecurityGroups in model AdaptiveNetworkHardeningEnforceRequest")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(AdaptiveNetworkHardeningEnforceRequest.class); -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardenings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardenings.java deleted file mode 100644 index 2adb4a994600..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardenings.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of AdaptiveNetworkHardenings. - */ -public interface AdaptiveNetworkHardenings { - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource as paginated response - * with {@link PagedIterable}. - */ - PagedIterable listByExtendedResource(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName); - - /** - * Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of Adaptive Network Hardenings resources in scope of an extended resource as paginated response - * with {@link PagedIterable}. - */ - PagedIterable listByExtendedResource(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, Context context); - - /** - * Gets a single Adaptive Network Hardening resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single Adaptive Network Hardening resource along with {@link Response}. - */ - Response getWithResponse(String resourceGroupName, String resourceNamespace, - String resourceType, String resourceName, String adaptiveNetworkHardeningResourceName, Context context); - - /** - * Gets a single Adaptive Network Hardening resource. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single Adaptive Network Hardening resource. - */ - AdaptiveNetworkHardening get(String resourceGroupName, String resourceNamespace, String resourceType, - String resourceName, String adaptiveNetworkHardeningResourceName); - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void enforce(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, - String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body); - - /** - * Enforces the given rules on the NSG(s) listed in the request. - * - * @param resourceGroupName The name of the resource group within the user's subscription. The name is case - * insensitive. - * @param resourceNamespace The Namespace of the resource. - * @param resourceType The type of the resource. - * @param resourceName Name of the resource. - * @param adaptiveNetworkHardeningResourceName The name of the Adaptive Network Hardening resource. - * @param body The body parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void enforce(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, - String adaptiveNetworkHardeningResourceName, AdaptiveNetworkHardeningEnforceRequest body, Context context); -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningsList.java deleted file mode 100644 index 45483b050a14..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveNetworkHardeningsList.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.annotation.Fluent; -import com.azure.resourcemanager.security.fluent.models.AdaptiveNetworkHardeningInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** - * Response for ListAdaptiveNetworkHardenings API service call. - */ -@Fluent -public final class AdaptiveNetworkHardeningsList { - /* - * A list of Adaptive Network Hardenings resources - */ - @JsonProperty(value = "value") - private List value; - - /* - * The URL to get the next set of results - */ - @JsonProperty(value = "nextLink") - private String nextLink; - - /** - * Creates an instance of AdaptiveNetworkHardeningsList class. - */ - public AdaptiveNetworkHardeningsList() { - } - - /** - * Get the value property: A list of Adaptive Network Hardenings resources. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: A list of Adaptive Network Hardenings resources. - * - * @param value the value value to set. - * @return the AdaptiveNetworkHardeningsList object itself. - */ - public AdaptiveNetworkHardeningsList withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The URL to get the next set of results. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The URL to get the next set of results. - * - * @param nextLink the nextLink value to set. - * @return the AdaptiveNetworkHardeningsList object itself. - */ - public AdaptiveNetworkHardeningsList withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java index f2bf72b93404..b24352cd743f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalData.java @@ -5,39 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Details of the sub-assessment. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "assessedResourceType", - defaultImpl = AdditionalData.class, - visible = true) -@JsonTypeName("AdditionalData") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "SqlServerVulnerability", value = SqlServerVulnerabilityProperties.class), - @JsonSubTypes.Type(name = "ContainerRegistryVulnerability", value = ContainerRegistryVulnerabilityProperties.class), - @JsonSubTypes.Type(name = "ServerVulnerabilityAssessment", value = ServerVulnerabilityProperties.class) }) @Immutable -public class AdditionalData { +public class AdditionalData implements JsonSerializable { /* * Sub-assessment resource type */ - @JsonTypeId - @JsonProperty(value = "assessedResourceType", required = true) - private AssessedResourceType assessedResourceType; + private AssessedResourceType assessedResourceType = AssessedResourceType.fromString("AdditionalData"); /** * Creates an instance of AdditionalData class. */ public AdditionalData() { - this.assessedResourceType = AssessedResourceType.fromString("AdditionalData"); } /** @@ -56,4 +43,71 @@ public AssessedResourceType assessedResourceType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("assessedResourceType", + this.assessedResourceType == null ? null : this.assessedResourceType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdditionalData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdditionalData if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AdditionalData. + */ + public static AdditionalData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("assessedResourceType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("SqlServerVulnerability".equals(discriminatorValue)) { + return SqlServerVulnerabilityProperties.fromJson(readerToUse.reset()); + } else if ("ContainerRegistryVulnerability".equals(discriminatorValue)) { + return ContainerRegistryVulnerabilityProperties.fromJson(readerToUse.reset()); + } else if ("ServerVulnerabilityAssessment".equals(discriminatorValue)) { + return ServerVulnerabilityProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AdditionalData fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdditionalData deserializedAdditionalData = new AdditionalData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessedResourceType".equals(fieldName)) { + deserializedAdditionalData.assessedResourceType + = AssessedResourceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAdditionalData; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceDataType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceDataType.java index 3fede74e031e..41cc4fa41f22 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceDataType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceDataType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public AdditionalWorkspaceDataType() { * @param name a name to look for. * @return the corresponding AdditionalWorkspaceDataType. */ - @JsonCreator public static AdditionalWorkspaceDataType fromString(String name) { return fromString(name, AdditionalWorkspaceDataType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceType.java index 51f98a039b2b..c5b5efcdfb25 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspaceType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public AdditionalWorkspaceType() { * @param name a name to look for. * @return the corresponding AdditionalWorkspaceType. */ - @JsonCreator public static AdditionalWorkspaceType fromString(String name) { return fromString(name, AdditionalWorkspaceType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspacesProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspacesProperties.java index 83f3eef478b3..b8926f47de49 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspacesProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdditionalWorkspacesProperties.java @@ -5,30 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Properties of the additional workspaces. */ @Fluent -public final class AdditionalWorkspacesProperties { +public final class AdditionalWorkspacesProperties implements JsonSerializable { /* * Workspace resource id */ - @JsonProperty(value = "workspace") private String workspace; /* * Workspace type. */ - @JsonProperty(value = "type") private AdditionalWorkspaceType type; /* * List of data types sent to workspace */ - @JsonProperty(value = "dataTypes") private List dataTypes; /** @@ -104,4 +105,51 @@ public AdditionalWorkspacesProperties withDataTypes(List writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdditionalWorkspacesProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdditionalWorkspacesProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AdditionalWorkspacesProperties. + */ + public static AdditionalWorkspacesProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdditionalWorkspacesProperties deserializedAdditionalWorkspacesProperties + = new AdditionalWorkspacesProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("workspace".equals(fieldName)) { + deserializedAdditionalWorkspacesProperties.workspace = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAdditionalWorkspacesProperties.type + = AdditionalWorkspaceType.fromString(reader.getString()); + } else if ("dataTypes".equals(fieldName)) { + List dataTypes + = reader.readArray(reader1 -> AdditionalWorkspaceDataType.fromString(reader1.getString())); + deserializedAdditionalWorkspacesProperties.dataTypes = dataTypes; + } else { + reader.skipChildren(); + } + } + + return deserializedAdditionalWorkspacesProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertEntity.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertEntity.java index 1f984f888d8d..229db8e7a399 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertEntity.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertEntity.java @@ -5,28 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; /** * Changing set of properties depending on the entity type. */ @Fluent -public final class AlertEntity { +public final class AlertEntity implements JsonSerializable { /* * Type of entity */ - @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) private String type; /* * Changing set of properties depending on the entity type. */ - @JsonIgnore private Map additionalProperties; /** @@ -49,7 +48,6 @@ public String type() { * * @return the additionalProperties value. */ - @JsonAnyGetter public Map additionalProperties() { return this.additionalProperties; } @@ -65,14 +63,6 @@ public AlertEntity withAdditionalProperties(Map additionalProper return this; } - @JsonAnySetter - void withAdditionalProperties(String key, Object value) { - if (additionalProperties == null) { - additionalProperties = new HashMap<>(); - } - additionalProperties.put(key, value); - } - /** * Validates the instance. * @@ -80,4 +70,50 @@ void withAdditionalProperties(String key, Object value) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertEntity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertEntity if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AlertEntity. + */ + public static AlertEntity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertEntity deserializedAlertEntity = new AlertEntity(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedAlertEntity.type = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedAlertEntity.additionalProperties = additionalProperties; + + return deserializedAlertEntity; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertList.java index 3e68de674d55..67541f5bea5a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AlertInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of security alerts. */ @Fluent -public final class AlertList { +public final class AlertList implements JsonSerializable { /* * describes security alert properties. */ - @JsonProperty(value = "value") private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -71,4 +73,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertList if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the AlertList. + */ + public static AlertList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertList deserializedAlertList = new AlertList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> AlertInner.fromJson(reader1)); + deserializedAlertList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAlertList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertPropertiesSupportingEvidence.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertPropertiesSupportingEvidence.java index a26abb60d3f0..712934628221 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertPropertiesSupportingEvidence.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertPropertiesSupportingEvidence.java @@ -5,28 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; /** * Changing set of properties depending on the supportingEvidence type. */ @Fluent -public final class AlertPropertiesSupportingEvidence { +public final class AlertPropertiesSupportingEvidence implements JsonSerializable { /* * Type of the supportingEvidence */ - @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) private String type; /* * Changing set of properties depending on the supportingEvidence type. */ - @JsonIgnore private Map additionalProperties; /** @@ -49,7 +48,6 @@ public String type() { * * @return the additionalProperties value. */ - @JsonAnyGetter public Map additionalProperties() { return this.additionalProperties; } @@ -65,14 +63,6 @@ public AlertPropertiesSupportingEvidence withAdditionalProperties(Map(); - } - additionalProperties.put(key, value); - } - /** * Validates the instance. * @@ -80,4 +70,51 @@ void withAdditionalProperties(String key, Object value) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertPropertiesSupportingEvidence from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertPropertiesSupportingEvidence if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AlertPropertiesSupportingEvidence. + */ + public static AlertPropertiesSupportingEvidence fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertPropertiesSupportingEvidence deserializedAlertPropertiesSupportingEvidence + = new AlertPropertiesSupportingEvidence(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedAlertPropertiesSupportingEvidence.type = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedAlertPropertiesSupportingEvidence.additionalProperties = additionalProperties; + + return deserializedAlertPropertiesSupportingEvidence; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSeverity.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSeverity.java index 70543515ed02..09b8357a5737 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSeverity.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSeverity.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -48,7 +47,6 @@ public AlertSeverity() { * @param name a name to look for. * @return the corresponding AlertSeverity. */ - @JsonCreator public static AlertSeverity fromString(String name) { return fromString(name, AlertSeverity.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorBundlesRequestProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorBundlesRequestProperties.java index f090562941a8..633e332e8bf9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorBundlesRequestProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorBundlesRequestProperties.java @@ -5,34 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; /** * Simulate alerts according to this bundles. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "kind", - defaultImpl = AlertSimulatorBundlesRequestProperties.class, - visible = true) -@JsonTypeName("Bundles") @Fluent public final class AlertSimulatorBundlesRequestProperties extends AlertSimulatorRequestProperties { /* * The kind of alert simulation. */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) private Kind kind = Kind.BUNDLES; /* * Bundles list. */ - @JsonProperty(value = "bundles") private List bundles; /** @@ -78,6 +71,58 @@ public AlertSimulatorBundlesRequestProperties withBundles(List bundl */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeArrayField("bundles", this.bundles, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + if (additionalProperties() != null) { + for (Map.Entry additionalProperty : additionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertSimulatorBundlesRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertSimulatorBundlesRequestProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AlertSimulatorBundlesRequestProperties. + */ + public static AlertSimulatorBundlesRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertSimulatorBundlesRequestProperties deserializedAlertSimulatorBundlesRequestProperties + = new AlertSimulatorBundlesRequestProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedAlertSimulatorBundlesRequestProperties.kind = Kind.fromString(reader.getString()); + } else if ("bundles".equals(fieldName)) { + List bundles = reader.readArray(reader1 -> BundleType.fromString(reader1.getString())); + deserializedAlertSimulatorBundlesRequestProperties.bundles = bundles; + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedAlertSimulatorBundlesRequestProperties.withAdditionalProperties(additionalProperties); + + return deserializedAlertSimulatorBundlesRequestProperties; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestBody.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestBody.java index 68b3a74dde86..8cf26c9f2735 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestBody.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestBody.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Alert Simulator request body. */ @Fluent -public final class AlertSimulatorRequestBody { +public final class AlertSimulatorRequestBody implements JsonSerializable { /* * Alert Simulator request body data. */ - @JsonProperty(value = "properties") private AlertSimulatorRequestProperties properties; /** @@ -54,4 +57,40 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertSimulatorRequestBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertSimulatorRequestBody if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AlertSimulatorRequestBody. + */ + public static AlertSimulatorRequestBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertSimulatorRequestBody deserializedAlertSimulatorRequestBody = new AlertSimulatorRequestBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedAlertSimulatorRequestBody.properties = AlertSimulatorRequestProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertSimulatorRequestBody; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestProperties.java index c798a3bb0d2a..77524b693d6c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSimulatorRequestProperties.java @@ -5,47 +5,33 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import java.util.HashMap; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; /** * Describes properties of an alert simulation request. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "kind", - defaultImpl = AlertSimulatorRequestProperties.class, - visible = true) -@JsonTypeName("AlertSimulatorRequestProperties") -@JsonSubTypes({ @JsonSubTypes.Type(name = "Bundles", value = AlertSimulatorBundlesRequestProperties.class) }) @Fluent -public class AlertSimulatorRequestProperties { +public class AlertSimulatorRequestProperties implements JsonSerializable { /* * The kind of alert simulation. */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) - private Kind kind; + private Kind kind = Kind.fromString("AlertSimulatorRequestProperties"); /* * Describes properties of an alert simulation request */ - @JsonIgnore private Map additionalProperties; /** * Creates an instance of AlertSimulatorRequestProperties class. */ public AlertSimulatorRequestProperties() { - this.kind = Kind.fromString("AlertSimulatorRequestProperties"); } /** @@ -62,7 +48,6 @@ public Kind kind() { * * @return the additionalProperties value. */ - @JsonAnyGetter public Map additionalProperties() { return this.additionalProperties; } @@ -78,14 +63,6 @@ public AlertSimulatorRequestProperties withAdditionalProperties(Map(); - } - additionalProperties.put(key, value); - } - /** * Validates the instance. * @@ -93,4 +70,77 @@ void withAdditionalProperties(String key, Object value) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertSimulatorRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertSimulatorRequestProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AlertSimulatorRequestProperties. + */ + public static AlertSimulatorRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Bundles".equals(discriminatorValue)) { + return AlertSimulatorBundlesRequestProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AlertSimulatorRequestProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertSimulatorRequestProperties deserializedAlertSimulatorRequestProperties + = new AlertSimulatorRequestProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedAlertSimulatorRequestProperties.kind = Kind.fromString(reader.getString()); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedAlertSimulatorRequestProperties.additionalProperties = additionalProperties; + + return deserializedAlertSimulatorRequestProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertStatus.java index 833c884ccc65..bc572862ced7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertStatus.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public AlertStatus() { * @param name a name to look for. * @return the corresponding AlertStatus. */ - @JsonCreator public static AlertStatus fromString(String name) { return fromString(name, AlertStatus.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSyncSettings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSyncSettings.java index 1e80a32f300a..f6c775fdc51b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSyncSettings.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertSyncSettings.java @@ -5,33 +5,43 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AlertSyncSettingProperties; import com.azure.resourcemanager.security.fluent.models.SettingInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Represents an alert sync setting. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "kind", defaultImpl = AlertSyncSettings.class, visible = true) -@JsonTypeName("AlertSyncSettings") @Fluent public final class AlertSyncSettings extends SettingInner { /* * the kind of the settings string */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) private SettingKind kind = SettingKind.ALERT_SYNC_SETTINGS; /* * Alert sync setting data */ - @JsonProperty(value = "properties") private AlertSyncSettingProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AlertSyncSettings class. */ @@ -57,6 +67,36 @@ private AlertSyncSettingProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the enabled property: Is the alert sync setting enabled. * @@ -87,9 +127,54 @@ public AlertSyncSettings withEnabled(Boolean enabled) { */ @Override public void validate() { - super.validate(); if (innerProperties() != null) { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertSyncSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertSyncSettings if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AlertSyncSettings. + */ + public static AlertSyncSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertSyncSettings deserializedAlertSyncSettings = new AlertSyncSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAlertSyncSettings.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAlertSyncSettings.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAlertSyncSettings.type = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedAlertSyncSettings.kind = SettingKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedAlertSyncSettings.innerProperties = AlertSyncSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertSyncSettings; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java index f29384472d74..ff81c7d5c1e4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AlertsSuppressionRulesList.java @@ -6,25 +6,27 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AlertsSuppressionRuleInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Suppression rules list for subscription. */ @Fluent -public final class AlertsSuppressionRulesList { +public final class AlertsSuppressionRulesList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value", required = true) private List value; /* * URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -78,4 +80,45 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AlertsSuppressionRulesList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AlertsSuppressionRulesList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AlertsSuppressionRulesList if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AlertsSuppressionRulesList. + */ + public static AlertsSuppressionRulesList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AlertsSuppressionRulesList deserializedAlertsSuppressionRulesList = new AlertsSuppressionRulesList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AlertsSuppressionRuleInner.fromJson(reader1)); + deserializedAlertsSuppressionRulesList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAlertsSuppressionRulesList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAlertsSuppressionRulesList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsList.java index f6d956c3eff2..856df5411a66 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowedConnectionsList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AllowedConnectionsResourceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of all possible traffic between Azure resources. */ @Immutable -public final class AllowedConnectionsList { +public final class AllowedConnectionsList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AllowedConnectionsList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AllowedConnectionsList if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AllowedConnectionsList. + */ + public static AllowedConnectionsList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AllowedConnectionsList deserializedAllowedConnectionsList = new AllowedConnectionsList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AllowedConnectionsResourceInner.fromJson(reader1)); + deserializedAllowedConnectionsList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAllowedConnectionsList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAllowedConnectionsList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowlistCustomAlertRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowlistCustomAlertRule.java index adae899dafef..14b5a1554da9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowlistCustomAlertRule.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AllowlistCustomAlertRule.java @@ -6,40 +6,25 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * A custom alert rule that checks if a value (depends on the custom alert type) is allowed. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = AllowlistCustomAlertRule.class, - visible = true) -@JsonTypeName("AllowlistCustomAlertRule") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "ConnectionToIpNotAllowed", value = ConnectionToIpNotAllowed.class), - @JsonSubTypes.Type(name = "ConnectionFromIpNotAllowed", value = ConnectionFromIpNotAllowed.class), - @JsonSubTypes.Type(name = "LocalUserNotAllowed", value = LocalUserNotAllowed.class), - @JsonSubTypes.Type(name = "ProcessNotAllowed", value = ProcessNotAllowed.class) }) @Fluent public class AllowlistCustomAlertRule extends ListCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "AllowlistCustomAlertRule"; /* * The values to allow. The format of the values depends on the rule type. */ - @JsonProperty(value = "allowlistValues", required = true) private List allowlistValues; /** @@ -94,7 +79,6 @@ public AllowlistCustomAlertRule withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); if (allowlistValues() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -103,4 +87,86 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AllowlistCustomAlertRule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeArrayField("allowlistValues", this.allowlistValues, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AllowlistCustomAlertRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AllowlistCustomAlertRule if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AllowlistCustomAlertRule. + */ + public static AllowlistCustomAlertRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("ruleType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("ConnectionToIpNotAllowed".equals(discriminatorValue)) { + return ConnectionToIpNotAllowed.fromJson(readerToUse.reset()); + } else if ("ConnectionFromIpNotAllowed".equals(discriminatorValue)) { + return ConnectionFromIpNotAllowed.fromJson(readerToUse.reset()); + } else if ("LocalUserNotAllowed".equals(discriminatorValue)) { + return LocalUserNotAllowed.fromJson(readerToUse.reset()); + } else if ("ProcessNotAllowed".equals(discriminatorValue)) { + return ProcessNotAllowed.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AllowlistCustomAlertRule fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AllowlistCustomAlertRule deserializedAllowlistCustomAlertRule = new AllowlistCustomAlertRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedAllowlistCustomAlertRule.withIsEnabled(reader.getBoolean()); + } else if ("displayName".equals(fieldName)) { + deserializedAllowlistCustomAlertRule.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedAllowlistCustomAlertRule.withDescription(reader.getString()); + } else if ("valueType".equals(fieldName)) { + deserializedAllowlistCustomAlertRule.withValueType(ValueType.fromString(reader.getString())); + } else if ("allowlistValues".equals(fieldName)) { + List allowlistValues = reader.readArray(reader1 -> reader1.getString()); + deserializedAllowlistCustomAlertRule.allowlistValues = allowlistValues; + } else if ("ruleType".equals(fieldName)) { + deserializedAllowlistCustomAlertRule.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAllowlistCustomAlertRule; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DMessagesNotInAllowedRange.java index ce50e58ce083..2f857312829e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DMessagesNotInAllowedRange.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DMessagesNotInAllowedRange.java @@ -5,28 +5,22 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; /** * Number of cloud to device messages (AMQP protocol) is not in allowed range. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = AmqpC2DMessagesNotInAllowedRange.class, - visible = true) -@JsonTypeName("AmqpC2DMessagesNotInAllowedRange") @Fluent public final class AmqpC2DMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "AmqpC2DMessagesNotInAllowedRange"; /** @@ -88,6 +82,67 @@ public AmqpC2DMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); + if (timeWindowSize() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeWindowSize in model AmqpC2DMessagesNotInAllowedRange")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AmqpC2DMessagesNotInAllowedRange.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeIntField("minThreshold", minThreshold()); + jsonWriter.writeIntField("maxThreshold", maxThreshold()); + jsonWriter.writeStringField("timeWindowSize", CoreUtils.durationToStringWithDays(timeWindowSize())); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AmqpC2DMessagesNotInAllowedRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AmqpC2DMessagesNotInAllowedRange if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AmqpC2DMessagesNotInAllowedRange. + */ + public static AmqpC2DMessagesNotInAllowedRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AmqpC2DMessagesNotInAllowedRange deserializedAmqpC2DMessagesNotInAllowedRange + = new AmqpC2DMessagesNotInAllowedRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedAmqpC2DMessagesNotInAllowedRange.withIsEnabled(reader.getBoolean()); + } else if ("minThreshold".equals(fieldName)) { + deserializedAmqpC2DMessagesNotInAllowedRange.withMinThreshold(reader.getInt()); + } else if ("maxThreshold".equals(fieldName)) { + deserializedAmqpC2DMessagesNotInAllowedRange.withMaxThreshold(reader.getInt()); + } else if ("timeWindowSize".equals(fieldName)) { + deserializedAmqpC2DMessagesNotInAllowedRange.withTimeWindowSize( + reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()))); + } else if ("displayName".equals(fieldName)) { + deserializedAmqpC2DMessagesNotInAllowedRange.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedAmqpC2DMessagesNotInAllowedRange.withDescription(reader.getString()); + } else if ("ruleType".equals(fieldName)) { + deserializedAmqpC2DMessagesNotInAllowedRange.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAmqpC2DMessagesNotInAllowedRange; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DRejectedMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DRejectedMessagesNotInAllowedRange.java index ab58fc98cda4..3123462bb3e1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DRejectedMessagesNotInAllowedRange.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpC2DRejectedMessagesNotInAllowedRange.java @@ -5,28 +5,22 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; /** * Number of rejected cloud to device messages (AMQP protocol) is not in allowed range. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = AmqpC2DRejectedMessagesNotInAllowedRange.class, - visible = true) -@JsonTypeName("AmqpC2DRejectedMessagesNotInAllowedRange") @Fluent public final class AmqpC2DRejectedMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "AmqpC2DRejectedMessagesNotInAllowedRange"; /** @@ -88,6 +82,67 @@ public AmqpC2DRejectedMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) */ @Override public void validate() { - super.validate(); + if (timeWindowSize() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeWindowSize in model AmqpC2DRejectedMessagesNotInAllowedRange")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AmqpC2DRejectedMessagesNotInAllowedRange.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeIntField("minThreshold", minThreshold()); + jsonWriter.writeIntField("maxThreshold", maxThreshold()); + jsonWriter.writeStringField("timeWindowSize", CoreUtils.durationToStringWithDays(timeWindowSize())); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AmqpC2DRejectedMessagesNotInAllowedRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AmqpC2DRejectedMessagesNotInAllowedRange if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AmqpC2DRejectedMessagesNotInAllowedRange. + */ + public static AmqpC2DRejectedMessagesNotInAllowedRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AmqpC2DRejectedMessagesNotInAllowedRange deserializedAmqpC2DRejectedMessagesNotInAllowedRange + = new AmqpC2DRejectedMessagesNotInAllowedRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedAmqpC2DRejectedMessagesNotInAllowedRange.withIsEnabled(reader.getBoolean()); + } else if ("minThreshold".equals(fieldName)) { + deserializedAmqpC2DRejectedMessagesNotInAllowedRange.withMinThreshold(reader.getInt()); + } else if ("maxThreshold".equals(fieldName)) { + deserializedAmqpC2DRejectedMessagesNotInAllowedRange.withMaxThreshold(reader.getInt()); + } else if ("timeWindowSize".equals(fieldName)) { + deserializedAmqpC2DRejectedMessagesNotInAllowedRange.withTimeWindowSize( + reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()))); + } else if ("displayName".equals(fieldName)) { + deserializedAmqpC2DRejectedMessagesNotInAllowedRange.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedAmqpC2DRejectedMessagesNotInAllowedRange.withDescription(reader.getString()); + } else if ("ruleType".equals(fieldName)) { + deserializedAmqpC2DRejectedMessagesNotInAllowedRange.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAmqpC2DRejectedMessagesNotInAllowedRange; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpD2CMessagesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpD2CMessagesNotInAllowedRange.java index fa76a65060a8..0b40d7499bd7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpD2CMessagesNotInAllowedRange.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AmqpD2CMessagesNotInAllowedRange.java @@ -5,28 +5,22 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; /** * Number of device to cloud messages (AMQP protocol) is not in allowed range. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = AmqpD2CMessagesNotInAllowedRange.class, - visible = true) -@JsonTypeName("AmqpD2CMessagesNotInAllowedRange") @Fluent public final class AmqpD2CMessagesNotInAllowedRange extends TimeWindowCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "AmqpD2CMessagesNotInAllowedRange"; /** @@ -88,6 +82,67 @@ public AmqpD2CMessagesNotInAllowedRange withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); + if (timeWindowSize() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeWindowSize in model AmqpD2CMessagesNotInAllowedRange")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AmqpD2CMessagesNotInAllowedRange.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeIntField("minThreshold", minThreshold()); + jsonWriter.writeIntField("maxThreshold", maxThreshold()); + jsonWriter.writeStringField("timeWindowSize", CoreUtils.durationToStringWithDays(timeWindowSize())); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AmqpD2CMessagesNotInAllowedRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AmqpD2CMessagesNotInAllowedRange if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AmqpD2CMessagesNotInAllowedRange. + */ + public static AmqpD2CMessagesNotInAllowedRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AmqpD2CMessagesNotInAllowedRange deserializedAmqpD2CMessagesNotInAllowedRange + = new AmqpD2CMessagesNotInAllowedRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedAmqpD2CMessagesNotInAllowedRange.withIsEnabled(reader.getBoolean()); + } else if ("minThreshold".equals(fieldName)) { + deserializedAmqpD2CMessagesNotInAllowedRange.withMinThreshold(reader.getInt()); + } else if ("maxThreshold".equals(fieldName)) { + deserializedAmqpD2CMessagesNotInAllowedRange.withMaxThreshold(reader.getInt()); + } else if ("timeWindowSize".equals(fieldName)) { + deserializedAmqpD2CMessagesNotInAllowedRange.withTimeWindowSize( + reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()))); + } else if ("displayName".equals(fieldName)) { + deserializedAmqpD2CMessagesNotInAllowedRange.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedAmqpD2CMessagesNotInAllowedRange.withDescription(reader.getString()); + } else if ("ruleType".equals(fieldName)) { + deserializedAmqpD2CMessagesNotInAllowedRange.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAmqpD2CMessagesNotInAllowedRange; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AnnotateDefaultBranchState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AnnotateDefaultBranchState.java index 610c40f3c2c6..96192d68cc63 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AnnotateDefaultBranchState.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AnnotateDefaultBranchState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -40,7 +39,6 @@ public AnnotateDefaultBranchState() { * @param name a name to look for. * @return the corresponding AnnotateDefaultBranchState. */ - @JsonCreator public static AnnotateDefaultBranchState fromString(String name) { return fromString(name, AnnotateDefaultBranchState.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollectionList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollectionList.java index df603453bbd4..bd8483fcae49 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollectionList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApiCollectionList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ApiCollectionInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Page of a list of API collections as represented by Microsoft Defender for APIs. */ @Immutable -public final class ApiCollectionList { +public final class ApiCollectionList implements JsonSerializable { /* * API collections in this page. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiCollectionList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiCollectionList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ApiCollectionList. + */ + public static ApiCollectionList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiCollectionList deserializedApiCollectionList = new ApiCollectionList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ApiCollectionInner.fromJson(reader1)); + deserializedApiCollectionList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedApiCollectionList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApiCollectionList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationSourceResourceType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationSourceResourceType.java index 0709908b82c8..87904c28b573 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationSourceResourceType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationSourceResourceType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public ApplicationSourceResourceType() { * @param name a name to look for. * @return the corresponding ApplicationSourceResourceType. */ - @JsonCreator public static ApplicationSourceResourceType fromString(String name) { return fromString(name, ApplicationSourceResourceType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationsList.java index 78731b63b2d7..9f486a36b1b7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationsList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ApplicationsList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ApplicationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * Page of a security applications list. */ @Immutable -public final class ApplicationsList { +public final class ApplicationsList implements JsonSerializable { /* * Collection of applications in this page */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The URI to fetch the next page */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApplicationsList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApplicationsList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ApplicationsList. + */ + public static ApplicationsList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApplicationsList deserializedApplicationsList = new ApplicationsList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ApplicationInner.fromJson(reader1)); + deserializedApplicationsList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedApplicationsList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApplicationsList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioning.java index 1ff7435fcd60..74041628fd65 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioning.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The ARC autoprovisioning configuration. */ @Fluent -public class ArcAutoProvisioning { +public class ArcAutoProvisioning implements JsonSerializable { /* * Is arc auto provisioning enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * Configuration for servers Arc auto provisioning for a given environment */ - @JsonProperty(value = "configuration") private ArcAutoProvisioningConfiguration configuration; /** @@ -80,4 +82,43 @@ public void validate() { configuration().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeJsonField("configuration", this.configuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArcAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArcAutoProvisioning if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ArcAutoProvisioning. + */ + public static ArcAutoProvisioning fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArcAutoProvisioning deserializedArcAutoProvisioning = new ArcAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedArcAutoProvisioning.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("configuration".equals(fieldName)) { + deserializedArcAutoProvisioning.configuration = ArcAutoProvisioningConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedArcAutoProvisioning; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningAws.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningAws.java index e0b54a1e2e34..1323e0ba9f73 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningAws.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningAws.java @@ -5,7 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The ARC autoprovisioning configuration for an AWS environment. @@ -15,7 +18,6 @@ public class ArcAutoProvisioningAws extends ArcAutoProvisioning { /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -69,6 +71,51 @@ public ArcAutoProvisioningAws withConfiguration(ArcAutoProvisioningConfiguration */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArcAutoProvisioningAws from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArcAutoProvisioningAws if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ArcAutoProvisioningAws. + */ + public static ArcAutoProvisioningAws fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArcAutoProvisioningAws deserializedArcAutoProvisioningAws = new ArcAutoProvisioningAws(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedArcAutoProvisioningAws.withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedArcAutoProvisioningAws + .withConfiguration(ArcAutoProvisioningConfiguration.fromJson(reader)); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedArcAutoProvisioningAws.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedArcAutoProvisioningAws; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningConfiguration.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningConfiguration.java index da33d00e9acb..e39dc247b4cc 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningConfiguration.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningConfiguration.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Configuration for servers Arc auto provisioning for a given environment. */ @Fluent -public final class ArcAutoProvisioningConfiguration { +public final class ArcAutoProvisioningConfiguration implements JsonSerializable { /* * Optional HTTP proxy endpoint to use for the Arc agent */ - @JsonProperty(value = "proxy") private String proxy; /* * Optional Arc private link scope resource id to link the Arc agent */ - @JsonProperty(value = "privateLinkScope") private String privateLinkScope; /** @@ -77,4 +79,44 @@ public ArcAutoProvisioningConfiguration withPrivateLinkScope(String privateLinkS */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("proxy", this.proxy); + jsonWriter.writeStringField("privateLinkScope", this.privateLinkScope); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArcAutoProvisioningConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArcAutoProvisioningConfiguration if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ArcAutoProvisioningConfiguration. + */ + public static ArcAutoProvisioningConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArcAutoProvisioningConfiguration deserializedArcAutoProvisioningConfiguration + = new ArcAutoProvisioningConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("proxy".equals(fieldName)) { + deserializedArcAutoProvisioningConfiguration.proxy = reader.getString(); + } else if ("privateLinkScope".equals(fieldName)) { + deserializedArcAutoProvisioningConfiguration.privateLinkScope = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedArcAutoProvisioningConfiguration; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningGcp.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningGcp.java index aab1326b2125..15b2d496292c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningGcp.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ArcAutoProvisioningGcp.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The ARC autoprovisioning configuration for an GCP environment. @@ -42,6 +46,48 @@ public ArcAutoProvisioningGcp withConfiguration(ArcAutoProvisioningConfiguration */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArcAutoProvisioningGcp from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArcAutoProvisioningGcp if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ArcAutoProvisioningGcp. + */ + public static ArcAutoProvisioningGcp fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ArcAutoProvisioningGcp deserializedArcAutoProvisioningGcp = new ArcAutoProvisioningGcp(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedArcAutoProvisioningGcp.withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedArcAutoProvisioningGcp + .withConfiguration(ArcAutoProvisioningConfiguration.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedArcAutoProvisioningGcp; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocationList.java index 37c1ab8c536e..a53b03be2dbe 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocationList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AscLocationList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AscLocationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of locations where ASC saves your data. */ @Immutable -public final class AscLocationList { +public final class AscLocationList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -60,4 +62,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AscLocationList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AscLocationList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AscLocationList. + */ + public static AscLocationList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AscLocationList deserializedAscLocationList = new AscLocationList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> AscLocationInner.fromJson(reader1)); + deserializedAscLocationList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAscLocationList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAscLocationList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessedResourceType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessedResourceType.java index 0491ec20d2dd..1627745d2c2b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessedResourceType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessedResourceType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -43,7 +42,6 @@ public AssessedResourceType() { * @param name a name to look for. * @return the corresponding AssessedResourceType. */ - @JsonCreator public static AssessedResourceType fromString(String name) { return fromString(name, AssessedResourceType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentLinks.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentLinks.java index 0b4cfd261e35..cfea104b4fc4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentLinks.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentLinks.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Links relevant to the assessment. */ @Immutable -public final class AssessmentLinks { +public final class AssessmentLinks implements JsonSerializable { /* * Link to assessment in Azure Portal */ - @JsonProperty(value = "azurePortalUri", access = JsonProperty.Access.WRITE_ONLY) private String azurePortalUri; /** @@ -40,4 +43,39 @@ public String azurePortalUri() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssessmentLinks from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssessmentLinks if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AssessmentLinks. + */ + public static AssessmentLinks fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssessmentLinks deserializedAssessmentLinks = new AssessmentLinks(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azurePortalUri".equals(fieldName)) { + deserializedAssessmentLinks.azurePortalUri = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssessmentLinks; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatus.java index 34160c3d12c0..2f7a9cdcbe93 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatus.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatus.java @@ -6,29 +6,30 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The result of the assessment. */ @Fluent -public class AssessmentStatus { +public class AssessmentStatus implements JsonSerializable { /* * Programmatic code for the status of the assessment */ - @JsonProperty(value = "code", required = true) private AssessmentStatusCode code; /* * Programmatic code for the cause of the assessment status */ - @JsonProperty(value = "cause") private String cause; /* * Human readable description of the assessment status */ - @JsonProperty(value = "description") private String description; /** @@ -110,4 +111,47 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AssessmentStatus.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code == null ? null : this.code.toString()); + jsonWriter.writeStringField("cause", this.cause); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssessmentStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssessmentStatus if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AssessmentStatus. + */ + public static AssessmentStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssessmentStatus deserializedAssessmentStatus = new AssessmentStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedAssessmentStatus.code = AssessmentStatusCode.fromString(reader.getString()); + } else if ("cause".equals(fieldName)) { + deserializedAssessmentStatus.cause = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedAssessmentStatus.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssessmentStatus; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusCode.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusCode.java index 68c19755a065..6d4231261b38 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusCode.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusCode.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public AssessmentStatusCode() { * @param name a name to look for. * @return the corresponding AssessmentStatusCode. */ - @JsonCreator public static AssessmentStatusCode fromString(String name) { return fromString(name, AssessmentStatusCode.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusResponse.java index d268c5ef77de..0c577d0d2b72 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusResponse.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentStatusResponse.java @@ -5,7 +5,12 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; /** @@ -16,13 +21,11 @@ public final class AssessmentStatusResponse extends AssessmentStatus { /* * The time that the assessment was created and first evaluated. Returned as UTC time in ISO 8601 format */ - @JsonProperty(value = "firstEvaluationDate", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime firstEvaluationDate; /* * The time that the status of the assessment last changed. Returned as UTC time in ISO 8601 format */ - @JsonProperty(value = "statusChangeDate", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime statusChangeDate; /** @@ -85,6 +88,60 @@ public AssessmentStatusResponse withDescription(String description) { */ @Override public void validate() { - super.validate(); + if (code() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property code in model AssessmentStatusResponse")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AssessmentStatusResponse.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", code() == null ? null : code().toString()); + jsonWriter.writeStringField("cause", cause()); + jsonWriter.writeStringField("description", description()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssessmentStatusResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssessmentStatusResponse if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AssessmentStatusResponse. + */ + public static AssessmentStatusResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssessmentStatusResponse deserializedAssessmentStatusResponse = new AssessmentStatusResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedAssessmentStatusResponse.withCode(AssessmentStatusCode.fromString(reader.getString())); + } else if ("cause".equals(fieldName)) { + deserializedAssessmentStatusResponse.withCause(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedAssessmentStatusResponse.withDescription(reader.getString()); + } else if ("firstEvaluationDate".equals(fieldName)) { + deserializedAssessmentStatusResponse.firstEvaluationDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("statusChangeDate".equals(fieldName)) { + deserializedAssessmentStatusResponse.statusChangeDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAssessmentStatusResponse; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentType.java index ecf72873685d..ed8857740de0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssessmentType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -48,7 +47,6 @@ public AssessmentType() { * @param name a name to look for. * @return the corresponding AssessmentType. */ - @JsonCreator public static AssessmentType fromString(String name) { return fromString(name, AssessmentType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedAssessmentItem.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedAssessmentItem.java new file mode 100644 index 000000000000..f2ae0bc34435 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedAssessmentItem.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describe the properties of a security assessment object reference (by key). + */ +@Fluent +public final class AssignedAssessmentItem implements JsonSerializable { + /* + * Unique key to a security assessment object + */ + private String assessmentKey; + + /** + * Creates an instance of AssignedAssessmentItem class. + */ + public AssignedAssessmentItem() { + } + + /** + * Get the assessmentKey property: Unique key to a security assessment object. + * + * @return the assessmentKey value. + */ + public String assessmentKey() { + return this.assessmentKey; + } + + /** + * Set the assessmentKey property: Unique key to a security assessment object. + * + * @param assessmentKey the assessmentKey value to set. + * @return the AssignedAssessmentItem object itself. + */ + public AssignedAssessmentItem withAssessmentKey(String assessmentKey) { + this.assessmentKey = assessmentKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("assessmentKey", this.assessmentKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssignedAssessmentItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssignedAssessmentItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AssignedAssessmentItem. + */ + public static AssignedAssessmentItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssignedAssessmentItem deserializedAssignedAssessmentItem = new AssignedAssessmentItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessmentKey".equals(fieldName)) { + deserializedAssignedAssessmentItem.assessmentKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssignedAssessmentItem; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedStandardItem.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedStandardItem.java new file mode 100644 index 000000000000..489c994d7439 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AssignedStandardItem.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describe the properties of a of a standard assignments object reference. + */ +@Fluent +public final class AssignedStandardItem implements JsonSerializable { + /* + * Full resourceId of the Microsoft.Security/standard object + */ + private String id; + + /** + * Creates an instance of AssignedStandardItem class. + */ + public AssignedStandardItem() { + } + + /** + * Get the id property: Full resourceId of the Microsoft.Security/standard object. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Full resourceId of the Microsoft.Security/standard object. + * + * @param id the id value to set. + * @return the AssignedStandardItem object itself. + */ + public AssignedStandardItem withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssignedStandardItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssignedStandardItem if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AssignedStandardItem. + */ + public static AssignedStandardItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssignedStandardItem deserializedAssignedStandardItem = new AssignedStandardItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAssignedStandardItem.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssignedStandardItem; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaExternalSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaExternalSecuritySolution.java index 4a7ee5b7b058..f7358217fa11 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaExternalSecuritySolution.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaExternalSecuritySolution.java @@ -5,36 +5,47 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Represents an ATA security solution which sends logs to an OMS workspace. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "kind", - defaultImpl = AtaExternalSecuritySolution.class, - visible = true) -@JsonTypeName("ATA") @Fluent public final class AtaExternalSecuritySolution extends ExternalSecuritySolutionInner { /* * The kind of the external solution */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) private ExternalSecuritySolutionKind kind = ExternalSecuritySolutionKind.ATA; /* * The external security solution properties for ATA solutions */ - @JsonProperty(value = "properties") private AtaSolutionProperties properties; + /* + * Location where the resource is stored + */ + private String location; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AtaExternalSecuritySolution class. */ @@ -71,6 +82,46 @@ public AtaExternalSecuritySolution withProperties(AtaSolutionProperties properti return this; } + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + @Override + public String location() { + return this.location; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -78,9 +129,57 @@ public AtaExternalSecuritySolution withProperties(AtaSolutionProperties properti */ @Override public void validate() { - super.validate(); if (properties() != null) { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AtaExternalSecuritySolution from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AtaExternalSecuritySolution if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AtaExternalSecuritySolution. + */ + public static AtaExternalSecuritySolution fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AtaExternalSecuritySolution deserializedAtaExternalSecuritySolution = new AtaExternalSecuritySolution(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAtaExternalSecuritySolution.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAtaExternalSecuritySolution.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAtaExternalSecuritySolution.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAtaExternalSecuritySolution.location = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedAtaExternalSecuritySolution.kind + = ExternalSecuritySolutionKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedAtaExternalSecuritySolution.properties = AtaSolutionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAtaExternalSecuritySolution; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaSolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaSolutionProperties.java index ec7f9ebb9d13..3b7f735e8dfc 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaSolutionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AtaSolutionProperties.java @@ -5,7 +5,12 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; /** * The external security solution properties for ATA solutions. @@ -15,7 +20,6 @@ public final class AtaSolutionProperties extends ExternalSecuritySolutionPropert /* * The lastEventReceived property. */ - @JsonProperty(value = "lastEventReceived") private String lastEventReceived; /** @@ -78,6 +82,64 @@ public AtaSolutionProperties withWorkspace(ConnectedWorkspace workspace) { */ @Override public void validate() { - super.validate(); + if (workspace() != null) { + workspace().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deviceVendor", deviceVendor()); + jsonWriter.writeStringField("deviceType", deviceType()); + jsonWriter.writeJsonField("workspace", workspace()); + jsonWriter.writeStringField("lastEventReceived", this.lastEventReceived); + if (additionalProperties() != null) { + for (Map.Entry additionalProperty : additionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AtaSolutionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AtaSolutionProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AtaSolutionProperties. + */ + public static AtaSolutionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AtaSolutionProperties deserializedAtaSolutionProperties = new AtaSolutionProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceVendor".equals(fieldName)) { + deserializedAtaSolutionProperties.withDeviceVendor(reader.getString()); + } else if ("deviceType".equals(fieldName)) { + deserializedAtaSolutionProperties.withDeviceType(reader.getString()); + } else if ("workspace".equals(fieldName)) { + deserializedAtaSolutionProperties.withWorkspace(ConnectedWorkspace.fromJson(reader)); + } else if ("lastEventReceived".equals(fieldName)) { + deserializedAtaSolutionProperties.lastEventReceived = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedAtaSolutionProperties.withAdditionalProperties(additionalProperties); + + return deserializedAtaSolutionProperties; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AttestationComplianceState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AttestationComplianceState.java new file mode 100644 index 000000000000..dc724ea58140 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AttestationComplianceState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Attest category of this assignment. + */ +public final class AttestationComplianceState extends ExpandableStringEnum { + /** + * Static value unknown for AttestationComplianceState. + */ + public static final AttestationComplianceState UNKNOWN = fromString("unknown"); + + /** + * Static value compliant for AttestationComplianceState. + */ + public static final AttestationComplianceState COMPLIANT = fromString("compliant"); + + /** + * Static value nonCompliant for AttestationComplianceState. + */ + public static final AttestationComplianceState NON_COMPLIANT = fromString("nonCompliant"); + + /** + * Creates a new instance of AttestationComplianceState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AttestationComplianceState() { + } + + /** + * Creates or finds a AttestationComplianceState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AttestationComplianceState. + */ + public static AttestationComplianceState fromString(String name) { + return fromString(name, AttestationComplianceState.class); + } + + /** + * Gets known AttestationComplianceState values. + * + * @return known AttestationComplianceState values. + */ + public static Collection values() { + return values(AttestationComplianceState.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AttestationEvidence.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AttestationEvidence.java new file mode 100644 index 000000000000..da9c622d5014 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AttestationEvidence.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describe the properties of a assignment attestation. + */ +@Fluent +public final class AttestationEvidence implements JsonSerializable { + /* + * The description of the evidence + */ + private String description; + + /* + * The source url of the evidence + */ + private String sourceUrl; + + /** + * Creates an instance of AttestationEvidence class. + */ + public AttestationEvidence() { + } + + /** + * Get the description property: The description of the evidence. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the evidence. + * + * @param description the description value to set. + * @return the AttestationEvidence object itself. + */ + public AttestationEvidence withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the sourceUrl property: The source url of the evidence. + * + * @return the sourceUrl value. + */ + public String sourceUrl() { + return this.sourceUrl; + } + + /** + * Set the sourceUrl property: The source url of the evidence. + * + * @param sourceUrl the sourceUrl value to set. + * @return the AttestationEvidence object itself. + */ + public AttestationEvidence withSourceUrl(String sourceUrl) { + this.sourceUrl = sourceUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("sourceUrl", this.sourceUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AttestationEvidence from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AttestationEvidence if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AttestationEvidence. + */ + public static AttestationEvidence fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AttestationEvidence deserializedAttestationEvidence = new AttestationEvidence(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAttestationEvidence.description = reader.getString(); + } else if ("sourceUrl".equals(fieldName)) { + deserializedAttestationEvidence.sourceUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAttestationEvidence; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authentication.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authentication.java new file mode 100644 index 000000000000..098f17e6dba8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authentication.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The environment authentication details. + */ +@Immutable +public class Authentication implements JsonSerializable { + /* + * The authentication type + */ + private AuthenticationType authenticationType = AuthenticationType.fromString("Authentication"); + + /** + * Creates an instance of Authentication class. + */ + public Authentication() { + } + + /** + * Get the authenticationType property: The authentication type. + * + * @return the authenticationType value. + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Authentication from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Authentication if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Authentication. + */ + public static Authentication fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("authenticationType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AccessToken".equals(discriminatorValue)) { + return AccessTokenAuthentication.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Authentication fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Authentication deserializedAuthentication = new Authentication(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationType".equals(fieldName)) { + deserializedAuthentication.authenticationType = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAuthentication; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java index c2f19f6bc56d..5cb800e6c675 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationDetailsProperties.java @@ -5,52 +5,38 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Settings for cloud authentication management. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "authenticationType", - defaultImpl = AuthenticationDetailsProperties.class, - visible = true) -@JsonTypeName("AuthenticationDetailsProperties") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "awsCreds", value = AwsCredsAuthenticationDetailsProperties.class), - @JsonSubTypes.Type(name = "awsAssumeRole", value = AwAssumeRoleAuthenticationDetailsProperties.class), - @JsonSubTypes.Type(name = "gcpCredentials", value = GcpCredentialsDetailsProperties.class) }) @Immutable -public class AuthenticationDetailsProperties { +public class AuthenticationDetailsProperties implements JsonSerializable { /* - * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use account organization credentials. + * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use + * account organization credentials. */ - @JsonTypeId - @JsonProperty(value = "authenticationType", required = true) - private AuthenticationType authenticationType; + private AuthenticationType authenticationType = AuthenticationType.fromString("AuthenticationDetailsProperties"); /* * State of the multi-cloud connector */ - @JsonProperty(value = "authenticationProvisioningState", access = JsonProperty.Access.WRITE_ONLY) private AuthenticationProvisioningState authenticationProvisioningState; /* * The permissions detected in the cloud account. */ - @JsonProperty(value = "grantedPermissions", access = JsonProperty.Access.WRITE_ONLY) private List grantedPermissions; /** * Creates an instance of AuthenticationDetailsProperties class. */ public AuthenticationDetailsProperties() { - this.authenticationType = AuthenticationType.fromString("AuthenticationDetailsProperties"); } /** @@ -72,6 +58,18 @@ public AuthenticationProvisioningState authenticationProvisioningState() { return this.authenticationProvisioningState; } + /** + * Set the authenticationProvisioningState property: State of the multi-cloud connector. + * + * @param authenticationProvisioningState the authenticationProvisioningState value to set. + * @return the AuthenticationDetailsProperties object itself. + */ + AuthenticationDetailsProperties + withAuthenticationProvisioningState(AuthenticationProvisioningState authenticationProvisioningState) { + this.authenticationProvisioningState = authenticationProvisioningState; + return this; + } + /** * Get the grantedPermissions property: The permissions detected in the cloud account. * @@ -81,6 +79,17 @@ public List grantedPermissions() { return this.grantedPermissions; } + /** + * Set the grantedPermissions property: The permissions detected in the cloud account. + * + * @param grantedPermissions the grantedPermissions value to set. + * @return the AuthenticationDetailsProperties object itself. + */ + AuthenticationDetailsProperties withGrantedPermissions(List grantedPermissions) { + this.grantedPermissions = grantedPermissions; + return this; + } + /** * Validates the instance. * @@ -88,4 +97,79 @@ public List grantedPermissions() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AuthenticationDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AuthenticationDetailsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AuthenticationDetailsProperties. + */ + public static AuthenticationDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("authenticationType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("awsCreds".equals(discriminatorValue)) { + return AwsCredsAuthenticationDetailsProperties.fromJson(readerToUse.reset()); + } else if ("awsAssumeRole".equals(discriminatorValue)) { + return AwAssumeRoleAuthenticationDetailsProperties.fromJson(readerToUse.reset()); + } else if ("gcpCredentials".equals(discriminatorValue)) { + return GcpCredentialsDetailsProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AuthenticationDetailsProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AuthenticationDetailsProperties deserializedAuthenticationDetailsProperties + = new AuthenticationDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationType".equals(fieldName)) { + deserializedAuthenticationDetailsProperties.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else if ("authenticationProvisioningState".equals(fieldName)) { + deserializedAuthenticationDetailsProperties.authenticationProvisioningState + = AuthenticationProvisioningState.fromString(reader.getString()); + } else if ("grantedPermissions".equals(fieldName)) { + List grantedPermissions + = reader.readArray(reader1 -> PermissionProperty.fromString(reader1.getString())); + deserializedAuthenticationDetailsProperties.grantedPermissions = grantedPermissions; + } else { + reader.skipChildren(); + } + } + + return deserializedAuthenticationDetailsProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java index d0332051ff53..a3582f57a36a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -47,7 +46,6 @@ public AuthenticationProvisioningState() { * @param name a name to look for. * @return the corresponding AuthenticationProvisioningState. */ - @JsonCreator public static AuthenticationProvisioningState fromString(String name) { return fromString(name, AuthenticationProvisioningState.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java index 0a61e277f217..79d4f8a7b934 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AuthenticationType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -43,7 +42,6 @@ public AuthenticationType() { * @param name a name to look for. * @return the corresponding AuthenticationType. */ - @JsonCreator public static AuthenticationType fromString(String name) { return fromString(name, AuthenticationType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authorization.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authorization.java index 489e98d2f97a..4d9ff9d601a5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authorization.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Authorization.java @@ -5,19 +5,22 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Authorization payload. */ @Fluent -public final class Authorization { +public final class Authorization implements JsonSerializable { /* * Gets or sets one-time OAuth code to exchange for refresh and access tokens. * * Only used during PUT/PATCH operations. The secret is cleared during GET. */ - @JsonProperty(value = "code") private String code; /** @@ -57,4 +60,40 @@ public Authorization withCode(String code) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Authorization from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Authorization if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Authorization. + */ + public static Authorization fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Authorization deserializedAuthorization = new Authorization(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedAuthorization.code = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAuthorization; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoDiscovery.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoDiscovery.java index b10fbe6540f0..47a6cc7c28b4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoDiscovery.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoDiscovery.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public AutoDiscovery() { * @param name a name to look for. * @return the corresponding AutoDiscovery. */ - @JsonCreator public static AutoDiscovery fromString(String name) { return fromString(name, AutoDiscovery.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvision.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvision.java index c4f1323e11b6..df4cc349ef70 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvision.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvision.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public AutoProvision() { * @param name a name to look for. * @return the corresponding AutoProvision. */ - @JsonCreator public static AutoProvision fromString(String name) { return fromString(name, AutoProvision.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettingList.java index f1fff0f0d757..3907bc007f8b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettingList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutoProvisioningSettingList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of all the auto provisioning settings response. */ @Fluent -public final class AutoProvisioningSettingList { +public final class AutoProvisioningSettingList implements JsonSerializable { /* * List of all the auto provisioning settings */ - @JsonProperty(value = "value") private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutoProvisioningSettingList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutoProvisioningSettingList if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutoProvisioningSettingList. + */ + public static AutoProvisioningSettingList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutoProvisioningSettingList deserializedAutoProvisioningSettingList = new AutoProvisioningSettingList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AutoProvisioningSettingInner.fromJson(reader1)); + deserializedAutoProvisioningSettingList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAutoProvisioningSettingList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAutoProvisioningSettingList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationAction.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationAction.java index 5b20a625614e..18a8278a61e6 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationAction.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationAction.java @@ -5,35 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The action that should be triggered. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "actionType", defaultImpl = AutomationAction.class, visible = true) -@JsonTypeName("AutomationAction") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "LogicApp", value = AutomationActionLogicApp.class), - @JsonSubTypes.Type(name = "EventHub", value = AutomationActionEventHub.class), - @JsonSubTypes.Type(name = "Workspace", value = AutomationActionWorkspace.class) }) @Immutable -public class AutomationAction { +public class AutomationAction implements JsonSerializable { /* * The type of the action that will be triggered by the Automation */ - @JsonTypeId - @JsonProperty(value = "actionType", required = true) - private ActionType actionType; + private ActionType actionType = ActionType.fromString("AutomationAction"); /** * Creates an instance of AutomationAction class. */ public AutomationAction() { - this.actionType = ActionType.fromString("AutomationAction"); } /** @@ -52,4 +43,69 @@ public ActionType actionType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionType", this.actionType == null ? null : this.actionType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationAction from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationAction if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationAction. + */ + public static AutomationAction fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("actionType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("LogicApp".equals(discriminatorValue)) { + return AutomationActionLogicApp.fromJson(readerToUse.reset()); + } else if ("EventHub".equals(discriminatorValue)) { + return AutomationActionEventHub.fromJson(readerToUse.reset()); + } else if ("Workspace".equals(discriminatorValue)) { + return AutomationActionWorkspace.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AutomationAction fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationAction deserializedAutomationAction = new AutomationAction(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("actionType".equals(fieldName)) { + deserializedAutomationAction.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationAction; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionEventHub.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionEventHub.java index 6474840a2754..fb33d6aa348f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionEventHub.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionEventHub.java @@ -5,52 +5,40 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The target Event Hub to which event data will be exported. To learn more about Microsoft Defender for Cloud * continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "actionType", - defaultImpl = AutomationActionEventHub.class, - visible = true) -@JsonTypeName("EventHub") @Fluent public final class AutomationActionEventHub extends AutomationAction { /* * The type of the action that will be triggered by the Automation */ - @JsonTypeId - @JsonProperty(value = "actionType", required = true) private ActionType actionType = ActionType.EVENT_HUB; /* * The target Event Hub Azure Resource ID. */ - @JsonProperty(value = "eventHubResourceId") private String eventHubResourceId; /* * The target Event Hub SAS policy name. */ - @JsonProperty(value = "sasPolicyName", access = JsonProperty.Access.WRITE_ONLY) private String sasPolicyName; /* * The target Event Hub connection string (it will not be included in any response). */ - @JsonProperty(value = "connectionString") private String connectionString; /* * Indicates whether the trusted service is enabled or not. */ - @JsonProperty(value = "isTrustedServiceEnabled") private Boolean isTrustedServiceEnabled; /** @@ -147,6 +135,53 @@ public AutomationActionEventHub withIsTrustedServiceEnabled(Boolean isTrustedSer */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionType", this.actionType == null ? null : this.actionType.toString()); + jsonWriter.writeStringField("eventHubResourceId", this.eventHubResourceId); + jsonWriter.writeStringField("connectionString", this.connectionString); + jsonWriter.writeBooleanField("isTrustedServiceEnabled", this.isTrustedServiceEnabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationActionEventHub from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationActionEventHub if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationActionEventHub. + */ + public static AutomationActionEventHub fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationActionEventHub deserializedAutomationActionEventHub = new AutomationActionEventHub(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("actionType".equals(fieldName)) { + deserializedAutomationActionEventHub.actionType = ActionType.fromString(reader.getString()); + } else if ("eventHubResourceId".equals(fieldName)) { + deserializedAutomationActionEventHub.eventHubResourceId = reader.getString(); + } else if ("sasPolicyName".equals(fieldName)) { + deserializedAutomationActionEventHub.sasPolicyName = reader.getString(); + } else if ("connectionString".equals(fieldName)) { + deserializedAutomationActionEventHub.connectionString = reader.getString(); + } else if ("isTrustedServiceEnabled".equals(fieldName)) { + deserializedAutomationActionEventHub.isTrustedServiceEnabled + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationActionEventHub; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionLogicApp.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionLogicApp.java index ff8587a9b712..e754ac731116 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionLogicApp.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionLogicApp.java @@ -5,40 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The logic app action that should be triggered. To learn more about Microsoft Defender for Cloud's Workflow Automation * capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "actionType", - defaultImpl = AutomationActionLogicApp.class, - visible = true) -@JsonTypeName("LogicApp") @Fluent public final class AutomationActionLogicApp extends AutomationAction { /* * The type of the action that will be triggered by the Automation */ - @JsonTypeId - @JsonProperty(value = "actionType", required = true) private ActionType actionType = ActionType.LOGIC_APP; /* - * The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions to trigger the Logic App + * The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have + * permissions to trigger the Logic App */ - @JsonProperty(value = "logicAppResourceId") private String logicAppResourceId; /* * The Logic App trigger URI endpoint (it will not be included in any response). */ - @JsonProperty(value = "uri") private String uri; /** @@ -106,6 +97,47 @@ public AutomationActionLogicApp withUri(String uri) { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionType", this.actionType == null ? null : this.actionType.toString()); + jsonWriter.writeStringField("logicAppResourceId", this.logicAppResourceId); + jsonWriter.writeStringField("uri", this.uri); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationActionLogicApp from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationActionLogicApp if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationActionLogicApp. + */ + public static AutomationActionLogicApp fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationActionLogicApp deserializedAutomationActionLogicApp = new AutomationActionLogicApp(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("actionType".equals(fieldName)) { + deserializedAutomationActionLogicApp.actionType = ActionType.fromString(reader.getString()); + } else if ("logicAppResourceId".equals(fieldName)) { + deserializedAutomationActionLogicApp.logicAppResourceId = reader.getString(); + } else if ("uri".equals(fieldName)) { + deserializedAutomationActionLogicApp.uri = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationActionLogicApp; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionWorkspace.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionWorkspace.java index fc2dffde899c..aac427dd8151 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionWorkspace.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationActionWorkspace.java @@ -5,10 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Log Analytics Workspace to which event data will be exported. Security alerts data will reside in the @@ -17,25 +17,16 @@ * Log Analytics free/standard solution needs to be enabled on that workspace. To learn more about Microsoft Defender * for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "actionType", - defaultImpl = AutomationActionWorkspace.class, - visible = true) -@JsonTypeName("Workspace") @Fluent public final class AutomationActionWorkspace extends AutomationAction { /* * The type of the action that will be triggered by the Automation */ - @JsonTypeId - @JsonProperty(value = "actionType", required = true) private ActionType actionType = ActionType.WORKSPACE; /* * The fully qualified Log Analytics Workspace Azure Resource ID. */ - @JsonProperty(value = "workspaceResourceId") private String workspaceResourceId; /** @@ -81,6 +72,44 @@ public AutomationActionWorkspace withWorkspaceResourceId(String workspaceResourc */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionType", this.actionType == null ? null : this.actionType.toString()); + jsonWriter.writeStringField("workspaceResourceId", this.workspaceResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationActionWorkspace from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationActionWorkspace if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationActionWorkspace. + */ + public static AutomationActionWorkspace fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationActionWorkspace deserializedAutomationActionWorkspace = new AutomationActionWorkspace(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("actionType".equals(fieldName)) { + deserializedAutomationActionWorkspace.actionType = ActionType.fromString(reader.getString()); + } else if ("workspaceResourceId".equals(fieldName)) { + deserializedAutomationActionWorkspace.workspaceResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationActionWorkspace; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationList.java index 77b04ae28714..ce35d45de9de 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationList.java @@ -6,25 +6,27 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AutomationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of security automations response. */ @Fluent -public final class AutomationList { +public final class AutomationList implements JsonSerializable { /* * The list of security automations under the given scope. */ - @JsonProperty(value = "value", required = true) private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -77,4 +79,44 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AutomationList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AutomationList. + */ + public static AutomationList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationList deserializedAutomationList = new AutomationList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> AutomationInner.fromJson(reader1)); + deserializedAutomationList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAutomationList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java index d0b027593644..9f5b631de0cd 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationRuleSet.java @@ -5,7 +5,11 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** @@ -13,11 +17,10 @@ * will be evaluated as 'true', will the event trigger the defined actions. */ @Fluent -public final class AutomationRuleSet { +public final class AutomationRuleSet implements JsonSerializable { /* * The rules property. */ - @JsonProperty(value = "rules") private List rules; /** @@ -56,4 +59,42 @@ public void validate() { rules().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("rules", this.rules, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationRuleSet from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationRuleSet if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationRuleSet. + */ + public static AutomationRuleSet fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationRuleSet deserializedAutomationRuleSet = new AutomationRuleSet(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rules".equals(fieldName)) { + List rules + = reader.readArray(reader1 -> AutomationTriggeringRule.fromJson(reader1)); + deserializedAutomationRuleSet.rules = rules; + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationRuleSet; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationScope.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationScope.java index 145406e7137e..68d7321c912b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationScope.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationScope.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * A single automation scope. */ @Fluent -public final class AutomationScope { +public final class AutomationScope implements JsonSerializable { /* * The resources scope description. */ - @JsonProperty(value = "description") private String description; /* - * The resources scope path. Can be the subscription on which the automation is defined on or a resource group under that subscription (fully qualified Azure resource IDs). + * The resources scope path. Can be the subscription on which the automation is defined on or a resource group under + * that subscription (fully qualified Azure resource IDs). */ - @JsonProperty(value = "scopePath") private String scopePath; /** @@ -79,4 +82,43 @@ public AutomationScope withScopePath(String scopePath) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("scopePath", this.scopePath); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationScope from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationScope if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationScope. + */ + public static AutomationScope fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationScope deserializedAutomationScope = new AutomationScope(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedAutomationScope.description = reader.getString(); + } else if ("scopePath".equals(fieldName)) { + deserializedAutomationScope.scopePath = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationScope; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationSource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationSource.java index c9392837a3e1..12ef328c2f72 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationSource.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationSource.java @@ -5,7 +5,11 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** @@ -14,17 +18,16 @@ * https://aka.ms/ASCAutomationSchemas. */ @Fluent -public final class AutomationSource { +public final class AutomationSource implements JsonSerializable { /* * A valid event source type. */ - @JsonProperty(value = "eventSource") private EventSource eventSource; /* - * A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical 'or'). + * A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets + * (logical 'or'). */ - @JsonProperty(value = "ruleSets") private List ruleSets; /** @@ -85,4 +88,44 @@ public void validate() { ruleSets().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("eventSource", this.eventSource == null ? null : this.eventSource.toString()); + jsonWriter.writeArrayField("ruleSets", this.ruleSets, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationSource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationSource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationSource. + */ + public static AutomationSource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationSource deserializedAutomationSource = new AutomationSource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("eventSource".equals(fieldName)) { + deserializedAutomationSource.eventSource = EventSource.fromString(reader.getString()); + } else if ("ruleSets".equals(fieldName)) { + List ruleSets = reader.readArray(reader1 -> AutomationRuleSet.fromJson(reader1)); + deserializedAutomationSource.ruleSets = ruleSets; + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationSource; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationTriggeringRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationTriggeringRule.java index a9e3792e819c..a4621338eec8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationTriggeringRule.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationTriggeringRule.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * A rule which is evaluated upon event interception. The rule is configured by comparing a specific value from the * event model to an expected value. This comparison is done by using one of the supported operators set. */ @Fluent -public final class AutomationTriggeringRule { +public final class AutomationTriggeringRule implements JsonSerializable { /* * The JPath of the entity model property that should be checked. */ - @JsonProperty(value = "propertyJPath") private String propertyJPath; /* * The data type of the compared operands (string, integer, floating point number or a boolean [true/false]] */ - @JsonProperty(value = "propertyType") private PropertyType propertyType; /* * The expected value. */ - @JsonProperty(value = "expectedValue") private String expectedValue; /* * A valid comparer operator to use. A case-insensitive comparison will be applied for String PropertyType. */ - @JsonProperty(value = "operator") private Operator operator; /** @@ -134,4 +134,49 @@ public AutomationTriggeringRule withOperator(Operator operator) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyJPath", this.propertyJPath); + jsonWriter.writeStringField("propertyType", this.propertyType == null ? null : this.propertyType.toString()); + jsonWriter.writeStringField("expectedValue", this.expectedValue); + jsonWriter.writeStringField("operator", this.operator == null ? null : this.operator.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationTriggeringRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationTriggeringRule if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationTriggeringRule. + */ + public static AutomationTriggeringRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationTriggeringRule deserializedAutomationTriggeringRule = new AutomationTriggeringRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("propertyJPath".equals(fieldName)) { + deserializedAutomationTriggeringRule.propertyJPath = reader.getString(); + } else if ("propertyType".equals(fieldName)) { + deserializedAutomationTriggeringRule.propertyType = PropertyType.fromString(reader.getString()); + } else if ("expectedValue".equals(fieldName)) { + deserializedAutomationTriggeringRule.expectedValue = reader.getString(); + } else if ("operator".equals(fieldName)) { + deserializedAutomationTriggeringRule.operator = Operator.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationTriggeringRule; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationUpdateModel.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationUpdateModel.java index 89f3f96b0b09..74d94bacaafb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationUpdateModel.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AutomationUpdateModel.java @@ -5,8 +5,11 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AutomationProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -18,7 +21,6 @@ public final class AutomationUpdateModel extends Tags { /* * Security automation data */ - @JsonProperty(value = "properties") private AutomationProperties innerProperties; /** @@ -175,9 +177,48 @@ public AutomationUpdateModel withActions(List actions) { */ @Override public void validate() { - super.validate(); if (innerProperties() != null) { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AutomationUpdateModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AutomationUpdateModel if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AutomationUpdateModel. + */ + public static AutomationUpdateModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AutomationUpdateModel deserializedAutomationUpdateModel = new AutomationUpdateModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAutomationUpdateModel.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedAutomationUpdateModel.innerProperties = AutomationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAutomationUpdateModel; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwAssumeRoleAuthenticationDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwAssumeRoleAuthenticationDetailsProperties.java index c8b896e384e5..95880a31e5f5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwAssumeRoleAuthenticationDetailsProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwAssumeRoleAuthenticationDetailsProperties.java @@ -6,10 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; /** * AWS cloud account connector based assume role, the role enables delegating access to your AWS resources. The role is @@ -17,37 +18,27 @@ * href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user.html">Creating a Role to Delegate * Permissions to an IAM User (write only)</a>. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "authenticationType", - defaultImpl = AwAssumeRoleAuthenticationDetailsProperties.class, - visible = true) -@JsonTypeName("awsAssumeRole") @Fluent public final class AwAssumeRoleAuthenticationDetailsProperties extends AuthenticationDetailsProperties { /* - * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use account organization credentials. + * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use + * account organization credentials. */ - @JsonTypeId - @JsonProperty(value = "authenticationType", required = true) private AuthenticationType authenticationType = AuthenticationType.AWS_ASSUME_ROLE; /* * The ID of the cloud account */ - @JsonProperty(value = "accountId", access = JsonProperty.Access.WRITE_ONLY) private String accountId; /* * Assumed role ID is an identifier that you can use to create temporary security credentials. */ - @JsonProperty(value = "awsAssumeRoleArn", required = true) private String awsAssumeRoleArn; /* * A unique identifier that is required when you assume a role in another account. */ - @JsonProperty(value = "awsExternalId", required = true) private String awsExternalId; /** @@ -125,7 +116,6 @@ public AwAssumeRoleAuthenticationDetailsProperties withAwsExternalId(String awsE */ @Override public void validate() { - super.validate(); if (awsAssumeRoleArn() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -139,4 +129,59 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AwAssumeRoleAuthenticationDetailsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("awsAssumeRoleArn", this.awsAssumeRoleArn); + jsonWriter.writeStringField("awsExternalId", this.awsExternalId); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwAssumeRoleAuthenticationDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwAssumeRoleAuthenticationDetailsProperties if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AwAssumeRoleAuthenticationDetailsProperties. + */ + public static AwAssumeRoleAuthenticationDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwAssumeRoleAuthenticationDetailsProperties deserializedAwAssumeRoleAuthenticationDetailsProperties + = new AwAssumeRoleAuthenticationDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationProvisioningState".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.withAuthenticationProvisioningState( + AuthenticationProvisioningState.fromString(reader.getString())); + } else if ("grantedPermissions".equals(fieldName)) { + List grantedPermissions + = reader.readArray(reader1 -> PermissionProperty.fromString(reader1.getString())); + deserializedAwAssumeRoleAuthenticationDetailsProperties.withGrantedPermissions(grantedPermissions); + } else if ("awsAssumeRoleArn".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.awsAssumeRoleArn = reader.getString(); + } else if ("awsExternalId".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.awsExternalId = reader.getString(); + } else if ("authenticationType".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else if ("accountId".equals(fieldName)) { + deserializedAwAssumeRoleAuthenticationDetailsProperties.accountId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAwAssumeRoleAuthenticationDetailsProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java index cd00ebca006b..a1149521222d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsCredsAuthenticationDetailsProperties.java @@ -6,47 +6,38 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; /** * AWS cloud account connector based credentials, the credentials is composed of access key ID and secret key, for more * details, refer to <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html">Creating an * IAM User in Your AWS Account (write only)</a>. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "authenticationType", - defaultImpl = AwsCredsAuthenticationDetailsProperties.class, - visible = true) -@JsonTypeName("awsCreds") @Fluent public final class AwsCredsAuthenticationDetailsProperties extends AuthenticationDetailsProperties { /* - * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use account organization credentials. + * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use + * account organization credentials. */ - @JsonTypeId - @JsonProperty(value = "authenticationType", required = true) private AuthenticationType authenticationType = AuthenticationType.AWS_CREDS; /* * The ID of the cloud account */ - @JsonProperty(value = "accountId", access = JsonProperty.Access.WRITE_ONLY) private String accountId; /* * Public key element of the AWS credential object (write only) */ - @JsonProperty(value = "awsAccessKeyId", required = true) private String awsAccessKeyId; /* * Secret key element of the AWS credential object (write only) */ - @JsonProperty(value = "awsSecretAccessKey", required = true) private String awsSecretAccessKey; /** @@ -122,7 +113,6 @@ public AwsCredsAuthenticationDetailsProperties withAwsSecretAccessKey(String aws */ @Override public void validate() { - super.validate(); if (awsAccessKeyId() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -136,4 +126,59 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(AwsCredsAuthenticationDetailsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("awsAccessKeyId", this.awsAccessKeyId); + jsonWriter.writeStringField("awsSecretAccessKey", this.awsSecretAccessKey); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsCredsAuthenticationDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsCredsAuthenticationDetailsProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AwsCredsAuthenticationDetailsProperties. + */ + public static AwsCredsAuthenticationDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsCredsAuthenticationDetailsProperties deserializedAwsCredsAuthenticationDetailsProperties + = new AwsCredsAuthenticationDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationProvisioningState".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.withAuthenticationProvisioningState( + AuthenticationProvisioningState.fromString(reader.getString())); + } else if ("grantedPermissions".equals(fieldName)) { + List grantedPermissions + = reader.readArray(reader1 -> PermissionProperty.fromString(reader1.getString())); + deserializedAwsCredsAuthenticationDetailsProperties.withGrantedPermissions(grantedPermissions); + } else if ("awsAccessKeyId".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.awsAccessKeyId = reader.getString(); + } else if ("awsSecretAccessKey".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.awsSecretAccessKey = reader.getString(); + } else if ("authenticationType".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else if ("accountId".equals(fieldName)) { + deserializedAwsCredsAuthenticationDetailsProperties.accountId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsCredsAuthenticationDetailsProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsEnvironmentData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsEnvironmentData.java index a52488b926a8..9fd3c91e8749 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsEnvironmentData.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsEnvironmentData.java @@ -5,52 +5,40 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * The AWS connector environment data. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "environmentType", - defaultImpl = AwsEnvironmentData.class, - visible = true) -@JsonTypeName("AwsAccount") @Fluent public final class AwsEnvironmentData extends EnvironmentData { /* * The type of the environment data. */ - @JsonTypeId - @JsonProperty(value = "environmentType", required = true) private EnvironmentType environmentType = EnvironmentType.AWS_ACCOUNT; /* * The AWS account's organizational data */ - @JsonProperty(value = "organizationalData") private AwsOrganizationalData organizationalData; /* * list of regions to scan */ - @JsonProperty(value = "regions") private List regions; /* * The AWS account name */ - @JsonProperty(value = "accountName", access = JsonProperty.Access.WRITE_ONLY) private String accountName; /* * Scan interval in hours (value should be between 1-hour to 24-hours) */ - @JsonProperty(value = "scanInterval") private Long scanInterval; /** @@ -145,9 +133,57 @@ public AwsEnvironmentData withScanInterval(Long scanInterval) { */ @Override public void validate() { - super.validate(); if (organizationalData() != null) { organizationalData().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("environmentType", + this.environmentType == null ? null : this.environmentType.toString()); + jsonWriter.writeJsonField("organizationalData", this.organizationalData); + jsonWriter.writeArrayField("regions", this.regions, (writer, element) -> writer.writeString(element)); + jsonWriter.writeNumberField("scanInterval", this.scanInterval); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsEnvironmentData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsEnvironmentData if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AwsEnvironmentData. + */ + public static AwsEnvironmentData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsEnvironmentData deserializedAwsEnvironmentData = new AwsEnvironmentData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("environmentType".equals(fieldName)) { + deserializedAwsEnvironmentData.environmentType = EnvironmentType.fromString(reader.getString()); + } else if ("organizationalData".equals(fieldName)) { + deserializedAwsEnvironmentData.organizationalData = AwsOrganizationalData.fromJson(reader); + } else if ("regions".equals(fieldName)) { + List regions = reader.readArray(reader1 -> reader1.getString()); + deserializedAwsEnvironmentData.regions = regions; + } else if ("accountName".equals(fieldName)) { + deserializedAwsEnvironmentData.accountName = reader.getString(); + } else if ("scanInterval".equals(fieldName)) { + deserializedAwsEnvironmentData.scanInterval = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsEnvironmentData; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalData.java index 0aa5ba846dfc..56b92e1a19ed 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalData.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalData.java @@ -5,38 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The AWS organization data. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "organizationMembershipType", - defaultImpl = AwsOrganizationalData.class, - visible = true) -@JsonTypeName("AwsOrganizationalData") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "Organization", value = AwsOrganizationalDataMaster.class), - @JsonSubTypes.Type(name = "Member", value = AwsOrganizationalDataMember.class) }) @Immutable -public class AwsOrganizationalData { +public class AwsOrganizationalData implements JsonSerializable { /* * The multi cloud account's membership type in the organization */ - @JsonTypeId - @JsonProperty(value = "organizationMembershipType", required = true) - private OrganizationMembershipType organizationMembershipType; + private OrganizationMembershipType organizationMembershipType + = OrganizationMembershipType.fromString("AwsOrganizationalData"); /** * Creates an instance of AwsOrganizationalData class. */ public AwsOrganizationalData() { - this.organizationMembershipType = OrganizationMembershipType.fromString("AwsOrganizationalData"); } /** @@ -55,4 +44,69 @@ public OrganizationMembershipType organizationMembershipType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("organizationMembershipType", + this.organizationMembershipType == null ? null : this.organizationMembershipType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsOrganizationalData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsOrganizationalData if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AwsOrganizationalData. + */ + public static AwsOrganizationalData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("organizationMembershipType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Organization".equals(discriminatorValue)) { + return AwsOrganizationalDataMaster.fromJson(readerToUse.reset()); + } else if ("Member".equals(discriminatorValue)) { + return AwsOrganizationalDataMember.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static AwsOrganizationalData fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsOrganizationalData deserializedAwsOrganizationalData = new AwsOrganizationalData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("organizationMembershipType".equals(fieldName)) { + deserializedAwsOrganizationalData.organizationMembershipType + = OrganizationMembershipType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsOrganizationalData; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMaster.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMaster.java index 53d5f00a072a..b4184946631c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMaster.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMaster.java @@ -5,40 +5,30 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * The AWS organization data for the master account. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "organizationMembershipType", - defaultImpl = AwsOrganizationalDataMaster.class, - visible = true) -@JsonTypeName("Organization") @Fluent public final class AwsOrganizationalDataMaster extends AwsOrganizationalData { /* * The multi cloud account's membership type in the organization */ - @JsonTypeId - @JsonProperty(value = "organizationMembershipType", required = true) private OrganizationMembershipType organizationMembershipType = OrganizationMembershipType.ORGANIZATION; /* * If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset */ - @JsonProperty(value = "stacksetName") private String stacksetName; /* * If the multi cloud account is of membership type organization, list of accounts excluded from offering */ - @JsonProperty(value = "excludedAccountIds") private List excludedAccountIds; /** @@ -108,6 +98,51 @@ public AwsOrganizationalDataMaster withExcludedAccountIds(List excludedA */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("organizationMembershipType", + this.organizationMembershipType == null ? null : this.organizationMembershipType.toString()); + jsonWriter.writeStringField("stacksetName", this.stacksetName); + jsonWriter.writeArrayField("excludedAccountIds", this.excludedAccountIds, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsOrganizationalDataMaster from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsOrganizationalDataMaster if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AwsOrganizationalDataMaster. + */ + public static AwsOrganizationalDataMaster fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsOrganizationalDataMaster deserializedAwsOrganizationalDataMaster = new AwsOrganizationalDataMaster(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("organizationMembershipType".equals(fieldName)) { + deserializedAwsOrganizationalDataMaster.organizationMembershipType + = OrganizationMembershipType.fromString(reader.getString()); + } else if ("stacksetName".equals(fieldName)) { + deserializedAwsOrganizationalDataMaster.stacksetName = reader.getString(); + } else if ("excludedAccountIds".equals(fieldName)) { + List excludedAccountIds = reader.readArray(reader1 -> reader1.getString()); + deserializedAwsOrganizationalDataMaster.excludedAccountIds = excludedAccountIds; + } else { + reader.skipChildren(); + } + } + + return deserializedAwsOrganizationalDataMaster; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMember.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMember.java index b3e285e2bf9a..1b9943d0a9ce 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMember.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AwsOrganizationalDataMember.java @@ -5,33 +5,24 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The AWS organization data for the member account. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "organizationMembershipType", - defaultImpl = AwsOrganizationalDataMember.class, - visible = true) -@JsonTypeName("Member") @Fluent public final class AwsOrganizationalDataMember extends AwsOrganizationalData { /* * The multi cloud account's membership type in the organization */ - @JsonTypeId - @JsonProperty(value = "organizationMembershipType", required = true) private OrganizationMembershipType organizationMembershipType = OrganizationMembershipType.MEMBER; /* * If the multi cloud account is not of membership type organization, this will be the ID of the account's parent */ - @JsonProperty(value = "parentHierarchyId") private String parentHierarchyId; /** @@ -79,6 +70,46 @@ public AwsOrganizationalDataMember withParentHierarchyId(String parentHierarchyI */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("organizationMembershipType", + this.organizationMembershipType == null ? null : this.organizationMembershipType.toString()); + jsonWriter.writeStringField("parentHierarchyId", this.parentHierarchyId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AwsOrganizationalDataMember from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AwsOrganizationalDataMember if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AwsOrganizationalDataMember. + */ + public static AwsOrganizationalDataMember fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AwsOrganizationalDataMember deserializedAwsOrganizationalDataMember = new AwsOrganizationalDataMember(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("organizationMembershipType".equals(fieldName)) { + deserializedAwsOrganizationalDataMember.organizationMembershipType + = OrganizationMembershipType.fromString(reader.getString()); + } else if ("parentHierarchyId".equals(fieldName)) { + deserializedAwsOrganizationalDataMember.parentHierarchyId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAwsOrganizationalDataMember; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgProperties.java index 2b37e805709d..8827c31a012f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsOrgProperties.java @@ -5,24 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; /** * Azure DevOps Organization properties. */ @Fluent -public final class AzureDevOpsOrgProperties { +public final class AzureDevOpsOrgProperties implements JsonSerializable { /* - * Gets or sets resource status message. + * Gets the resource status message. */ - @JsonProperty(value = "provisioningStatusMessage", access = JsonProperty.Access.WRITE_ONLY) private String provisioningStatusMessage; /* - * Gets or sets time when resource was last checked. + * Gets the time when resource was last checked. */ - @JsonProperty(value = "provisioningStatusUpdateTimeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime provisioningStatusUpdateTimeUtc; /* @@ -36,24 +39,22 @@ public final class AzureDevOpsOrgProperties { * DeletionSuccess - Deletion successful. * DeletionFailure - Deletion failure. */ - @JsonProperty(value = "provisioningState") private DevOpsProvisioningState provisioningState; /* * Details about resource onboarding status across all connectors. * - * OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + * OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only + * applicable to top-level resources. * Onboarded - this resource has already been onboarded by the specified connector. * NotOnboarded - this resource has not been onboarded to any connector. * NotApplicable - the onboarding state is not applicable to the current endpoint. */ - @JsonProperty(value = "onboardingState") private OnboardingState onboardingState; /* * Configuration payload for PR Annotations. */ - @JsonProperty(value = "actionableRemediation") private ActionableRemediation actionableRemediation; /** @@ -63,7 +64,7 @@ public AzureDevOpsOrgProperties() { } /** - * Get the provisioningStatusMessage property: Gets or sets resource status message. + * Get the provisioningStatusMessage property: Gets the resource status message. * * @return the provisioningStatusMessage value. */ @@ -72,7 +73,7 @@ public String provisioningStatusMessage() { } /** - * Get the provisioningStatusUpdateTimeUtc property: Gets or sets time when resource was last checked. + * Get the provisioningStatusUpdateTimeUtc property: Gets the time when resource was last checked. * * @return the provisioningStatusUpdateTimeUtc value. */ @@ -97,25 +98,6 @@ public DevOpsProvisioningState provisioningState() { return this.provisioningState; } - /** - * Set the provisioningState property: The provisioning state of the resource. - * - * Pending - Provisioning pending. - * Failed - Provisioning failed. - * Succeeded - Successful provisioning. - * Canceled - Provisioning canceled. - * PendingDeletion - Deletion pending. - * DeletionSuccess - Deletion successful. - * DeletionFailure - Deletion failure. - * - * @param provisioningState the provisioningState value to set. - * @return the AzureDevOpsOrgProperties object itself. - */ - public AzureDevOpsOrgProperties withProvisioningState(DevOpsProvisioningState provisioningState) { - this.provisioningState = provisioningState; - return this; - } - /** * Get the onboardingState property: Details about resource onboarding status across all connectors. * @@ -178,4 +160,53 @@ public void validate() { actionableRemediation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("onboardingState", + this.onboardingState == null ? null : this.onboardingState.toString()); + jsonWriter.writeJsonField("actionableRemediation", this.actionableRemediation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsOrgProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsOrgProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsOrgProperties. + */ + public static AzureDevOpsOrgProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsOrgProperties deserializedAzureDevOpsOrgProperties = new AzureDevOpsOrgProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningStatusMessage".equals(fieldName)) { + deserializedAzureDevOpsOrgProperties.provisioningStatusMessage = reader.getString(); + } else if ("provisioningStatusUpdateTimeUtc".equals(fieldName)) { + deserializedAzureDevOpsOrgProperties.provisioningStatusUpdateTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedAzureDevOpsOrgProperties.provisioningState + = DevOpsProvisioningState.fromString(reader.getString()); + } else if ("onboardingState".equals(fieldName)) { + deserializedAzureDevOpsOrgProperties.onboardingState + = OnboardingState.fromString(reader.getString()); + } else if ("actionableRemediation".equals(fieldName)) { + deserializedAzureDevOpsOrgProperties.actionableRemediation = ActionableRemediation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsOrgProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectListResponse.java index 3918608a6f0c..5f1fa3e27758 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectListResponse.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectListResponse.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AzureDevOpsProjectInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of RP resources which supports pagination. */ @Fluent -public final class AzureDevOpsProjectListResponse { +public final class AzureDevOpsProjectListResponse implements JsonSerializable { /* * Gets or sets list of resources. */ - @JsonProperty(value = "value") private List value; /* * Gets or sets next link to scroll over the results. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -82,4 +84,46 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsProjectListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsProjectListResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsProjectListResponse. + */ + public static AzureDevOpsProjectListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsProjectListResponse deserializedAzureDevOpsProjectListResponse + = new AzureDevOpsProjectListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AzureDevOpsProjectInner.fromJson(reader1)); + deserializedAzureDevOpsProjectListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAzureDevOpsProjectListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsProjectListResponse; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectProperties.java index cc53723e00f6..8fd05fbfa7c4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsProjectProperties.java @@ -5,24 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; /** * Azure DevOps Project properties. */ @Fluent -public final class AzureDevOpsProjectProperties { +public final class AzureDevOpsProjectProperties implements JsonSerializable { /* - * Gets or sets resource status message. + * Gets the resource status message. */ - @JsonProperty(value = "provisioningStatusMessage", access = JsonProperty.Access.WRITE_ONLY) private String provisioningStatusMessage; /* - * Gets or sets time when resource was last checked. + * Gets the time when resource was last checked. */ - @JsonProperty(value = "provisioningStatusUpdateTimeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime provisioningStatusUpdateTimeUtc; /* @@ -36,36 +39,32 @@ public final class AzureDevOpsProjectProperties { * DeletionSuccess - Deletion successful. * DeletionFailure - Deletion failure. */ - @JsonProperty(value = "provisioningState") private DevOpsProvisioningState provisioningState; /* * Gets or sets parent Azure DevOps Organization name. */ - @JsonProperty(value = "parentOrgName") private String parentOrgName; /* * Gets or sets Azure DevOps Project id. */ - @JsonProperty(value = "projectId", access = JsonProperty.Access.WRITE_ONLY) private String projectId; /* * Details about resource onboarding status across all connectors. * - * OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + * OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only + * applicable to top-level resources. * Onboarded - this resource has already been onboarded by the specified connector. * NotOnboarded - this resource has not been onboarded to any connector. * NotApplicable - the onboarding state is not applicable to the current endpoint. */ - @JsonProperty(value = "onboardingState") private OnboardingState onboardingState; /* * Configuration payload for PR Annotations. */ - @JsonProperty(value = "actionableRemediation") private ActionableRemediation actionableRemediation; /** @@ -75,7 +74,7 @@ public AzureDevOpsProjectProperties() { } /** - * Get the provisioningStatusMessage property: Gets or sets resource status message. + * Get the provisioningStatusMessage property: Gets the resource status message. * * @return the provisioningStatusMessage value. */ @@ -84,7 +83,7 @@ public String provisioningStatusMessage() { } /** - * Get the provisioningStatusUpdateTimeUtc property: Gets or sets time when resource was last checked. + * Get the provisioningStatusUpdateTimeUtc property: Gets the time when resource was last checked. * * @return the provisioningStatusUpdateTimeUtc value. */ @@ -109,25 +108,6 @@ public DevOpsProvisioningState provisioningState() { return this.provisioningState; } - /** - * Set the provisioningState property: The provisioning state of the resource. - * - * Pending - Provisioning pending. - * Failed - Provisioning failed. - * Succeeded - Successful provisioning. - * Canceled - Provisioning canceled. - * PendingDeletion - Deletion pending. - * DeletionSuccess - Deletion successful. - * DeletionFailure - Deletion failure. - * - * @param provisioningState the provisioningState value to set. - * @return the AzureDevOpsProjectProperties object itself. - */ - public AzureDevOpsProjectProperties withProvisioningState(DevOpsProvisioningState provisioningState) { - this.provisioningState = provisioningState; - return this; - } - /** * Get the parentOrgName property: Gets or sets parent Azure DevOps Organization name. * @@ -219,4 +199,59 @@ public void validate() { actionableRemediation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("parentOrgName", this.parentOrgName); + jsonWriter.writeStringField("onboardingState", + this.onboardingState == null ? null : this.onboardingState.toString()); + jsonWriter.writeJsonField("actionableRemediation", this.actionableRemediation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsProjectProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsProjectProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsProjectProperties. + */ + public static AzureDevOpsProjectProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsProjectProperties deserializedAzureDevOpsProjectProperties = new AzureDevOpsProjectProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningStatusMessage".equals(fieldName)) { + deserializedAzureDevOpsProjectProperties.provisioningStatusMessage = reader.getString(); + } else if ("provisioningStatusUpdateTimeUtc".equals(fieldName)) { + deserializedAzureDevOpsProjectProperties.provisioningStatusUpdateTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedAzureDevOpsProjectProperties.provisioningState + = DevOpsProvisioningState.fromString(reader.getString()); + } else if ("parentOrgName".equals(fieldName)) { + deserializedAzureDevOpsProjectProperties.parentOrgName = reader.getString(); + } else if ("projectId".equals(fieldName)) { + deserializedAzureDevOpsProjectProperties.projectId = reader.getString(); + } else if ("onboardingState".equals(fieldName)) { + deserializedAzureDevOpsProjectProperties.onboardingState + = OnboardingState.fromString(reader.getString()); + } else if ("actionableRemediation".equals(fieldName)) { + deserializedAzureDevOpsProjectProperties.actionableRemediation + = ActionableRemediation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsProjectProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryListResponse.java index 96282da28947..eb3a14b095b9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryListResponse.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryListResponse.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.AzureDevOpsRepositoryInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of RP resources which supports pagination. */ @Fluent -public final class AzureDevOpsRepositoryListResponse { +public final class AzureDevOpsRepositoryListResponse implements JsonSerializable { /* * Gets or sets list of resources. */ - @JsonProperty(value = "value") private List value; /* * Gets or sets next link to scroll over the results. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -82,4 +84,46 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsRepositoryListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsRepositoryListResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsRepositoryListResponse. + */ + public static AzureDevOpsRepositoryListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsRepositoryListResponse deserializedAzureDevOpsRepositoryListResponse + = new AzureDevOpsRepositoryListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AzureDevOpsRepositoryInner.fromJson(reader1)); + deserializedAzureDevOpsRepositoryListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAzureDevOpsRepositoryListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsRepositoryListResponse; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryProperties.java index 0bf6e35cec55..391a5e339578 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsRepositoryProperties.java @@ -5,24 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; /** * Azure DevOps Repository properties. */ @Fluent -public final class AzureDevOpsRepositoryProperties { +public final class AzureDevOpsRepositoryProperties implements JsonSerializable { /* - * Gets or sets resource status message. + * Gets the resource status message. */ - @JsonProperty(value = "provisioningStatusMessage", access = JsonProperty.Access.WRITE_ONLY) private String provisioningStatusMessage; /* - * Gets or sets time when resource was last checked. + * Gets the time when resource was last checked. */ - @JsonProperty(value = "provisioningStatusUpdateTimeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime provisioningStatusUpdateTimeUtc; /* @@ -36,54 +39,47 @@ public final class AzureDevOpsRepositoryProperties { * DeletionSuccess - Deletion successful. * DeletionFailure - Deletion failure. */ - @JsonProperty(value = "provisioningState") private DevOpsProvisioningState provisioningState; /* * Gets or sets parent Azure DevOps Organization name. */ - @JsonProperty(value = "parentOrgName") private String parentOrgName; /* * Gets or sets parent Azure DevOps Project name. */ - @JsonProperty(value = "parentProjectName") private String parentProjectName; /* * Gets or sets Azure DevOps Repository id. */ - @JsonProperty(value = "repoId", access = JsonProperty.Access.WRITE_ONLY) private String repoId; /* * Gets or sets Azure DevOps Repository url. */ - @JsonProperty(value = "repoUrl", access = JsonProperty.Access.WRITE_ONLY) private String repoUrl; /* * Gets or sets Azure DevOps repository visibility, whether it is public or private etc. */ - @JsonProperty(value = "visibility", access = JsonProperty.Access.WRITE_ONLY) private String visibility; /* * Details about resource onboarding status across all connectors. * - * OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level resources. + * OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only + * applicable to top-level resources. * Onboarded - this resource has already been onboarded by the specified connector. * NotOnboarded - this resource has not been onboarded to any connector. * NotApplicable - the onboarding state is not applicable to the current endpoint. */ - @JsonProperty(value = "onboardingState") private OnboardingState onboardingState; /* * Configuration payload for PR Annotations. */ - @JsonProperty(value = "actionableRemediation") private ActionableRemediation actionableRemediation; /** @@ -93,7 +89,7 @@ public AzureDevOpsRepositoryProperties() { } /** - * Get the provisioningStatusMessage property: Gets or sets resource status message. + * Get the provisioningStatusMessage property: Gets the resource status message. * * @return the provisioningStatusMessage value. */ @@ -102,7 +98,7 @@ public String provisioningStatusMessage() { } /** - * Get the provisioningStatusUpdateTimeUtc property: Gets or sets time when resource was last checked. + * Get the provisioningStatusUpdateTimeUtc property: Gets the time when resource was last checked. * * @return the provisioningStatusUpdateTimeUtc value. */ @@ -127,25 +123,6 @@ public DevOpsProvisioningState provisioningState() { return this.provisioningState; } - /** - * Set the provisioningState property: The provisioning state of the resource. - * - * Pending - Provisioning pending. - * Failed - Provisioning failed. - * Succeeded - Successful provisioning. - * Canceled - Provisioning canceled. - * PendingDeletion - Deletion pending. - * DeletionSuccess - Deletion successful. - * DeletionFailure - Deletion failure. - * - * @param provisioningState the provisioningState value to set. - * @return the AzureDevOpsRepositoryProperties object itself. - */ - public AzureDevOpsRepositoryProperties withProvisioningState(DevOpsProvisioningState provisioningState) { - this.provisioningState = provisioningState; - return this; - } - /** * Get the parentOrgName property: Gets or sets parent Azure DevOps Organization name. * @@ -276,4 +253,67 @@ public void validate() { actionableRemediation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("parentOrgName", this.parentOrgName); + jsonWriter.writeStringField("parentProjectName", this.parentProjectName); + jsonWriter.writeStringField("onboardingState", + this.onboardingState == null ? null : this.onboardingState.toString()); + jsonWriter.writeJsonField("actionableRemediation", this.actionableRemediation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsRepositoryProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsRepositoryProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsRepositoryProperties. + */ + public static AzureDevOpsRepositoryProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsRepositoryProperties deserializedAzureDevOpsRepositoryProperties + = new AzureDevOpsRepositoryProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningStatusMessage".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.provisioningStatusMessage = reader.getString(); + } else if ("provisioningStatusUpdateTimeUtc".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.provisioningStatusUpdateTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.provisioningState + = DevOpsProvisioningState.fromString(reader.getString()); + } else if ("parentOrgName".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.parentOrgName = reader.getString(); + } else if ("parentProjectName".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.parentProjectName = reader.getString(); + } else if ("repoId".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.repoId = reader.getString(); + } else if ("repoUrl".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.repoUrl = reader.getString(); + } else if ("visibility".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.visibility = reader.getString(); + } else if ("onboardingState".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.onboardingState + = OnboardingState.fromString(reader.getString()); + } else if ("actionableRemediation".equals(fieldName)) { + deserializedAzureDevOpsRepositoryProperties.actionableRemediation + = ActionableRemediation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsRepositoryProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsScopeEnvironmentData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsScopeEnvironmentData.java index dd7df7f1645b..1db212ca077b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsScopeEnvironmentData.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureDevOpsScopeEnvironmentData.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The AzureDevOps scope connector's environment data. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "environmentType", - defaultImpl = AzureDevOpsScopeEnvironmentData.class, - visible = true) -@JsonTypeName("AzureDevOpsScope") @Immutable public final class AzureDevOpsScopeEnvironmentData extends EnvironmentData { /* * The type of the environment data. */ - @JsonTypeId - @JsonProperty(value = "environmentType", required = true) private EnvironmentType environmentType = EnvironmentType.AZURE_DEV_OPS_SCOPE; /** @@ -51,6 +43,44 @@ public EnvironmentType environmentType() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("environmentType", + this.environmentType == null ? null : this.environmentType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureDevOpsScopeEnvironmentData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureDevOpsScopeEnvironmentData if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureDevOpsScopeEnvironmentData. + */ + public static AzureDevOpsScopeEnvironmentData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureDevOpsScopeEnvironmentData deserializedAzureDevOpsScopeEnvironmentData + = new AzureDevOpsScopeEnvironmentData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("environmentType".equals(fieldName)) { + deserializedAzureDevOpsScopeEnvironmentData.environmentType + = EnvironmentType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureDevOpsScopeEnvironmentData; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceDetails.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceDetails.java index 7d8087484db9..7ba3143dd4bb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceDetails.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceDetails.java @@ -5,29 +5,24 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Details of the Azure resource that was assessed. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "source", defaultImpl = AzureResourceDetails.class, visible = true) -@JsonTypeName("Azure") @Immutable public final class AzureResourceDetails extends ResourceDetails { /* * The platform where the assessed resource resides */ - @JsonTypeId - @JsonProperty(value = "source", required = true) private Source source = Source.AZURE; /* * Azure resource Id of the assessed resource */ - @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /** @@ -62,6 +57,43 @@ public String id() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("source", this.source == null ? null : this.source.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureResourceDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureResourceDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureResourceDetails. + */ + public static AzureResourceDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureResourceDetails deserializedAzureResourceDetails = new AzureResourceDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("source".equals(fieldName)) { + deserializedAzureResourceDetails.source = Source.fromString(reader.getString()); + } else if ("id".equals(fieldName)) { + deserializedAzureResourceDetails.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureResourceDetails; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceIdentifier.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceIdentifier.java index 3e5aae24a71c..8bea00ee3724 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceIdentifier.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceIdentifier.java @@ -5,33 +5,24 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Azure resource identifier. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type", - defaultImpl = AzureResourceIdentifier.class, - visible = true) -@JsonTypeName("AzureResource") @Immutable public final class AzureResourceIdentifier extends ResourceIdentifier { /* * There can be multiple identifiers of different type per alert, this field specify the identifier type. */ - @JsonTypeId - @JsonProperty(value = "type", required = true) private ResourceIdentifierType type = ResourceIdentifierType.AZURE_RESOURCE; /* * ARM resource identifier for the cloud resource being alerted on */ - @JsonProperty(value = "azureResourceId", access = JsonProperty.Access.WRITE_ONLY) private String azureResourceId; /** @@ -67,6 +58,43 @@ public String azureResourceId() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureResourceIdentifier from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureResourceIdentifier if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureResourceIdentifier. + */ + public static AzureResourceIdentifier fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureResourceIdentifier deserializedAzureResourceIdentifier = new AzureResourceIdentifier(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedAzureResourceIdentifier.type = ResourceIdentifierType.fromString(reader.getString()); + } else if ("azureResourceId".equals(fieldName)) { + deserializedAzureResourceIdentifier.azureResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureResourceIdentifier; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceLink.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceLink.java index 6daa6a30dff4..976bf5e1201e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceLink.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureResourceLink.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Describes an Azure resource with kind. */ @Immutable -public final class AzureResourceLink { +public final class AzureResourceLink implements JsonSerializable { /* * Azure resource Id */ - @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /** @@ -40,4 +43,39 @@ public String id() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureResourceLink from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureResourceLink if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureResourceLink. + */ + public static AzureResourceLink fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureResourceLink deserializedAzureResourceLink = new AzureResourceLink(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzureResourceLink.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureResourceLink; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureServersSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureServersSetting.java index a72d2cf41165..18b05be81c14 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureServersSetting.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureServersSetting.java @@ -5,34 +5,50 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsAzureSettingProperties; import com.azure.resourcemanager.security.fluent.models.ServerVulnerabilityAssessmentsSettingInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * A vulnerability assessments setting on Azure servers in the defined scope. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "kind", defaultImpl = AzureServersSetting.class, visible = true) -@JsonTypeName("AzureServersSetting") @Fluent public final class AzureServersSetting extends ServerVulnerabilityAssessmentsSettingInner { /* * The kind of the server vulnerability assessments setting. */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) private ServerVulnerabilityAssessmentsSettingKind kind = ServerVulnerabilityAssessmentsSettingKind.AZURE_SERVERS_SETTING; /* * The vulnerability assessments setting properties on Azure servers in the defined scope. */ - @JsonProperty(value = "properties") private ServerVulnerabilityAssessmentsAzureSettingProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of AzureServersSetting class. */ @@ -59,6 +75,46 @@ private ServerVulnerabilityAssessmentsAzureSettingProperties innerProperties() { return this.innerProperties; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the selectedProvider property: The selected vulnerability assessments provider on Azure servers in the * defined scope. @@ -92,9 +148,58 @@ public ServerVulnerabilityAssessmentsAzureSettingSelectedProvider selectedProvid */ @Override public void validate() { - super.validate(); if (innerProperties() != null) { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureServersSetting from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureServersSetting if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureServersSetting. + */ + public static AzureServersSetting fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureServersSetting deserializedAzureServersSetting = new AzureServersSetting(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzureServersSetting.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAzureServersSetting.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAzureServersSetting.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedAzureServersSetting.systemData = SystemData.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedAzureServersSetting.kind + = ServerVulnerabilityAssessmentsSettingKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedAzureServersSetting.innerProperties + = ServerVulnerabilityAssessmentsAzureSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureServersSetting; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureTrackedResourceLocation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureTrackedResourceLocation.java index bb5adbfb4f26..98f019768ba4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureTrackedResourceLocation.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AzureTrackedResourceLocation.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Describes an Azure resource with location. */ @Fluent -public class AzureTrackedResourceLocation { +public class AzureTrackedResourceLocation implements JsonSerializable { /* * Location where the resource is stored */ - @JsonProperty(value = "location") private String location; /** @@ -51,4 +54,40 @@ public AzureTrackedResourceLocation withLocation(String location) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureTrackedResourceLocation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureTrackedResourceLocation if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AzureTrackedResourceLocation. + */ + public static AzureTrackedResourceLocation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureTrackedResourceLocation deserializedAzureTrackedResourceLocation = new AzureTrackedResourceLocation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("location".equals(fieldName)) { + deserializedAzureTrackedResourceLocation.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureTrackedResourceLocation; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java index a057ceaf1e39..d37d31a3ef70 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Baseline.java @@ -5,25 +5,29 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; /** * Baseline details. */ @Fluent -public final class Baseline { +public final class Baseline implements JsonSerializable { /* * Expected results. */ - @JsonProperty(value = "expectedResults") private List> expectedResults; /* * Baseline update time (UTC). */ - @JsonProperty(value = "updatedTime") private OffsetDateTime updatedTime; /** @@ -79,4 +83,48 @@ public Baseline withUpdatedTime(OffsetDateTime updatedTime) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("expectedResults", this.expectedResults, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + jsonWriter.writeStringField("updatedTime", + this.updatedTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.updatedTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Baseline from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Baseline if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Baseline. + */ + public static Baseline fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Baseline deserializedBaseline = new Baseline(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("expectedResults".equals(fieldName)) { + List> expectedResults + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedBaseline.expectedResults = expectedResults; + } else if ("updatedTime".equals(fieldName)) { + deserializedBaseline.updatedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedBaseline; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BaselineAdjustedResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BaselineAdjustedResult.java index 4bf91b01f9ef..910e46c1aec0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BaselineAdjustedResult.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BaselineAdjustedResult.java @@ -5,36 +5,36 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * The rule result adjusted with baseline. */ @Fluent -public final class BaselineAdjustedResult { +public final class BaselineAdjustedResult implements JsonSerializable { /* * Baseline details. */ - @JsonProperty(value = "baseline") private Baseline baseline; /* * The rule result status. */ - @JsonProperty(value = "status") private RuleStatus status; /* * Results the are not in baseline. */ - @JsonProperty(value = "resultsNotInBaseline") private List> resultsNotInBaseline; /* * Results the are in baseline. */ - @JsonProperty(value = "resultsOnlyInBaseline") private List> resultsOnlyInBaseline; /** @@ -133,4 +133,55 @@ public void validate() { baseline().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("baseline", this.baseline); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeArrayField("resultsNotInBaseline", this.resultsNotInBaseline, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + jsonWriter.writeArrayField("resultsOnlyInBaseline", this.resultsOnlyInBaseline, + (writer, element) -> writer.writeArray(element, (writer1, element1) -> writer1.writeString(element1))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BaselineAdjustedResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BaselineAdjustedResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the BaselineAdjustedResult. + */ + public static BaselineAdjustedResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BaselineAdjustedResult deserializedBaselineAdjustedResult = new BaselineAdjustedResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("baseline".equals(fieldName)) { + deserializedBaselineAdjustedResult.baseline = Baseline.fromJson(reader); + } else if ("status".equals(fieldName)) { + deserializedBaselineAdjustedResult.status = RuleStatus.fromString(reader.getString()); + } else if ("resultsNotInBaseline".equals(fieldName)) { + List> resultsNotInBaseline + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedBaselineAdjustedResult.resultsNotInBaseline = resultsNotInBaseline; + } else if ("resultsOnlyInBaseline".equals(fieldName)) { + List> resultsOnlyInBaseline + = reader.readArray(reader1 -> reader1.readArray(reader2 -> reader2.getString())); + deserializedBaselineAdjustedResult.resultsOnlyInBaseline = resultsOnlyInBaseline; + } else { + reader.skipChildren(); + } + } + + return deserializedBaselineAdjustedResult; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BenchmarkReference.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BenchmarkReference.java index 86edae55926c..c51fdc59c1b2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BenchmarkReference.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BenchmarkReference.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The benchmark references. */ @Fluent -public final class BenchmarkReference { +public final class BenchmarkReference implements JsonSerializable { /* * The benchmark name. */ - @JsonProperty(value = "benchmark") private String benchmark; /* * The benchmark reference. */ - @JsonProperty(value = "reference") private String reference; /** @@ -77,4 +79,43 @@ public BenchmarkReference withReference(String reference) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("benchmark", this.benchmark); + jsonWriter.writeStringField("reference", this.reference); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BenchmarkReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BenchmarkReference if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BenchmarkReference. + */ + public static BenchmarkReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BenchmarkReference deserializedBenchmarkReference = new BenchmarkReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("benchmark".equals(fieldName)) { + deserializedBenchmarkReference.benchmark = reader.getString(); + } else if ("reference".equals(fieldName)) { + deserializedBenchmarkReference.reference = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBenchmarkReference; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobsScanSummary.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobsScanSummary.java new file mode 100644 index 000000000000..139e6fdbc0fd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BlobsScanSummary.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A summary of the scan results of the blobs that were scanned. + */ +@Fluent +public final class BlobsScanSummary implements JsonSerializable { + /* + * The total number of blobs that were scanned. + */ + private Long totalBlobsScanned; + + /* + * The number of malicious blobs that were detected during the scan. + */ + private Long maliciousBlobsCount; + + /* + * The number of blobs that were skipped. + */ + private Long skippedBlobsCount; + + /* + * The number of gigabytes of data that were scanned. + */ + private Double scannedBlobsInGB; + + /** + * Creates an instance of BlobsScanSummary class. + */ + public BlobsScanSummary() { + } + + /** + * Get the totalBlobsScanned property: The total number of blobs that were scanned. + * + * @return the totalBlobsScanned value. + */ + public Long totalBlobsScanned() { + return this.totalBlobsScanned; + } + + /** + * Set the totalBlobsScanned property: The total number of blobs that were scanned. + * + * @param totalBlobsScanned the totalBlobsScanned value to set. + * @return the BlobsScanSummary object itself. + */ + public BlobsScanSummary withTotalBlobsScanned(Long totalBlobsScanned) { + this.totalBlobsScanned = totalBlobsScanned; + return this; + } + + /** + * Get the maliciousBlobsCount property: The number of malicious blobs that were detected during the scan. + * + * @return the maliciousBlobsCount value. + */ + public Long maliciousBlobsCount() { + return this.maliciousBlobsCount; + } + + /** + * Set the maliciousBlobsCount property: The number of malicious blobs that were detected during the scan. + * + * @param maliciousBlobsCount the maliciousBlobsCount value to set. + * @return the BlobsScanSummary object itself. + */ + public BlobsScanSummary withMaliciousBlobsCount(Long maliciousBlobsCount) { + this.maliciousBlobsCount = maliciousBlobsCount; + return this; + } + + /** + * Get the skippedBlobsCount property: The number of blobs that were skipped. + * + * @return the skippedBlobsCount value. + */ + public Long skippedBlobsCount() { + return this.skippedBlobsCount; + } + + /** + * Set the skippedBlobsCount property: The number of blobs that were skipped. + * + * @param skippedBlobsCount the skippedBlobsCount value to set. + * @return the BlobsScanSummary object itself. + */ + public BlobsScanSummary withSkippedBlobsCount(Long skippedBlobsCount) { + this.skippedBlobsCount = skippedBlobsCount; + return this; + } + + /** + * Get the scannedBlobsInGB property: The number of gigabytes of data that were scanned. + * + * @return the scannedBlobsInGB value. + */ + public Double scannedBlobsInGB() { + return this.scannedBlobsInGB; + } + + /** + * Set the scannedBlobsInGB property: The number of gigabytes of data that were scanned. + * + * @param scannedBlobsInGB the scannedBlobsInGB value to set. + * @return the BlobsScanSummary object itself. + */ + public BlobsScanSummary withScannedBlobsInGB(Double scannedBlobsInGB) { + this.scannedBlobsInGB = scannedBlobsInGB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("totalBlobsScanned", this.totalBlobsScanned); + jsonWriter.writeNumberField("maliciousBlobsCount", this.maliciousBlobsCount); + jsonWriter.writeNumberField("skippedBlobsCount", this.skippedBlobsCount); + jsonWriter.writeNumberField("scannedBlobsInGB", this.scannedBlobsInGB); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BlobsScanSummary from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BlobsScanSummary if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BlobsScanSummary. + */ + public static BlobsScanSummary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BlobsScanSummary deserializedBlobsScanSummary = new BlobsScanSummary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("totalBlobsScanned".equals(fieldName)) { + deserializedBlobsScanSummary.totalBlobsScanned = reader.getNullable(JsonReader::getLong); + } else if ("maliciousBlobsCount".equals(fieldName)) { + deserializedBlobsScanSummary.maliciousBlobsCount = reader.getNullable(JsonReader::getLong); + } else if ("skippedBlobsCount".equals(fieldName)) { + deserializedBlobsScanSummary.skippedBlobsCount = reader.getNullable(JsonReader::getLong); + } else if ("scannedBlobsInGB".equals(fieldName)) { + deserializedBlobsScanSummary.scannedBlobsInGB = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedBlobsScanSummary; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BuiltInInfoType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BuiltInInfoType.java index f579d5a558ef..876c026eb963 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BuiltInInfoType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BuiltInInfoType.java @@ -5,30 +5,32 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; import java.util.UUID; /** * Pre-configured sensitive information type. */ @Fluent -public final class BuiltInInfoType { +public final class BuiltInInfoType implements JsonSerializable { /* * Display name of the info type */ - @JsonProperty(value = "name") private String name; /* * Id of the info type */ - @JsonProperty(value = "id") private UUID id; /* * Category of the built-in info type */ - @JsonProperty(value = "type") private String type; /** @@ -104,4 +106,47 @@ public BuiltInInfoType withType(String type) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("id", Objects.toString(this.id, null)); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BuiltInInfoType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BuiltInInfoType if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BuiltInInfoType. + */ + public static BuiltInInfoType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BuiltInInfoType deserializedBuiltInInfoType = new BuiltInInfoType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedBuiltInInfoType.name = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedBuiltInInfoType.id + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("type".equals(fieldName)) { + deserializedBuiltInInfoType.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBuiltInInfoType; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BundleType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BundleType.java index 2c284f4c2bc2..d225cf997749 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BundleType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/BundleType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -72,7 +71,6 @@ public BundleType() { * @param name a name to look for. * @return the corresponding BundleType. */ - @JsonCreator public static BundleType fromString(String name) { return fromString(name, BundleType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Categories.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Categories.java index 0f3ad301c78d..5bf617e939f4 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Categories.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Categories.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -52,7 +51,6 @@ public Categories() { * @param name a name to look for. * @return the corresponding Categories. */ - @JsonCreator public static Categories fromString(String name) { return fromString(name, Categories.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CategoryConfiguration.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CategoryConfiguration.java index 337cfc02f7ae..b52a6f04d65c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CategoryConfiguration.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CategoryConfiguration.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Severity level per category configuration for PR Annotations. */ @Fluent -public final class CategoryConfiguration { +public final class CategoryConfiguration implements JsonSerializable { /* * Gets or sets minimum severity level for a given category. */ - @JsonProperty(value = "minimumSeverityLevel") private String minimumSeverityLevel; /* @@ -27,7 +30,6 @@ public final class CategoryConfiguration { * Secrets scanning results. * Container scanning results. */ - @JsonProperty(value = "category") private RuleCategory category; /** @@ -95,4 +97,43 @@ public CategoryConfiguration withCategory(RuleCategory category) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("minimumSeverityLevel", this.minimumSeverityLevel); + jsonWriter.writeStringField("category", this.category == null ? null : this.category.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CategoryConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CategoryConfiguration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the CategoryConfiguration. + */ + public static CategoryConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CategoryConfiguration deserializedCategoryConfiguration = new CategoryConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("minimumSeverityLevel".equals(fieldName)) { + deserializedCategoryConfiguration.minimumSeverityLevel = reader.getString(); + } else if ("category".equals(fieldName)) { + deserializedCategoryConfiguration.category = RuleCategory.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCategoryConfiguration; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefExternalSecuritySolution.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefExternalSecuritySolution.java index a2a1701aae2f..ea7a5aa56537 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefExternalSecuritySolution.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefExternalSecuritySolution.java @@ -5,36 +5,47 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Represents a security solution which sends CEF logs to an OMS workspace. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "kind", - defaultImpl = CefExternalSecuritySolution.class, - visible = true) -@JsonTypeName("CEF") @Fluent public final class CefExternalSecuritySolution extends ExternalSecuritySolutionInner { /* * The kind of the external solution */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) private ExternalSecuritySolutionKind kind = ExternalSecuritySolutionKind.CEF; /* * The external security solution properties for CEF solutions */ - @JsonProperty(value = "properties") private CefSolutionProperties properties; + /* + * Location where the resource is stored + */ + private String location; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of CefExternalSecuritySolution class. */ @@ -71,6 +82,46 @@ public CefExternalSecuritySolution withProperties(CefSolutionProperties properti return this; } + /** + * Get the location property: Location where the resource is stored. + * + * @return the location value. + */ + @Override + public String location() { + return this.location; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. * @@ -78,9 +129,57 @@ public CefExternalSecuritySolution withProperties(CefSolutionProperties properti */ @Override public void validate() { - super.validate(); if (properties() != null) { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CefExternalSecuritySolution from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CefExternalSecuritySolution if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CefExternalSecuritySolution. + */ + public static CefExternalSecuritySolution fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CefExternalSecuritySolution deserializedCefExternalSecuritySolution = new CefExternalSecuritySolution(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCefExternalSecuritySolution.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCefExternalSecuritySolution.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCefExternalSecuritySolution.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCefExternalSecuritySolution.location = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedCefExternalSecuritySolution.kind + = ExternalSecuritySolutionKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedCefExternalSecuritySolution.properties = CefSolutionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCefExternalSecuritySolution; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefSolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefSolutionProperties.java index bfb05b218fdf..09272fc5a237 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefSolutionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CefSolutionProperties.java @@ -5,7 +5,12 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; /** * The external security solution properties for CEF solutions. @@ -15,19 +20,16 @@ public final class CefSolutionProperties extends ExternalSecuritySolutionPropert /* * The hostname property. */ - @JsonProperty(value = "hostname") private String hostname; /* * The agent property. */ - @JsonProperty(value = "agent") private String agent; /* * The lastEventReceived property. */ - @JsonProperty(value = "lastEventReceived") private String lastEventReceived; /** @@ -130,6 +132,70 @@ public CefSolutionProperties withWorkspace(ConnectedWorkspace workspace) { */ @Override public void validate() { - super.validate(); + if (workspace() != null) { + workspace().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deviceVendor", deviceVendor()); + jsonWriter.writeStringField("deviceType", deviceType()); + jsonWriter.writeJsonField("workspace", workspace()); + jsonWriter.writeStringField("hostname", this.hostname); + jsonWriter.writeStringField("agent", this.agent); + jsonWriter.writeStringField("lastEventReceived", this.lastEventReceived); + if (additionalProperties() != null) { + for (Map.Entry additionalProperty : additionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CefSolutionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CefSolutionProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the CefSolutionProperties. + */ + public static CefSolutionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CefSolutionProperties deserializedCefSolutionProperties = new CefSolutionProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceVendor".equals(fieldName)) { + deserializedCefSolutionProperties.withDeviceVendor(reader.getString()); + } else if ("deviceType".equals(fieldName)) { + deserializedCefSolutionProperties.withDeviceType(reader.getString()); + } else if ("workspace".equals(fieldName)) { + deserializedCefSolutionProperties.withWorkspace(ConnectedWorkspace.fromJson(reader)); + } else if ("hostname".equals(fieldName)) { + deserializedCefSolutionProperties.hostname = reader.getString(); + } else if ("agent".equals(fieldName)) { + deserializedCefSolutionProperties.agent = reader.getString(); + } else if ("lastEventReceived".equals(fieldName)) { + deserializedCefSolutionProperties.lastEventReceived = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedCefSolutionProperties.withAdditionalProperties(additionalProperties); + + return deserializedCefSolutionProperties; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudName.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudName.java index 7ea279843cc9..f9a67c24f3f2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudName.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudName.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,6 +41,16 @@ public final class CloudName extends ExpandableStringEnum { */ public static final CloudName GIT_LAB = fromString("GitLab"); + /** + * Static value DockerHub for CloudName. + */ + public static final CloudName DOCKER_HUB = fromString("DockerHub"); + + /** + * Static value JFrog for CloudName. + */ + public static final CloudName JFROG = fromString("JFrog"); + /** * Creates a new instance of CloudName value. * @@ -57,7 +66,6 @@ public CloudName() { * @param name a name to look for. * @return the corresponding CloudName. */ - @JsonCreator public static CloudName fromString(String name) { return fromString(name, CloudName.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudOffering.java index e287532bb9ee..d6ca88251798 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CloudOffering.java @@ -5,51 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The security offering details. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "offeringType", defaultImpl = CloudOffering.class, visible = true) -@JsonTypeName("CloudOffering") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "CspmMonitorAws", value = CspmMonitorAwsOffering.class), - @JsonSubTypes.Type(name = "DefenderForContainersAws", value = DefenderForContainersAwsOffering.class), - @JsonSubTypes.Type(name = "DefenderForServersAws", value = DefenderForServersAwsOffering.class), - @JsonSubTypes.Type(name = "DefenderForDatabasesAws", value = DefenderFoDatabasesAwsOffering.class), - @JsonSubTypes.Type(name = "CspmMonitorGcp", value = CspmMonitorGcpOffering.class), - @JsonSubTypes.Type(name = "DefenderForServersGcp", value = DefenderForServersGcpOffering.class), - @JsonSubTypes.Type(name = "DefenderForDatabasesGcp", value = DefenderForDatabasesGcpOffering.class), - @JsonSubTypes.Type(name = "DefenderForContainersGcp", value = DefenderForContainersGcpOffering.class), - @JsonSubTypes.Type(name = "CspmMonitorGithub", value = CspmMonitorGithubOffering.class), - @JsonSubTypes.Type(name = "CspmMonitorAzureDevOps", value = CspmMonitorAzureDevOpsOffering.class), - @JsonSubTypes.Type(name = "DefenderCspmAws", value = DefenderCspmAwsOffering.class), - @JsonSubTypes.Type(name = "DefenderCspmGcp", value = DefenderCspmGcpOffering.class), - @JsonSubTypes.Type(name = "CspmMonitorGitLab", value = CspmMonitorGitLabOffering.class) }) @Immutable -public class CloudOffering { +public class CloudOffering implements JsonSerializable { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) - private OfferingType offeringType; + private OfferingType offeringType = OfferingType.fromString("CloudOffering"); /* * The offering description. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /** * Creates an instance of CloudOffering class. */ public CloudOffering() { - this.offeringType = OfferingType.fromString("CloudOffering"); } /** @@ -70,6 +50,17 @@ public String description() { return this.description; } + /** + * Set the description property: The offering description. + * + * @param description the description value to set. + * @return the CloudOffering object itself. + */ + CloudOffering withDescription(String description) { + this.description = description; + return this; + } + /** * Validates the instance. * @@ -77,4 +68,103 @@ public String description() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CloudOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CloudOffering if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CloudOffering. + */ + public static CloudOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("offeringType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("CspmMonitorAws".equals(discriminatorValue)) { + return CspmMonitorAwsOffering.fromJson(readerToUse.reset()); + } else if ("DefenderForContainersAws".equals(discriminatorValue)) { + return DefenderForContainersAwsOffering.fromJson(readerToUse.reset()); + } else if ("DefenderForServersAws".equals(discriminatorValue)) { + return DefenderForServersAwsOffering.fromJson(readerToUse.reset()); + } else if ("DefenderForDatabasesAws".equals(discriminatorValue)) { + return DefenderFoDatabasesAwsOffering.fromJson(readerToUse.reset()); + } else if ("CspmMonitorGcp".equals(discriminatorValue)) { + return CspmMonitorGcpOffering.fromJson(readerToUse.reset()); + } else if ("DefenderForServersGcp".equals(discriminatorValue)) { + return DefenderForServersGcpOffering.fromJson(readerToUse.reset()); + } else if ("DefenderForDatabasesGcp".equals(discriminatorValue)) { + return DefenderForDatabasesGcpOffering.fromJson(readerToUse.reset()); + } else if ("DefenderForContainersGcp".equals(discriminatorValue)) { + return DefenderForContainersGcpOffering.fromJson(readerToUse.reset()); + } else if ("CspmMonitorGithub".equals(discriminatorValue)) { + return CspmMonitorGithubOffering.fromJson(readerToUse.reset()); + } else if ("CspmMonitorAzureDevOps".equals(discriminatorValue)) { + return CspmMonitorAzureDevOpsOffering.fromJson(readerToUse.reset()); + } else if ("DefenderCspmAws".equals(discriminatorValue)) { + return DefenderCspmAwsOffering.fromJson(readerToUse.reset()); + } else if ("DefenderCspmGcp".equals(discriminatorValue)) { + return DefenderCspmGcpOffering.fromJson(readerToUse.reset()); + } else if ("CspmMonitorGitLab".equals(discriminatorValue)) { + return CspmMonitorGitLabOffering.fromJson(readerToUse.reset()); + } else if ("CspmMonitorDockerHub".equals(discriminatorValue)) { + return CspmMonitorDockerHubOffering.fromJson(readerToUse.reset()); + } else if ("DefenderForContainersDockerHub".equals(discriminatorValue)) { + return DefenderForContainersDockerHubOffering.fromJson(readerToUse.reset()); + } else if ("DefenderCspmDockerHub".equals(discriminatorValue)) { + return DefenderCspmDockerHubOffering.fromJson(readerToUse.reset()); + } else if ("CspmMonitorJFrog".equals(discriminatorValue)) { + return CspmMonitorJFrogOffering.fromJson(readerToUse.reset()); + } else if ("DefenderForContainersJFrog".equals(discriminatorValue)) { + return DefenderForContainersJFrogOffering.fromJson(readerToUse.reset()); + } else if ("DefenderCspmJFrog".equals(discriminatorValue)) { + return DefenderCspmJFrogOffering.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static CloudOffering fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CloudOffering deserializedCloudOffering = new CloudOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("offeringType".equals(fieldName)) { + deserializedCloudOffering.offeringType = OfferingType.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedCloudOffering.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCloudOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Code.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Code.java index 03946dd3e0c9..9239bcbeffc2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Code.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Code.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public Code() { * @param name a name to look for. * @return the corresponding Code. */ - @JsonCreator public static Code fromString(String name) { return fromString(name, Code.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceList.java index cdb5d3c4b33b..009d7add85ea 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ComplianceInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of Compliance objects response. */ @Fluent -public final class ComplianceList { +public final class ComplianceList implements JsonSerializable { /* * List of Compliance objects */ - @JsonProperty(value = "value") private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -71,4 +73,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComplianceList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComplianceList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ComplianceList. + */ + public static ComplianceList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComplianceList deserializedComplianceList = new ComplianceList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ComplianceInner.fromJson(reader1)); + deserializedComplianceList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedComplianceList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedComplianceList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResultList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResultList.java index e9ef5174e725..1b57193054db 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResultList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceResultList.java @@ -6,25 +6,27 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ComplianceResultInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of compliance results response. */ @Fluent -public final class ComplianceResultList { +public final class ComplianceResultList implements JsonSerializable { /* * List of compliance results */ - @JsonProperty(value = "value", required = true) private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -77,4 +79,45 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(ComplianceResultList.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComplianceResultList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComplianceResultList if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ComplianceResultList. + */ + public static ComplianceResultList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComplianceResultList deserializedComplianceResultList = new ComplianceResultList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ComplianceResultInner.fromJson(reader1)); + deserializedComplianceResultList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedComplianceResultList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedComplianceResultList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceSegment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceSegment.java index 8f4728c35f83..2d1131f322e3 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceSegment.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ComplianceSegment.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * A segment of a compliance assessment. */ @Immutable -public final class ComplianceSegment { +public final class ComplianceSegment implements JsonSerializable { /* * The segment type, e.g. compliant, non-compliance, insufficient coverage, N/A, etc. */ - @JsonProperty(value = "segmentType", access = JsonProperty.Access.WRITE_ONLY) private String segmentType; /* * The size (%) of the segment. */ - @JsonProperty(value = "percentage", access = JsonProperty.Access.WRITE_ONLY) private Double percentage; /** @@ -55,4 +57,41 @@ public Double percentage() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComplianceSegment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComplianceSegment if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ComplianceSegment. + */ + public static ComplianceSegment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ComplianceSegment deserializedComplianceSegment = new ComplianceSegment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("segmentType".equals(fieldName)) { + deserializedComplianceSegment.segmentType = reader.getString(); + } else if ("percentage".equals(fieldName)) { + deserializedComplianceSegment.percentage = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedComplianceSegment; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConfigurationStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConfigurationStatus.java deleted file mode 100644 index d5ef61efa78d..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConfigurationStatus.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * The configuration status of the machines group or machine or rule. - */ -public final class ConfigurationStatus extends ExpandableStringEnum { - /** - * Static value Configured for ConfigurationStatus. - */ - public static final ConfigurationStatus CONFIGURED = fromString("Configured"); - - /** - * Static value NotConfigured for ConfigurationStatus. - */ - public static final ConfigurationStatus NOT_CONFIGURED = fromString("NotConfigured"); - - /** - * Static value InProgress for ConfigurationStatus. - */ - public static final ConfigurationStatus IN_PROGRESS = fromString("InProgress"); - - /** - * Static value Failed for ConfigurationStatus. - */ - public static final ConfigurationStatus FAILED = fromString("Failed"); - - /** - * Static value NoStatus for ConfigurationStatus. - */ - public static final ConfigurationStatus NO_STATUS = fromString("NoStatus"); - - /** - * Creates a new instance of ConfigurationStatus value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ConfigurationStatus() { - } - - /** - * Creates or finds a ConfigurationStatus from its string representation. - * - * @param name a name to look for. - * @return the corresponding ConfigurationStatus. - */ - @JsonCreator - public static ConfigurationStatus fromString(String name) { - return fromString(name, ConfigurationStatus.class); - } - - /** - * Gets known ConfigurationStatus values. - * - * @return known ConfigurationStatus values. - */ - public static Collection values() { - return values(ConfigurationStatus.class); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectableResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectableResource.java index 2c6fd74ee58e..e58dd19f47df 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectableResource.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectableResource.java @@ -5,30 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Describes the allowed inbound and outbound traffic of an Azure resource. */ @Immutable -public final class ConnectableResource { +public final class ConnectableResource implements JsonSerializable { /* * The Azure resource id */ - @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private String id; /* * The list of Azure resources that the resource has inbound allowed connection from */ - @JsonProperty(value = "inboundConnectedResources", access = JsonProperty.Access.WRITE_ONLY) private List inboundConnectedResources; /* * The list of Azure resources that the resource has outbound allowed connection to */ - @JsonProperty(value = "outboundConnectedResources", access = JsonProperty.Access.WRITE_ONLY) private List outboundConnectedResources; /** @@ -79,4 +80,47 @@ public void validate() { outboundConnectedResources().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectableResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectableResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectableResource. + */ + public static ConnectableResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectableResource deserializedConnectableResource = new ConnectableResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedConnectableResource.id = reader.getString(); + } else if ("inboundConnectedResources".equals(fieldName)) { + List inboundConnectedResources + = reader.readArray(reader1 -> ConnectedResource.fromJson(reader1)); + deserializedConnectableResource.inboundConnectedResources = inboundConnectedResources; + } else if ("outboundConnectedResources".equals(fieldName)) { + List outboundConnectedResources + = reader.readArray(reader1 -> ConnectedResource.fromJson(reader1)); + deserializedConnectableResource.outboundConnectedResources = outboundConnectedResources; + } else { + reader.skipChildren(); + } + } + + return deserializedConnectableResource; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedResource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedResource.java index c2f50d81704c..ba4775e8edc7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedResource.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedResource.java @@ -5,29 +5,30 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Describes properties of a connected resource. */ @Immutable -public final class ConnectedResource { +public final class ConnectedResource implements JsonSerializable { /* * The Azure resource id of the connected resource */ - @JsonProperty(value = "connectedResourceId", access = JsonProperty.Access.WRITE_ONLY) private String connectedResourceId; /* * The allowed tcp ports */ - @JsonProperty(value = "tcpPorts", access = JsonProperty.Access.WRITE_ONLY) private String tcpPorts; /* * The allowed udp ports */ - @JsonProperty(value = "udpPorts", access = JsonProperty.Access.WRITE_ONLY) private String udpPorts; /** @@ -70,4 +71,43 @@ public String udpPorts() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectedResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectedResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectedResource. + */ + public static ConnectedResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectedResource deserializedConnectedResource = new ConnectedResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectedResourceId".equals(fieldName)) { + deserializedConnectedResource.connectedResourceId = reader.getString(); + } else if ("tcpPorts".equals(fieldName)) { + deserializedConnectedResource.tcpPorts = reader.getString(); + } else if ("udpPorts".equals(fieldName)) { + deserializedConnectedResource.udpPorts = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectedResource; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedWorkspace.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedWorkspace.java index 22bb02e956c3..cafb7c3a93a6 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedWorkspace.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectedWorkspace.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Represents an OMS workspace to which the solution is connected. */ @Fluent -public final class ConnectedWorkspace { +public final class ConnectedWorkspace implements JsonSerializable { /* * Azure resource ID of the connected OMS workspace */ - @JsonProperty(value = "id") private String id; /** @@ -51,4 +54,40 @@ public ConnectedWorkspace withId(String id) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectedWorkspace from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectedWorkspace if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectedWorkspace. + */ + public static ConnectedWorkspace fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectedWorkspace deserializedConnectedWorkspace = new ConnectedWorkspace(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedConnectedWorkspace.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectedWorkspace; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionFromIpNotAllowed.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionFromIpNotAllowed.java index 2c04351b66a5..513b1f37abf7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionFromIpNotAllowed.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionFromIpNotAllowed.java @@ -5,28 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Inbound connection from an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in CIDR notation. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = ConnectionFromIpNotAllowed.class, - visible = true) -@JsonTypeName("ConnectionFromIpNotAllowed") @Fluent public final class ConnectionFromIpNotAllowed extends AllowlistCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "ConnectionFromIpNotAllowed"; /** @@ -70,6 +63,63 @@ public ConnectionFromIpNotAllowed withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); + if (allowlistValues() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property allowlistValues in model ConnectionFromIpNotAllowed")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectionFromIpNotAllowed.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeArrayField("allowlistValues", allowlistValues(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectionFromIpNotAllowed from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectionFromIpNotAllowed if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectionFromIpNotAllowed. + */ + public static ConnectionFromIpNotAllowed fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionFromIpNotAllowed deserializedConnectionFromIpNotAllowed = new ConnectionFromIpNotAllowed(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedConnectionFromIpNotAllowed.withIsEnabled(reader.getBoolean()); + } else if ("allowlistValues".equals(fieldName)) { + List allowlistValues = reader.readArray(reader1 -> reader1.getString()); + deserializedConnectionFromIpNotAllowed.withAllowlistValues(allowlistValues); + } else if ("displayName".equals(fieldName)) { + deserializedConnectionFromIpNotAllowed.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedConnectionFromIpNotAllowed.withDescription(reader.getString()); + } else if ("valueType".equals(fieldName)) { + deserializedConnectionFromIpNotAllowed.withValueType(ValueType.fromString(reader.getString())); + } else if ("ruleType".equals(fieldName)) { + deserializedConnectionFromIpNotAllowed.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectionFromIpNotAllowed; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionToIpNotAllowed.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionToIpNotAllowed.java index 75d76b977e99..8ff6d4912919 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionToIpNotAllowed.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionToIpNotAllowed.java @@ -5,28 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or ipv6 range in CIDR notation. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = ConnectionToIpNotAllowed.class, - visible = true) -@JsonTypeName("ConnectionToIpNotAllowed") @Fluent public final class ConnectionToIpNotAllowed extends AllowlistCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "ConnectionToIpNotAllowed"; /** @@ -70,6 +63,63 @@ public ConnectionToIpNotAllowed withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); + if (allowlistValues() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property allowlistValues in model ConnectionToIpNotAllowed")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectionToIpNotAllowed.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeArrayField("allowlistValues", allowlistValues(), + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectionToIpNotAllowed from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectionToIpNotAllowed if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConnectionToIpNotAllowed. + */ + public static ConnectionToIpNotAllowed fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectionToIpNotAllowed deserializedConnectionToIpNotAllowed = new ConnectionToIpNotAllowed(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedConnectionToIpNotAllowed.withIsEnabled(reader.getBoolean()); + } else if ("allowlistValues".equals(fieldName)) { + List allowlistValues = reader.readArray(reader1 -> reader1.getString()); + deserializedConnectionToIpNotAllowed.withAllowlistValues(allowlistValues); + } else if ("displayName".equals(fieldName)) { + deserializedConnectionToIpNotAllowed.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedConnectionToIpNotAllowed.withDescription(reader.getString()); + } else if ("valueType".equals(fieldName)) { + deserializedConnectionToIpNotAllowed.withValueType(ValueType.fromString(reader.getString())); + } else if ("ruleType".equals(fieldName)) { + deserializedConnectionToIpNotAllowed.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectionToIpNotAllowed; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionType.java index 5277fab3b303..fd6ee4b9b3e7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectionType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public ConnectionType() { * @param name a name to look for. * @return the corresponding ConnectionType. */ - @JsonCreator public static ConnectionType fromString(String name) { return fromString(name, ConnectionType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java index cb7207bf37d9..38abef3717a7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ConnectorSettingList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ConnectorSettingInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * For a subscription, list of all cloud account connectors and their settings. */ @Fluent -public final class ConnectorSettingList { +public final class ConnectorSettingList implements JsonSerializable { /* * List of all the cloud account connector settings */ - @JsonProperty(value = "value") private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorSettingList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorSettingList if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConnectorSettingList. + */ + public static ConnectorSettingList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorSettingList deserializedConnectorSettingList = new ConnectorSettingList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ConnectorSettingInner.fromJson(reader1)); + deserializedConnectorSettingList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedConnectorSettingList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorSettingList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ContainerRegistryVulnerabilityProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ContainerRegistryVulnerabilityProperties.java index c7bc429223d4..8e0819e44c6b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ContainerRegistryVulnerabilityProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ContainerRegistryVulnerabilityProperties.java @@ -5,11 +5,11 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; import java.util.Map; @@ -17,68 +17,51 @@ /** * Additional context fields for container registry Vulnerability assessment. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "assessedResourceType", - defaultImpl = ContainerRegistryVulnerabilityProperties.class, - visible = true) -@JsonTypeName("ContainerRegistryVulnerability") @Immutable public final class ContainerRegistryVulnerabilityProperties extends AdditionalData { /* * Sub-assessment resource type */ - @JsonTypeId - @JsonProperty(value = "assessedResourceType", required = true) private AssessedResourceType assessedResourceType = AssessedResourceType.CONTAINER_REGISTRY_VULNERABILITY; /* * Vulnerability Type. e.g: Vulnerability, Potential Vulnerability, Information Gathered, Vulnerability */ - @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) private String type; /* * Dictionary from cvss version to cvss details object */ - @JsonProperty(value = "cvss", access = JsonProperty.Access.WRITE_ONLY) - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map cvss; /* * Indicates whether a patch is available or not */ - @JsonProperty(value = "patchable", access = JsonProperty.Access.WRITE_ONLY) private Boolean patchable; /* * List of CVEs */ - @JsonProperty(value = "cve", access = JsonProperty.Access.WRITE_ONLY) private List cve; /* * Published time */ - @JsonProperty(value = "publishedTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime publishedTime; /* * The vendorReferences property. */ - @JsonProperty(value = "vendorReferences", access = JsonProperty.Access.WRITE_ONLY) private List vendorReferences; /* * Name of the repository which the vulnerable image belongs to */ - @JsonProperty(value = "repositoryName", access = JsonProperty.Access.WRITE_ONLY) private String repositoryName; /* * Digest of the vulnerable image */ - @JsonProperty(value = "imageDigest", access = JsonProperty.Access.WRITE_ONLY) private String imageDigest; /** @@ -177,7 +160,6 @@ public String imageDigest() { */ @Override public void validate() { - super.validate(); if (cvss() != null) { cvss().values().forEach(e -> { if (e != null) { @@ -192,4 +174,65 @@ public void validate() { vendorReferences().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("assessedResourceType", + this.assessedResourceType == null ? null : this.assessedResourceType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContainerRegistryVulnerabilityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContainerRegistryVulnerabilityProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ContainerRegistryVulnerabilityProperties. + */ + public static ContainerRegistryVulnerabilityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContainerRegistryVulnerabilityProperties deserializedContainerRegistryVulnerabilityProperties + = new ContainerRegistryVulnerabilityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assessedResourceType".equals(fieldName)) { + deserializedContainerRegistryVulnerabilityProperties.assessedResourceType + = AssessedResourceType.fromString(reader.getString()); + } else if ("type".equals(fieldName)) { + deserializedContainerRegistryVulnerabilityProperties.type = reader.getString(); + } else if ("cvss".equals(fieldName)) { + Map cvss = reader.readMap(reader1 -> Cvss.fromJson(reader1)); + deserializedContainerRegistryVulnerabilityProperties.cvss = cvss; + } else if ("patchable".equals(fieldName)) { + deserializedContainerRegistryVulnerabilityProperties.patchable + = reader.getNullable(JsonReader::getBoolean); + } else if ("cve".equals(fieldName)) { + List cve = reader.readArray(reader1 -> Cve.fromJson(reader1)); + deserializedContainerRegistryVulnerabilityProperties.cve = cve; + } else if ("publishedTime".equals(fieldName)) { + deserializedContainerRegistryVulnerabilityProperties.publishedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("vendorReferences".equals(fieldName)) { + List vendorReferences + = reader.readArray(reader1 -> VendorReference.fromJson(reader1)); + deserializedContainerRegistryVulnerabilityProperties.vendorReferences = vendorReferences; + } else if ("repositoryName".equals(fieldName)) { + deserializedContainerRegistryVulnerabilityProperties.repositoryName = reader.getString(); + } else if ("imageDigest".equals(fieldName)) { + deserializedContainerRegistryVulnerabilityProperties.imageDigest = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedContainerRegistryVulnerabilityProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ControlType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ControlType.java index db3d2ac06d2a..72bba5e02ff6 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ControlType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ControlType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public ControlType() { * @param name a name to look for. * @return the corresponding ControlType. */ - @JsonCreator public static ControlType fromString(String name) { return fromString(name, ControlType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOffering.java index fa7346b839eb..0a688baca65f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOffering.java @@ -5,33 +5,24 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The CSPM monitoring for AWS offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = CspmMonitorAwsOffering.class, - visible = true) -@JsonTypeName("CspmMonitorAws") @Fluent public final class CspmMonitorAwsOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.CSPM_MONITOR_AWS; /* * The native cloud connection configuration */ - @JsonProperty(value = "nativeCloudConnection") private CspmMonitorAwsOfferingNativeCloudConnection nativeCloudConnection; /** @@ -78,9 +69,50 @@ public CspmMonitorAwsOfferingNativeCloudConnection nativeCloudConnection() { */ @Override public void validate() { - super.validate(); if (nativeCloudConnection() != null) { nativeCloudConnection().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("nativeCloudConnection", this.nativeCloudConnection); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorAwsOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorAwsOffering if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorAwsOffering. + */ + public static CspmMonitorAwsOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorAwsOffering deserializedCspmMonitorAwsOffering = new CspmMonitorAwsOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCspmMonitorAwsOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedCspmMonitorAwsOffering.offeringType = OfferingType.fromString(reader.getString()); + } else if ("nativeCloudConnection".equals(fieldName)) { + deserializedCspmMonitorAwsOffering.nativeCloudConnection + = CspmMonitorAwsOfferingNativeCloudConnection.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorAwsOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOfferingNativeCloudConnection.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOfferingNativeCloudConnection.java index 53368e794c00..7c7a762a0c05 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOfferingNativeCloudConnection.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAwsOfferingNativeCloudConnection.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The native cloud connection configuration. */ @Fluent -public final class CspmMonitorAwsOfferingNativeCloudConnection { +public final class CspmMonitorAwsOfferingNativeCloudConnection + implements JsonSerializable { /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -51,4 +55,41 @@ public CspmMonitorAwsOfferingNativeCloudConnection withCloudRoleArn(String cloud */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorAwsOfferingNativeCloudConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorAwsOfferingNativeCloudConnection if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorAwsOfferingNativeCloudConnection. + */ + public static CspmMonitorAwsOfferingNativeCloudConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorAwsOfferingNativeCloudConnection deserializedCspmMonitorAwsOfferingNativeCloudConnection + = new CspmMonitorAwsOfferingNativeCloudConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cloudRoleArn".equals(fieldName)) { + deserializedCspmMonitorAwsOfferingNativeCloudConnection.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorAwsOfferingNativeCloudConnection; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAzureDevOpsOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAzureDevOpsOffering.java index 589650110dc7..8996f071e5a6 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAzureDevOpsOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorAzureDevOpsOffering.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The CSPM monitoring for AzureDevOps offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = CspmMonitorAzureDevOpsOffering.class, - visible = true) -@JsonTypeName("CspmMonitorAzureDevOps") @Immutable public final class CspmMonitorAzureDevOpsOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.CSPM_MONITOR_AZURE_DEV_OPS; /** @@ -51,6 +43,45 @@ public OfferingType offeringType() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorAzureDevOpsOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorAzureDevOpsOffering if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorAzureDevOpsOffering. + */ + public static CspmMonitorAzureDevOpsOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorAzureDevOpsOffering deserializedCspmMonitorAzureDevOpsOffering + = new CspmMonitorAzureDevOpsOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCspmMonitorAzureDevOpsOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedCspmMonitorAzureDevOpsOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorAzureDevOpsOffering; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorDockerHubOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorDockerHubOffering.java new file mode 100644 index 000000000000..f70f6296ad9e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorDockerHubOffering.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM (Cloud security posture management) monitoring for Docker Hub offering. + */ +@Immutable +public final class CspmMonitorDockerHubOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.CSPM_MONITOR_DOCKER_HUB; + + /** + * Creates an instance of CspmMonitorDockerHubOffering class. + */ + public CspmMonitorDockerHubOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorDockerHubOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorDockerHubOffering if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorDockerHubOffering. + */ + public static CspmMonitorDockerHubOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorDockerHubOffering deserializedCspmMonitorDockerHubOffering = new CspmMonitorDockerHubOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCspmMonitorDockerHubOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedCspmMonitorDockerHubOffering.offeringType = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorDockerHubOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOffering.java index 811738018c28..2ebdeabdb4cc 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOffering.java @@ -5,33 +5,24 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The CSPM monitoring for GCP offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = CspmMonitorGcpOffering.class, - visible = true) -@JsonTypeName("CspmMonitorGcp") @Fluent public final class CspmMonitorGcpOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.CSPM_MONITOR_GCP; /* * The native cloud connection configuration */ - @JsonProperty(value = "nativeCloudConnection") private CspmMonitorGcpOfferingNativeCloudConnection nativeCloudConnection; /** @@ -78,9 +69,50 @@ public CspmMonitorGcpOfferingNativeCloudConnection nativeCloudConnection() { */ @Override public void validate() { - super.validate(); if (nativeCloudConnection() != null) { nativeCloudConnection().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("nativeCloudConnection", this.nativeCloudConnection); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorGcpOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorGcpOffering if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorGcpOffering. + */ + public static CspmMonitorGcpOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorGcpOffering deserializedCspmMonitorGcpOffering = new CspmMonitorGcpOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCspmMonitorGcpOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedCspmMonitorGcpOffering.offeringType = OfferingType.fromString(reader.getString()); + } else if ("nativeCloudConnection".equals(fieldName)) { + deserializedCspmMonitorGcpOffering.nativeCloudConnection + = CspmMonitorGcpOfferingNativeCloudConnection.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorGcpOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOfferingNativeCloudConnection.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOfferingNativeCloudConnection.java index 7b461f588950..c2516d111cd0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOfferingNativeCloudConnection.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGcpOfferingNativeCloudConnection.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The native cloud connection configuration. */ @Fluent -public final class CspmMonitorGcpOfferingNativeCloudConnection { +public final class CspmMonitorGcpOfferingNativeCloudConnection + implements JsonSerializable { /* * The GCP workload identity provider id for the offering */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /* * The service account email address in GCP for this offering */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /** @@ -79,4 +82,46 @@ public String serviceAccountEmailAddress() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorGcpOfferingNativeCloudConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorGcpOfferingNativeCloudConnection if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorGcpOfferingNativeCloudConnection. + */ + public static CspmMonitorGcpOfferingNativeCloudConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorGcpOfferingNativeCloudConnection deserializedCspmMonitorGcpOfferingNativeCloudConnection + = new CspmMonitorGcpOfferingNativeCloudConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedCspmMonitorGcpOfferingNativeCloudConnection.workloadIdentityProviderId + = reader.getString(); + } else if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedCspmMonitorGcpOfferingNativeCloudConnection.serviceAccountEmailAddress + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorGcpOfferingNativeCloudConnection; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGitLabOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGitLabOffering.java index 7c4558ae50ea..5288592e193c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGitLabOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGitLabOffering.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The CSPM (Cloud security posture management) monitoring for gitlab offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = CspmMonitorGitLabOffering.class, - visible = true) -@JsonTypeName("CspmMonitorGitLab") @Immutable public final class CspmMonitorGitLabOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.CSPM_MONITOR_GIT_LAB; /** @@ -51,6 +43,43 @@ public OfferingType offeringType() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorGitLabOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorGitLabOffering if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorGitLabOffering. + */ + public static CspmMonitorGitLabOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorGitLabOffering deserializedCspmMonitorGitLabOffering = new CspmMonitorGitLabOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCspmMonitorGitLabOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedCspmMonitorGitLabOffering.offeringType = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorGitLabOffering; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGithubOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGithubOffering.java index c9b7b6ca7bcc..70b32ff71469 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGithubOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorGithubOffering.java @@ -5,27 +5,19 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The CSPM monitoring for github offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = CspmMonitorGithubOffering.class, - visible = true) -@JsonTypeName("CspmMonitorGithub") @Immutable public final class CspmMonitorGithubOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.CSPM_MONITOR_GITHUB; /** @@ -51,6 +43,43 @@ public OfferingType offeringType() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorGithubOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorGithubOffering if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorGithubOffering. + */ + public static CspmMonitorGithubOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorGithubOffering deserializedCspmMonitorGithubOffering = new CspmMonitorGithubOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCspmMonitorGithubOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedCspmMonitorGithubOffering.offeringType = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorGithubOffering; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorJFrogOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorJFrogOffering.java new file mode 100644 index 000000000000..212e71dc4d33 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CspmMonitorJFrogOffering.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM (Cloud security posture management) monitoring for JFrog Artifactory offering. + */ +@Immutable +public final class CspmMonitorJFrogOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.CSPM_MONITOR_JFROG; + + /** + * Creates an instance of CspmMonitorJFrogOffering class. + */ + public CspmMonitorJFrogOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CspmMonitorJFrogOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CspmMonitorJFrogOffering if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CspmMonitorJFrogOffering. + */ + public static CspmMonitorJFrogOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CspmMonitorJFrogOffering deserializedCspmMonitorJFrogOffering = new CspmMonitorJFrogOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedCspmMonitorJFrogOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedCspmMonitorJFrogOffering.offeringType = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCspmMonitorJFrogOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAlertRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAlertRule.java index 30340763e611..67927fca5781 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAlertRule.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAlertRule.java @@ -5,52 +5,41 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * A custom alert rule. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "ruleType", defaultImpl = CustomAlertRule.class, visible = true) -@JsonTypeName("CustomAlertRule") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "ThresholdCustomAlertRule", value = ThresholdCustomAlertRule.class), - @JsonSubTypes.Type(name = "ListCustomAlertRule", value = ListCustomAlertRule.class) }) @Fluent -public class CustomAlertRule { +public class CustomAlertRule implements JsonSerializable { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) - private String ruleType; + private String ruleType = "CustomAlertRule"; /* * The display name of the custom alert. */ - @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) private String displayName; /* * The description of the custom alert. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * Status of the custom alert. */ - @JsonProperty(value = "isEnabled", required = true) private boolean isEnabled; /** * Creates an instance of CustomAlertRule class. */ public CustomAlertRule() { - this.ruleType = "CustomAlertRule"; } /** @@ -71,6 +60,17 @@ public String displayName() { return this.displayName; } + /** + * Set the displayName property: The display name of the custom alert. + * + * @param displayName the displayName value to set. + * @return the CustomAlertRule object itself. + */ + CustomAlertRule withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + /** * Get the description property: The description of the custom alert. * @@ -80,6 +80,17 @@ public String description() { return this.description; } + /** + * Set the description property: The description of the custom alert. + * + * @param description the description value to set. + * @return the CustomAlertRule object itself. + */ + CustomAlertRule withDescription(String description) { + this.description = description; + return this; + } + /** * Get the isEnabled property: Status of the custom alert. * @@ -107,4 +118,121 @@ public CustomAlertRule withIsEnabled(boolean isEnabled) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", this.isEnabled); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAlertRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAlertRule if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomAlertRule. + */ + public static CustomAlertRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("ruleType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("ThresholdCustomAlertRule".equals(discriminatorValue)) { + return ThresholdCustomAlertRule.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("TimeWindowCustomAlertRule".equals(discriminatorValue)) { + return TimeWindowCustomAlertRule.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("ActiveConnectionsNotInAllowedRange".equals(discriminatorValue)) { + return ActiveConnectionsNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("AmqpC2DMessagesNotInAllowedRange".equals(discriminatorValue)) { + return AmqpC2DMessagesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("MqttC2DMessagesNotInAllowedRange".equals(discriminatorValue)) { + return MqttC2DMessagesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("HttpC2DMessagesNotInAllowedRange".equals(discriminatorValue)) { + return HttpC2DMessagesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("AmqpC2DRejectedMessagesNotInAllowedRange".equals(discriminatorValue)) { + return AmqpC2DRejectedMessagesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("MqttC2DRejectedMessagesNotInAllowedRange".equals(discriminatorValue)) { + return MqttC2DRejectedMessagesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("HttpC2DRejectedMessagesNotInAllowedRange".equals(discriminatorValue)) { + return HttpC2DRejectedMessagesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("AmqpD2CMessagesNotInAllowedRange".equals(discriminatorValue)) { + return AmqpD2CMessagesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("MqttD2CMessagesNotInAllowedRange".equals(discriminatorValue)) { + return MqttD2CMessagesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("HttpD2CMessagesNotInAllowedRange".equals(discriminatorValue)) { + return HttpD2CMessagesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("DirectMethodInvokesNotInAllowedRange".equals(discriminatorValue)) { + return DirectMethodInvokesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("FailedLocalLoginsNotInAllowedRange".equals(discriminatorValue)) { + return FailedLocalLoginsNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("FileUploadsNotInAllowedRange".equals(discriminatorValue)) { + return FileUploadsNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("QueuePurgesNotInAllowedRange".equals(discriminatorValue)) { + return QueuePurgesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("TwinUpdatesNotInAllowedRange".equals(discriminatorValue)) { + return TwinUpdatesNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("UnauthorizedOperationsNotInAllowedRange".equals(discriminatorValue)) { + return UnauthorizedOperationsNotInAllowedRange.fromJson(readerToUse.reset()); + } else if ("ListCustomAlertRule".equals(discriminatorValue)) { + return ListCustomAlertRule.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("AllowlistCustomAlertRule".equals(discriminatorValue)) { + return AllowlistCustomAlertRule.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("ConnectionToIpNotAllowed".equals(discriminatorValue)) { + return ConnectionToIpNotAllowed.fromJson(readerToUse.reset()); + } else if ("ConnectionFromIpNotAllowed".equals(discriminatorValue)) { + return ConnectionFromIpNotAllowed.fromJson(readerToUse.reset()); + } else if ("LocalUserNotAllowed".equals(discriminatorValue)) { + return LocalUserNotAllowed.fromJson(readerToUse.reset()); + } else if ("ProcessNotAllowed".equals(discriminatorValue)) { + return ProcessNotAllowed.fromJson(readerToUse.reset()); + } else if ("DenylistCustomAlertRule".equals(discriminatorValue)) { + return DenylistCustomAlertRule.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static CustomAlertRule fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAlertRule deserializedCustomAlertRule = new CustomAlertRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedCustomAlertRule.isEnabled = reader.getBoolean(); + } else if ("ruleType".equals(fieldName)) { + deserializedCustomAlertRule.ruleType = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedCustomAlertRule.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedCustomAlertRule.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAlertRule; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationRequest.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationRequest.java index a8eac3b82095..3de840c60d4f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationRequest.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationRequest.java @@ -6,8 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.CustomAssessmentAutomationRequestProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * Custom Assessment Automation request. @@ -17,9 +20,23 @@ public final class CustomAssessmentAutomationRequest extends ProxyResource { /* * describes Custom Assessment Automation request properties. */ - @JsonProperty(value = "properties") private CustomAssessmentAutomationRequestProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of CustomAssessmentAutomationRequest class. */ @@ -35,6 +52,36 @@ private CustomAssessmentAutomationRequestProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the compressedQuery property: Base 64 encoded KQL query representing the assessment automation results * required. @@ -189,4 +236,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAssessmentAutomationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationRequest. + */ + public static CustomAssessmentAutomationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationRequest deserializedCustomAssessmentAutomationRequest + = new CustomAssessmentAutomationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequest.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequest.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequest.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCustomAssessmentAutomationRequest.innerProperties + = CustomAssessmentAutomationRequestProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationRequest; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationsListResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationsListResult.java index f2817eb84c43..215b4ad6a32c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationsListResult.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomAssessmentAutomationsListResult.java @@ -5,25 +5,28 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.CustomAssessmentAutomationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * A list of Custom Assessment Automations. */ @Fluent -public final class CustomAssessmentAutomationsListResult { +public final class CustomAssessmentAutomationsListResult + implements JsonSerializable { /* * Collection of Custom Assessment Automations */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The link used to get the next page of operations. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +74,45 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomAssessmentAutomationsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomAssessmentAutomationsListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomAssessmentAutomationsListResult. + */ + public static CustomAssessmentAutomationsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomAssessmentAutomationsListResult deserializedCustomAssessmentAutomationsListResult + = new CustomAssessmentAutomationsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CustomAssessmentAutomationInner.fromJson(reader1)); + deserializedCustomAssessmentAutomationsListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCustomAssessmentAutomationsListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomAssessmentAutomationsListResult; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentRequest.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentRequest.java index d861fb9e1cec..cf4393a9b338 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentRequest.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentRequest.java @@ -5,18 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentRequestProperties; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; /** * describes the custom entity store assignment request. */ @Fluent -public final class CustomEntityStoreAssignmentRequest { +public final class CustomEntityStoreAssignmentRequest implements JsonSerializable { /* * describes properties of custom entity store assignment request */ - @JsonProperty(value = "properties") private CustomEntityStoreAssignmentRequestProperties innerProperties; /** @@ -69,4 +72,42 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityStoreAssignmentRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentRequest. + */ + public static CustomEntityStoreAssignmentRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentRequest deserializedCustomEntityStoreAssignmentRequest + = new CustomEntityStoreAssignmentRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentRequest.innerProperties + = CustomEntityStoreAssignmentRequestProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentRequest; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentsListResult.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentsListResult.java index 6f78441d7b68..f0b33e8a3363 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentsListResult.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomEntityStoreAssignmentsListResult.java @@ -5,25 +5,28 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.CustomEntityStoreAssignmentInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * A list of custom entity store assignments. */ @Fluent -public final class CustomEntityStoreAssignmentsListResult { +public final class CustomEntityStoreAssignmentsListResult + implements JsonSerializable { /* * Collection of custom entity store assignments */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * The link used to get the next page of operations. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -71,4 +74,45 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomEntityStoreAssignmentsListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomEntityStoreAssignmentsListResult if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomEntityStoreAssignmentsListResult. + */ + public static CustomEntityStoreAssignmentsListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomEntityStoreAssignmentsListResult deserializedCustomEntityStoreAssignmentsListResult + = new CustomEntityStoreAssignmentsListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CustomEntityStoreAssignmentInner.fromJson(reader1)); + deserializedCustomEntityStoreAssignmentsListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCustomEntityStoreAssignmentsListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomEntityStoreAssignmentsListResult; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendation.java new file mode 100644 index 000000000000..78f38dedef9d --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendation.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.CustomRecommendationInner; +import java.util.List; + +/** + * An immutable client-side representation of CustomRecommendation. + */ +public interface CustomRecommendation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the query property: KQL query representing the Recommendation results required. + * + * @return the query value. + */ + String query(); + + /** + * Gets the cloudProviders property: List of all standard supported clouds. + * + * @return the cloudProviders value. + */ + List cloudProviders(); + + /** + * Gets the severity property: The severity to relate to the assessments generated by this Recommendation. + * + * @return the severity value. + */ + SeverityEnum severity(); + + /** + * Gets the securityIssue property: The severity to relate to the assessments generated by this Recommendation. + * + * @return the securityIssue value. + */ + SecurityIssue securityIssue(); + + /** + * Gets the displayName property: The display name of the assessments generated by this Recommendation. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: The description to relate to the assessments generated by this Recommendation. + * + * @return the description value. + */ + String description(); + + /** + * Gets the remediationDescription property: The remediation description to relate to the assessments generated by + * this Recommendation. + * + * @return the remediationDescription value. + */ + String remediationDescription(); + + /** + * Gets the assessmentKey property: The assessment metadata key used when an assessment is generated for this + * Recommendation. + * + * @return the assessmentKey value. + */ + String assessmentKey(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.CustomRecommendationInner object. + * + * @return the inner object. + */ + CustomRecommendationInner innerModel(); + + /** + * The entirety of the CustomRecommendation definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The CustomRecommendation definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CustomRecommendation definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the CustomRecommendation definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + + /** + * The stage of the CustomRecommendation definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithQuery, DefinitionStages.WithCloudProviders, + DefinitionStages.WithSeverity, DefinitionStages.WithSecurityIssue, DefinitionStages.WithDisplayName, + DefinitionStages.WithDescription, DefinitionStages.WithRemediationDescription { + /** + * Executes the create request. + * + * @return the created resource. + */ + CustomRecommendation create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CustomRecommendation create(Context context); + } + + /** + * The stage of the CustomRecommendation definition allowing to specify query. + */ + interface WithQuery { + /** + * Specifies the query property: KQL query representing the Recommendation results required.. + * + * @param query KQL query representing the Recommendation results required. + * @return the next definition stage. + */ + WithCreate withQuery(String query); + } + + /** + * The stage of the CustomRecommendation definition allowing to specify cloudProviders. + */ + interface WithCloudProviders { + /** + * Specifies the cloudProviders property: List of all standard supported clouds.. + * + * @param cloudProviders List of all standard supported clouds. + * @return the next definition stage. + */ + WithCreate withCloudProviders(List cloudProviders); + } + + /** + * The stage of the CustomRecommendation definition allowing to specify severity. + */ + interface WithSeverity { + /** + * Specifies the severity property: The severity to relate to the assessments generated by this + * Recommendation.. + * + * @param severity The severity to relate to the assessments generated by this Recommendation. + * @return the next definition stage. + */ + WithCreate withSeverity(SeverityEnum severity); + } + + /** + * The stage of the CustomRecommendation definition allowing to specify securityIssue. + */ + interface WithSecurityIssue { + /** + * Specifies the securityIssue property: The severity to relate to the assessments generated by this + * Recommendation.. + * + * @param securityIssue The severity to relate to the assessments generated by this Recommendation. + * @return the next definition stage. + */ + WithCreate withSecurityIssue(SecurityIssue securityIssue); + } + + /** + * The stage of the CustomRecommendation definition allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the assessments generated by this + * Recommendation.. + * + * @param displayName The display name of the assessments generated by this Recommendation. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the CustomRecommendation definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description to relate to the assessments generated by this + * Recommendation.. + * + * @param description The description to relate to the assessments generated by this Recommendation. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the CustomRecommendation definition allowing to specify remediationDescription. + */ + interface WithRemediationDescription { + /** + * Specifies the remediationDescription property: The remediation description to relate to the assessments + * generated by this Recommendation.. + * + * @param remediationDescription The remediation description to relate to the assessments generated by this + * Recommendation. + * @return the next definition stage. + */ + WithCreate withRemediationDescription(String remediationDescription); + } + } + + /** + * Begins update for the CustomRecommendation resource. + * + * @return the stage of resource update. + */ + CustomRecommendation.Update update(); + + /** + * The template for CustomRecommendation update. + */ + interface Update extends UpdateStages.WithQuery, UpdateStages.WithCloudProviders, UpdateStages.WithSeverity, + UpdateStages.WithSecurityIssue, UpdateStages.WithDisplayName, UpdateStages.WithDescription, + UpdateStages.WithRemediationDescription { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CustomRecommendation apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CustomRecommendation apply(Context context); + } + + /** + * The CustomRecommendation update stages. + */ + interface UpdateStages { + /** + * The stage of the CustomRecommendation update allowing to specify query. + */ + interface WithQuery { + /** + * Specifies the query property: KQL query representing the Recommendation results required.. + * + * @param query KQL query representing the Recommendation results required. + * @return the next definition stage. + */ + Update withQuery(String query); + } + + /** + * The stage of the CustomRecommendation update allowing to specify cloudProviders. + */ + interface WithCloudProviders { + /** + * Specifies the cloudProviders property: List of all standard supported clouds.. + * + * @param cloudProviders List of all standard supported clouds. + * @return the next definition stage. + */ + Update withCloudProviders(List cloudProviders); + } + + /** + * The stage of the CustomRecommendation update allowing to specify severity. + */ + interface WithSeverity { + /** + * Specifies the severity property: The severity to relate to the assessments generated by this + * Recommendation.. + * + * @param severity The severity to relate to the assessments generated by this Recommendation. + * @return the next definition stage. + */ + Update withSeverity(SeverityEnum severity); + } + + /** + * The stage of the CustomRecommendation update allowing to specify securityIssue. + */ + interface WithSecurityIssue { + /** + * Specifies the securityIssue property: The severity to relate to the assessments generated by this + * Recommendation.. + * + * @param securityIssue The severity to relate to the assessments generated by this Recommendation. + * @return the next definition stage. + */ + Update withSecurityIssue(SecurityIssue securityIssue); + } + + /** + * The stage of the CustomRecommendation update allowing to specify displayName. + */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the assessments generated by this + * Recommendation.. + * + * @param displayName The display name of the assessments generated by this Recommendation. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the CustomRecommendation update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: The description to relate to the assessments generated by this + * Recommendation.. + * + * @param description The description to relate to the assessments generated by this Recommendation. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** + * The stage of the CustomRecommendation update allowing to specify remediationDescription. + */ + interface WithRemediationDescription { + /** + * Specifies the remediationDescription property: The remediation description to relate to the assessments + * generated by this Recommendation.. + * + * @param remediationDescription The remediation description to relate to the assessments generated by this + * Recommendation. + * @return the next definition stage. + */ + Update withRemediationDescription(String remediationDescription); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CustomRecommendation refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CustomRecommendation refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendations.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendations.java new file mode 100644 index 000000000000..0510ac33ccaa --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendations.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CustomRecommendations. + */ +public interface CustomRecommendations { + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String scope); + + /** + * Get a list of all relevant custom recommendations over a scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all relevant custom recommendations over a scope as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String scope, Context context); + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName along with + * {@link Response}. + */ + Response getWithResponse(String scope, String customRecommendationName, Context context); + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName. + */ + CustomRecommendation get(String scope, String customRecommendationName); + + /** + * Delete a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String scope, String customRecommendationName, Context context); + + /** + * Delete a custom recommendation over a given scope. + * + * @param scope The scope of the custom recommendation. Valid scopes are: management group (format: + * 'providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: + * 'subscriptions/{subscriptionId}'), or security connector (format: + * 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})'. + * @param customRecommendationName Name of the Custom Recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String scope, String customRecommendationName); + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName along with + * {@link Response}. + */ + CustomRecommendation getById(String id); + + /** + * Get a specific custom recommendation for the requested scope by customRecommendationName. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific custom recommendation for the requested scope by customRecommendationName along with + * {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a custom recommendation over a given scope. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a custom recommendation over a given scope. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CustomRecommendation resource. + * + * @param name resource name. + * @return the first stage of the new CustomRecommendation definition. + */ + CustomRecommendation.DefinitionStages.Blank define(String name); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendationsList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendationsList.java new file mode 100644 index 000000000000..a418a799f9a7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/CustomRecommendationsList.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.CustomRecommendationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of Custom Recommendations. + */ +@Fluent +public final class CustomRecommendationsList implements JsonSerializable { + /* + * Collection of Custom Recommendations + */ + private List value; + + /* + * The link used to get the next page of operations. + */ + private String nextLink; + + /** + * Creates an instance of CustomRecommendationsList class. + */ + public CustomRecommendationsList() { + } + + /** + * Get the value property: Collection of Custom Recommendations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link used to get the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the CustomRecommendationsList object itself. + */ + public CustomRecommendationsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomRecommendationsList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomRecommendationsList if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomRecommendationsList. + */ + public static CustomRecommendationsList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomRecommendationsList deserializedCustomRecommendationsList = new CustomRecommendationsList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CustomRecommendationInner.fromJson(reader1)); + deserializedCustomRecommendationsList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCustomRecommendationsList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomRecommendationsList; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java index b3b119b353b8..581f88351178 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cve.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * CVE details. */ @Immutable -public final class Cve { +public final class Cve implements JsonSerializable { /* * CVE title */ - @JsonProperty(value = "title", access = JsonProperty.Access.WRITE_ONLY) private String title; /* * Link url */ - @JsonProperty(value = "link", access = JsonProperty.Access.WRITE_ONLY) private String link; /** @@ -55,4 +57,41 @@ public String link() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Cve from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Cve if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Cve. + */ + public static Cve fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Cve deserializedCve = new Cve(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedCve.title = reader.getString(); + } else if ("link".equals(fieldName)) { + deserializedCve.link = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCve; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cvss.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cvss.java index 585b172d61a7..639415df6549 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cvss.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Cvss.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * CVSS details. */ @Immutable -public final class Cvss { +public final class Cvss implements JsonSerializable { /* * CVSS base */ - @JsonProperty(value = "base", access = JsonProperty.Access.WRITE_ONLY) private Float base; /** @@ -40,4 +43,39 @@ public Float base() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Cvss from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Cvss if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Cvss. + */ + public static Cvss fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Cvss deserializedCvss = new Cvss(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("base".equals(fieldName)) { + deserializedCvss.base = reader.getNullable(JsonReader::getFloat); + } else { + reader.skipChildren(); + } + } + + return deserializedCvss; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataExportSettings.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataExportSettings.java index 831f9f9c9d65..0b01a0609343 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataExportSettings.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataExportSettings.java @@ -5,33 +5,43 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.DataExportSettingProperties; import com.azure.resourcemanager.security.fluent.models.SettingInner; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.IOException; /** * Represents a data export setting. */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "kind", defaultImpl = DataExportSettings.class, visible = true) -@JsonTypeName("DataExportSettings") @Fluent public final class DataExportSettings extends SettingInner { /* * the kind of the settings string */ - @JsonTypeId - @JsonProperty(value = "kind", required = true) private SettingKind kind = SettingKind.DATA_EXPORT_SETTINGS; /* * Data export setting data */ - @JsonProperty(value = "properties") private DataExportSettingProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + /** * Creates an instance of DataExportSettings class. */ @@ -57,6 +67,36 @@ private DataExportSettingProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the enabled property: Is the data export setting enabled. * @@ -87,9 +127,54 @@ public DataExportSettings withEnabled(Boolean enabled) { */ @Override public void validate() { - super.validate(); if (innerProperties() != null) { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataExportSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataExportSettings if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DataExportSettings. + */ + public static DataExportSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataExportSettings deserializedDataExportSettings = new DataExportSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDataExportSettings.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDataExportSettings.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDataExportSettings.type = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedDataExportSettings.kind = SettingKind.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + deserializedDataExportSettings.innerProperties = DataExportSettingProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataExportSettings; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataSource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataSource.java index bb31fb4acbcb..152af77daee2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataSource.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DataSource.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public DataSource() { * @param name a name to look for. * @return the corresponding DataSource. */ - @JsonCreator public static DataSource fromString(String name) { return fromString(name, DataSource.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOffering.java index ae2b953b2390..4c8bffb3401d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOffering.java @@ -5,63 +5,49 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The CSPM P1 for AWS offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = DefenderCspmAwsOffering.class, - visible = true) -@JsonTypeName("DefenderCspmAws") @Fluent public final class DefenderCspmAwsOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.DEFENDER_CSPM_AWS; /* * The Microsoft Defender for CSPM offering VM scanning configuration */ - @JsonProperty(value = "vmScanners") private DefenderCspmAwsOfferingVmScanners vmScanners; /* * The Microsoft Defender Data Sensitivity discovery configuration */ - @JsonProperty(value = "dataSensitivityDiscovery") private DefenderCspmAwsOfferingDataSensitivityDiscovery dataSensitivityDiscovery; /* * The databases DSPM configuration */ - @JsonProperty(value = "databasesDspm") private DefenderCspmAwsOfferingDatabasesDspm databasesDspm; /* * Defenders CSPM Permissions Management offering configurations */ - @JsonProperty(value = "ciem") private DefenderCspmAwsOfferingCiem ciem; /* * The Microsoft Defender container image assessment configuration */ - @JsonProperty(value = "mdcContainersImageAssessment") private DefenderCspmAwsOfferingMdcContainersImageAssessment mdcContainersImageAssessment; /* * The Microsoft Defender container agentless discovery K8s configuration */ - @JsonProperty(value = "mdcContainersAgentlessDiscoveryK8s") private DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S; /** @@ -212,7 +198,6 @@ public DefenderCspmAwsOffering withMdcContainersAgentlessDiscoveryK8S( */ @Override public void validate() { - super.validate(); if (vmScanners() != null) { vmScanners().validate(); } @@ -232,4 +217,64 @@ public void validate() { mdcContainersAgentlessDiscoveryK8S().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("vmScanners", this.vmScanners); + jsonWriter.writeJsonField("dataSensitivityDiscovery", this.dataSensitivityDiscovery); + jsonWriter.writeJsonField("databasesDspm", this.databasesDspm); + jsonWriter.writeJsonField("ciem", this.ciem); + jsonWriter.writeJsonField("mdcContainersImageAssessment", this.mdcContainersImageAssessment); + jsonWriter.writeJsonField("mdcContainersAgentlessDiscoveryK8s", this.mdcContainersAgentlessDiscoveryK8S); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmAwsOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmAwsOffering if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmAwsOffering. + */ + public static DefenderCspmAwsOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmAwsOffering deserializedDefenderCspmAwsOffering = new DefenderCspmAwsOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderCspmAwsOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderCspmAwsOffering.offeringType = OfferingType.fromString(reader.getString()); + } else if ("vmScanners".equals(fieldName)) { + deserializedDefenderCspmAwsOffering.vmScanners = DefenderCspmAwsOfferingVmScanners.fromJson(reader); + } else if ("dataSensitivityDiscovery".equals(fieldName)) { + deserializedDefenderCspmAwsOffering.dataSensitivityDiscovery + = DefenderCspmAwsOfferingDataSensitivityDiscovery.fromJson(reader); + } else if ("databasesDspm".equals(fieldName)) { + deserializedDefenderCspmAwsOffering.databasesDspm + = DefenderCspmAwsOfferingDatabasesDspm.fromJson(reader); + } else if ("ciem".equals(fieldName)) { + deserializedDefenderCspmAwsOffering.ciem = DefenderCspmAwsOfferingCiem.fromJson(reader); + } else if ("mdcContainersImageAssessment".equals(fieldName)) { + deserializedDefenderCspmAwsOffering.mdcContainersImageAssessment + = DefenderCspmAwsOfferingMdcContainersImageAssessment.fromJson(reader); + } else if ("mdcContainersAgentlessDiscoveryK8s".equals(fieldName)) { + deserializedDefenderCspmAwsOffering.mdcContainersAgentlessDiscoveryK8S + = DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmAwsOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiem.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiem.java index 767e48037aea..cf7e53419e40 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiem.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiem.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Defenders CSPM Permissions Management offering configurations. */ @Fluent -public final class DefenderCspmAwsOfferingCiem { +public final class DefenderCspmAwsOfferingCiem implements JsonSerializable { /* * Defender CSPM Permissions Management discovery configuration */ - @JsonProperty(value = "ciemDiscovery") private DefenderCspmAwsOfferingCiemDiscovery ciemDiscovery; /* * AWS Defender CSPM Permissions Management OIDC (open id connect) connection configurations */ - @JsonProperty(value = "ciemOidc") private DefenderCspmAwsOfferingCiemOidc ciemOidc; /** @@ -85,4 +87,44 @@ public void validate() { ciemOidc().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("ciemDiscovery", this.ciemDiscovery); + jsonWriter.writeJsonField("ciemOidc", this.ciemOidc); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmAwsOfferingCiem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmAwsOfferingCiem if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmAwsOfferingCiem. + */ + public static DefenderCspmAwsOfferingCiem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmAwsOfferingCiem deserializedDefenderCspmAwsOfferingCiem = new DefenderCspmAwsOfferingCiem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ciemDiscovery".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingCiem.ciemDiscovery + = DefenderCspmAwsOfferingCiemDiscovery.fromJson(reader); + } else if ("ciemOidc".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingCiem.ciemOidc = DefenderCspmAwsOfferingCiemOidc.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmAwsOfferingCiem; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemDiscovery.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemDiscovery.java index cb6cf5d23ebf..893d3d85a2cc 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemDiscovery.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemDiscovery.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Defender CSPM Permissions Management discovery configuration. */ @Fluent -public final class DefenderCspmAwsOfferingCiemDiscovery { +public final class DefenderCspmAwsOfferingCiemDiscovery + implements JsonSerializable { /* * The cloud role ARN in AWS for Permissions Management discovery */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -51,4 +55,41 @@ public DefenderCspmAwsOfferingCiemDiscovery withCloudRoleArn(String cloudRoleArn */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmAwsOfferingCiemDiscovery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmAwsOfferingCiemDiscovery if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmAwsOfferingCiemDiscovery. + */ + public static DefenderCspmAwsOfferingCiemDiscovery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmAwsOfferingCiemDiscovery deserializedDefenderCspmAwsOfferingCiemDiscovery + = new DefenderCspmAwsOfferingCiemDiscovery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingCiemDiscovery.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmAwsOfferingCiemDiscovery; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemOidc.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemOidc.java index 5a21a17a3093..512ae4041566 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemOidc.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingCiemOidc.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * AWS Defender CSPM Permissions Management OIDC (open id connect) connection configurations. */ @Fluent -public final class DefenderCspmAwsOfferingCiemOidc { +public final class DefenderCspmAwsOfferingCiemOidc implements JsonSerializable { /* * The cloud role ARN in AWS for Permissions Management used for oidc connection */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /* * the azure active directory app name used of authenticating against AWS */ - @JsonProperty(value = "azureActiveDirectoryAppName") private String azureActiveDirectoryAppName; /** @@ -79,4 +81,44 @@ public DefenderCspmAwsOfferingCiemOidc withAzureActiveDirectoryAppName(String az */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + jsonWriter.writeStringField("azureActiveDirectoryAppName", this.azureActiveDirectoryAppName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmAwsOfferingCiemOidc from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmAwsOfferingCiemOidc if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmAwsOfferingCiemOidc. + */ + public static DefenderCspmAwsOfferingCiemOidc fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmAwsOfferingCiemOidc deserializedDefenderCspmAwsOfferingCiemOidc + = new DefenderCspmAwsOfferingCiemOidc(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingCiemOidc.cloudRoleArn = reader.getString(); + } else if ("azureActiveDirectoryAppName".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingCiemOidc.azureActiveDirectoryAppName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmAwsOfferingCiemOidc; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDataSensitivityDiscovery.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDataSensitivityDiscovery.java index 45b882cdb39c..8e5516889d63 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDataSensitivityDiscovery.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDataSensitivityDiscovery.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender Data Sensitivity discovery configuration. */ @Fluent -public final class DefenderCspmAwsOfferingDataSensitivityDiscovery { +public final class DefenderCspmAwsOfferingDataSensitivityDiscovery + implements JsonSerializable { /* * Is Microsoft Defender Data Sensitivity discovery enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -77,4 +80,45 @@ public DefenderCspmAwsOfferingDataSensitivityDiscovery withCloudRoleArn(String c */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmAwsOfferingDataSensitivityDiscovery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmAwsOfferingDataSensitivityDiscovery if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmAwsOfferingDataSensitivityDiscovery. + */ + public static DefenderCspmAwsOfferingDataSensitivityDiscovery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmAwsOfferingDataSensitivityDiscovery deserializedDefenderCspmAwsOfferingDataSensitivityDiscovery + = new DefenderCspmAwsOfferingDataSensitivityDiscovery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingDataSensitivityDiscovery.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingDataSensitivityDiscovery.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmAwsOfferingDataSensitivityDiscovery; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDatabasesDspm.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDatabasesDspm.java index c202ed2c0d92..1907f6afaae1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDatabasesDspm.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingDatabasesDspm.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The databases DSPM configuration. */ @Fluent -public final class DefenderCspmAwsOfferingDatabasesDspm { +public final class DefenderCspmAwsOfferingDatabasesDspm + implements JsonSerializable { /* * Is databases DSPM protection enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -77,4 +80,45 @@ public DefenderCspmAwsOfferingDatabasesDspm withCloudRoleArn(String cloudRoleArn */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmAwsOfferingDatabasesDspm from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmAwsOfferingDatabasesDspm if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmAwsOfferingDatabasesDspm. + */ + public static DefenderCspmAwsOfferingDatabasesDspm fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmAwsOfferingDatabasesDspm deserializedDefenderCspmAwsOfferingDatabasesDspm + = new DefenderCspmAwsOfferingDatabasesDspm(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingDatabasesDspm.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingDatabasesDspm.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmAwsOfferingDatabasesDspm; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.java index 52fc063bf334..54a95b90b3b6 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender container agentless discovery K8s configuration. */ @Fluent -public final class DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S { +public final class DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S + implements JsonSerializable { /* * Is Microsoft Defender container agentless discovery K8s enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -77,4 +80,48 @@ public DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S withCloudRoleAr */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S. + */ + public static DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S deserializedDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S + = new DefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S.cloudRoleArn + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmAwsOfferingMdcContainersAgentlessDiscoveryK8S; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersImageAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersImageAssessment.java index cfa11595913f..3c34b05f5075 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersImageAssessment.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingMdcContainersImageAssessment.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender container image assessment configuration. */ @Fluent -public final class DefenderCspmAwsOfferingMdcContainersImageAssessment { +public final class DefenderCspmAwsOfferingMdcContainersImageAssessment + implements JsonSerializable { /* * Is Microsoft Defender container image assessment enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -77,4 +80,46 @@ public DefenderCspmAwsOfferingMdcContainersImageAssessment withCloudRoleArn(Stri */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmAwsOfferingMdcContainersImageAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmAwsOfferingMdcContainersImageAssessment if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmAwsOfferingMdcContainersImageAssessment. + */ + public static DefenderCspmAwsOfferingMdcContainersImageAssessment fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmAwsOfferingMdcContainersImageAssessment deserializedDefenderCspmAwsOfferingMdcContainersImageAssessment + = new DefenderCspmAwsOfferingMdcContainersImageAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingMdcContainersImageAssessment.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingMdcContainersImageAssessment.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmAwsOfferingMdcContainersImageAssessment; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingVmScanners.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingVmScanners.java index 73c5432df364..25ff31ea103a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingVmScanners.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmAwsOfferingVmScanners.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender for CSPM offering VM scanning configuration. @@ -51,6 +55,53 @@ public DefenderCspmAwsOfferingVmScanners withConfiguration(VmScannersBaseConfigu */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + jsonWriter.writeStringField("cloudRoleArn", cloudRoleArn()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmAwsOfferingVmScanners from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmAwsOfferingVmScanners if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmAwsOfferingVmScanners. + */ + public static DefenderCspmAwsOfferingVmScanners fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmAwsOfferingVmScanners deserializedDefenderCspmAwsOfferingVmScanners + = new DefenderCspmAwsOfferingVmScanners(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingVmScanners + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingVmScanners + .withConfiguration(VmScannersBaseConfiguration.fromJson(reader)); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderCspmAwsOfferingVmScanners.withCloudRoleArn(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmAwsOfferingVmScanners; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmDockerHubOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmDockerHubOffering.java new file mode 100644 index 000000000000..e4ee07897e28 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmDockerHubOffering.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Defender for CSPM Docker Hub offering configurations. + */ +@Immutable +public final class DefenderCspmDockerHubOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_CSPM_DOCKER_HUB; + + /** + * Creates an instance of DefenderCspmDockerHubOffering class. + */ + public DefenderCspmDockerHubOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmDockerHubOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmDockerHubOffering if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmDockerHubOffering. + */ + public static DefenderCspmDockerHubOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmDockerHubOffering deserializedDefenderCspmDockerHubOffering + = new DefenderCspmDockerHubOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderCspmDockerHubOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderCspmDockerHubOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmDockerHubOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOffering.java index d3019848ef5d..3323a65e9d2a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOffering.java @@ -5,57 +5,44 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The CSPM P1 for GCP offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = DefenderCspmGcpOffering.class, - visible = true) -@JsonTypeName("DefenderCspmGcp") @Fluent public final class DefenderCspmGcpOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.DEFENDER_CSPM_GCP; /* * GCP Defenders CSPM Permissions Management OIDC (Open ID connect) connection configurations */ - @JsonProperty(value = "ciemDiscovery") private DefenderCspmGcpOfferingCiemDiscovery ciemDiscovery; /* * The Microsoft Defender for CSPM VM scanning configuration */ - @JsonProperty(value = "vmScanners") private DefenderCspmGcpOfferingVmScanners vmScanners; /* * The Microsoft Defender Data Sensitivity discovery configuration */ - @JsonProperty(value = "dataSensitivityDiscovery") private DefenderCspmGcpOfferingDataSensitivityDiscovery dataSensitivityDiscovery; /* * The Microsoft Defender Container image assessment configuration */ - @JsonProperty(value = "mdcContainersImageAssessment") private DefenderCspmGcpOfferingMdcContainersImageAssessment mdcContainersImageAssessment; /* * The Microsoft Defender Container agentless discovery configuration */ - @JsonProperty(value = "mdcContainersAgentlessDiscoveryK8s") private DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S; /** @@ -188,7 +175,6 @@ public DefenderCspmGcpOffering withMdcContainersAgentlessDiscoveryK8S( */ @Override public void validate() { - super.validate(); if (ciemDiscovery() != null) { ciemDiscovery().validate(); } @@ -205,4 +191,61 @@ public void validate() { mdcContainersAgentlessDiscoveryK8S().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("ciemDiscovery", this.ciemDiscovery); + jsonWriter.writeJsonField("vmScanners", this.vmScanners); + jsonWriter.writeJsonField("dataSensitivityDiscovery", this.dataSensitivityDiscovery); + jsonWriter.writeJsonField("mdcContainersImageAssessment", this.mdcContainersImageAssessment); + jsonWriter.writeJsonField("mdcContainersAgentlessDiscoveryK8s", this.mdcContainersAgentlessDiscoveryK8S); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmGcpOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmGcpOffering if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmGcpOffering. + */ + public static DefenderCspmGcpOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmGcpOffering deserializedDefenderCspmGcpOffering = new DefenderCspmGcpOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderCspmGcpOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderCspmGcpOffering.offeringType = OfferingType.fromString(reader.getString()); + } else if ("ciemDiscovery".equals(fieldName)) { + deserializedDefenderCspmGcpOffering.ciemDiscovery + = DefenderCspmGcpOfferingCiemDiscovery.fromJson(reader); + } else if ("vmScanners".equals(fieldName)) { + deserializedDefenderCspmGcpOffering.vmScanners = DefenderCspmGcpOfferingVmScanners.fromJson(reader); + } else if ("dataSensitivityDiscovery".equals(fieldName)) { + deserializedDefenderCspmGcpOffering.dataSensitivityDiscovery + = DefenderCspmGcpOfferingDataSensitivityDiscovery.fromJson(reader); + } else if ("mdcContainersImageAssessment".equals(fieldName)) { + deserializedDefenderCspmGcpOffering.mdcContainersImageAssessment + = DefenderCspmGcpOfferingMdcContainersImageAssessment.fromJson(reader); + } else if ("mdcContainersAgentlessDiscoveryK8s".equals(fieldName)) { + deserializedDefenderCspmGcpOffering.mdcContainersAgentlessDiscoveryK8S + = DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmGcpOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingCiemDiscovery.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingCiemDiscovery.java index beb5015038a3..1d97928b6a8c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingCiemDiscovery.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingCiemDiscovery.java @@ -5,29 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * GCP Defenders CSPM Permissions Management OIDC (Open ID connect) connection configurations. */ @Fluent -public final class DefenderCspmGcpOfferingCiemDiscovery { +public final class DefenderCspmGcpOfferingCiemDiscovery + implements JsonSerializable { /* * The GCP workload identity provider id for Permissions Management offering */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /* * The service account email address in GCP for Permissions Management offering */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /* * the azure active directory app name used of authenticating against GCP workload identity federation */ - @JsonProperty(value = "azureActiveDirectoryAppName") private String azureActiveDirectoryAppName; /** @@ -109,4 +111,47 @@ public DefenderCspmGcpOfferingCiemDiscovery withAzureActiveDirectoryAppName(Stri */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + jsonWriter.writeStringField("azureActiveDirectoryAppName", this.azureActiveDirectoryAppName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmGcpOfferingCiemDiscovery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmGcpOfferingCiemDiscovery if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmGcpOfferingCiemDiscovery. + */ + public static DefenderCspmGcpOfferingCiemDiscovery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmGcpOfferingCiemDiscovery deserializedDefenderCspmGcpOfferingCiemDiscovery + = new DefenderCspmGcpOfferingCiemDiscovery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingCiemDiscovery.workloadIdentityProviderId = reader.getString(); + } else if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingCiemDiscovery.serviceAccountEmailAddress = reader.getString(); + } else if ("azureActiveDirectoryAppName".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingCiemDiscovery.azureActiveDirectoryAppName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmGcpOfferingCiemDiscovery; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingDataSensitivityDiscovery.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingDataSensitivityDiscovery.java index 36e63584ae6e..6555c0d9cd4c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingDataSensitivityDiscovery.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingDataSensitivityDiscovery.java @@ -5,29 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender Data Sensitivity discovery configuration. */ @Fluent -public final class DefenderCspmGcpOfferingDataSensitivityDiscovery { +public final class DefenderCspmGcpOfferingDataSensitivityDiscovery + implements JsonSerializable { /* * Is Microsoft Defender Data Sensitivity discovery enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The workload identity provider id in GCP for this feature */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /* * The service account email address in GCP for this feature */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /** @@ -105,4 +107,50 @@ public String serviceAccountEmailAddress() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmGcpOfferingDataSensitivityDiscovery from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmGcpOfferingDataSensitivityDiscovery if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmGcpOfferingDataSensitivityDiscovery. + */ + public static DefenderCspmGcpOfferingDataSensitivityDiscovery fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmGcpOfferingDataSensitivityDiscovery deserializedDefenderCspmGcpOfferingDataSensitivityDiscovery + = new DefenderCspmGcpOfferingDataSensitivityDiscovery(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingDataSensitivityDiscovery.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingDataSensitivityDiscovery.workloadIdentityProviderId + = reader.getString(); + } else if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingDataSensitivityDiscovery.serviceAccountEmailAddress + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmGcpOfferingDataSensitivityDiscovery; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.java index 1fbebc581a31..fe9e84390c43 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.java @@ -5,29 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender Container agentless discovery configuration. */ @Fluent -public final class DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S { +public final class DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S + implements JsonSerializable { /* * Is Microsoft Defender container agentless discovery enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The workload identity provider id in GCP for this feature */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /* * The service account email address in GCP for this feature */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /** @@ -105,4 +107,52 @@ public String serviceAccountEmailAddress() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S if the JsonReader was pointing + * to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S. + */ + public static DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S deserializedDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S + = new DefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.workloadIdentityProviderId + = reader.getString(); + } else if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S.serviceAccountEmailAddress + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmGcpOfferingMdcContainersAgentlessDiscoveryK8S; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersImageAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersImageAssessment.java index 27967d58164d..358eb39260e5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersImageAssessment.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingMdcContainersImageAssessment.java @@ -5,29 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender Container image assessment configuration. */ @Fluent -public final class DefenderCspmGcpOfferingMdcContainersImageAssessment { +public final class DefenderCspmGcpOfferingMdcContainersImageAssessment + implements JsonSerializable { /* * Is Microsoft Defender container image assessment enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The workload identity provider id in GCP for this feature */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /* * The service account email address in GCP for this feature */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /** @@ -105,4 +107,51 @@ public String serviceAccountEmailAddress() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmGcpOfferingMdcContainersImageAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmGcpOfferingMdcContainersImageAssessment if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmGcpOfferingMdcContainersImageAssessment. + */ + public static DefenderCspmGcpOfferingMdcContainersImageAssessment fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmGcpOfferingMdcContainersImageAssessment deserializedDefenderCspmGcpOfferingMdcContainersImageAssessment + = new DefenderCspmGcpOfferingMdcContainersImageAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingMdcContainersImageAssessment.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingMdcContainersImageAssessment.workloadIdentityProviderId + = reader.getString(); + } else if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingMdcContainersImageAssessment.serviceAccountEmailAddress + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmGcpOfferingMdcContainersImageAssessment; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingVmScanners.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingVmScanners.java index b5c44cf2677f..4edfbaa4f1d7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingVmScanners.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmGcpOfferingVmScanners.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender for CSPM VM scanning configuration. @@ -42,6 +46,50 @@ public DefenderCspmGcpOfferingVmScanners withConfiguration(VmScannersBaseConfigu */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmGcpOfferingVmScanners from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmGcpOfferingVmScanners if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmGcpOfferingVmScanners. + */ + public static DefenderCspmGcpOfferingVmScanners fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmGcpOfferingVmScanners deserializedDefenderCspmGcpOfferingVmScanners + = new DefenderCspmGcpOfferingVmScanners(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingVmScanners + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderCspmGcpOfferingVmScanners + .withConfiguration(VmScannersBaseConfiguration.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmGcpOfferingVmScanners; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOffering.java new file mode 100644 index 000000000000..2a7cf3f0b554 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOffering.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CSPM P1 for JFrog Artifactory offering. + */ +@Fluent +public final class DefenderCspmJFrogOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_CSPM_JFROG; + + /* + * The Microsoft Defender Container image assessment configuration + */ + private DefenderCspmJFrogOfferingMdcContainersImageAssessment mdcContainersImageAssessment; + + /** + * Creates an instance of DefenderCspmJFrogOffering class. + */ + public DefenderCspmJFrogOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Get the mdcContainersImageAssessment property: The Microsoft Defender Container image assessment configuration. + * + * @return the mdcContainersImageAssessment value. + */ + public DefenderCspmJFrogOfferingMdcContainersImageAssessment mdcContainersImageAssessment() { + return this.mdcContainersImageAssessment; + } + + /** + * Set the mdcContainersImageAssessment property: The Microsoft Defender Container image assessment configuration. + * + * @param mdcContainersImageAssessment the mdcContainersImageAssessment value to set. + * @return the DefenderCspmJFrogOffering object itself. + */ + public DefenderCspmJFrogOffering withMdcContainersImageAssessment( + DefenderCspmJFrogOfferingMdcContainersImageAssessment mdcContainersImageAssessment) { + this.mdcContainersImageAssessment = mdcContainersImageAssessment; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (mdcContainersImageAssessment() != null) { + mdcContainersImageAssessment().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("mdcContainersImageAssessment", this.mdcContainersImageAssessment); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmJFrogOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmJFrogOffering if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmJFrogOffering. + */ + public static DefenderCspmJFrogOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmJFrogOffering deserializedDefenderCspmJFrogOffering = new DefenderCspmJFrogOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderCspmJFrogOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderCspmJFrogOffering.offeringType = OfferingType.fromString(reader.getString()); + } else if ("mdcContainersImageAssessment".equals(fieldName)) { + deserializedDefenderCspmJFrogOffering.mdcContainersImageAssessment + = DefenderCspmJFrogOfferingMdcContainersImageAssessment.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmJFrogOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOfferingMdcContainersImageAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOfferingMdcContainersImageAssessment.java new file mode 100644 index 000000000000..fe3bc4d83a11 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderCspmJFrogOfferingMdcContainersImageAssessment.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Microsoft Defender Container image assessment configuration. + */ +@Fluent +public final class DefenderCspmJFrogOfferingMdcContainersImageAssessment + implements JsonSerializable { + /* + * Is Microsoft Defender container image assessment enabled + */ + private Boolean enabled; + + /** + * Creates an instance of DefenderCspmJFrogOfferingMdcContainersImageAssessment class. + */ + public DefenderCspmJFrogOfferingMdcContainersImageAssessment() { + } + + /** + * Get the enabled property: Is Microsoft Defender container image assessment enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is Microsoft Defender container image assessment enabled. + * + * @param enabled the enabled value to set. + * @return the DefenderCspmJFrogOfferingMdcContainersImageAssessment object itself. + */ + public DefenderCspmJFrogOfferingMdcContainersImageAssessment withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderCspmJFrogOfferingMdcContainersImageAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderCspmJFrogOfferingMdcContainersImageAssessment if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderCspmJFrogOfferingMdcContainersImageAssessment. + */ + public static DefenderCspmJFrogOfferingMdcContainersImageAssessment fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderCspmJFrogOfferingMdcContainersImageAssessment deserializedDefenderCspmJFrogOfferingMdcContainersImageAssessment + = new DefenderCspmJFrogOfferingMdcContainersImageAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderCspmJFrogOfferingMdcContainersImageAssessment.enabled + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderCspmJFrogOfferingMdcContainersImageAssessment; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOffering.java index c007a247e89d..757d83ad985a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOffering.java @@ -5,45 +5,34 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Defender for Databases AWS offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = DefenderFoDatabasesAwsOffering.class, - visible = true) -@JsonTypeName("DefenderForDatabasesAws") @Fluent public final class DefenderFoDatabasesAwsOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.DEFENDER_FOR_DATABASES_AWS; /* * The ARC autoprovisioning configuration */ - @JsonProperty(value = "arcAutoProvisioning") private DefenderFoDatabasesAwsOfferingArcAutoProvisioning arcAutoProvisioning; /* * The RDS configuration */ - @JsonProperty(value = "rds") private DefenderFoDatabasesAwsOfferingRds rds; /* * The databases data security posture management (DSPM) configuration */ - @JsonProperty(value = "databasesDspm") private DefenderFoDatabasesAwsOfferingDatabasesDspm databasesDspm; /** @@ -130,7 +119,6 @@ public DefenderFoDatabasesAwsOffering withDatabasesDspm(DefenderFoDatabasesAwsOf */ @Override public void validate() { - super.validate(); if (arcAutoProvisioning() != null) { arcAutoProvisioning().validate(); } @@ -141,4 +129,55 @@ public void validate() { databasesDspm().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("arcAutoProvisioning", this.arcAutoProvisioning); + jsonWriter.writeJsonField("rds", this.rds); + jsonWriter.writeJsonField("databasesDspm", this.databasesDspm); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderFoDatabasesAwsOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderFoDatabasesAwsOffering if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderFoDatabasesAwsOffering. + */ + public static DefenderFoDatabasesAwsOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderFoDatabasesAwsOffering deserializedDefenderFoDatabasesAwsOffering + = new DefenderFoDatabasesAwsOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else if ("arcAutoProvisioning".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOffering.arcAutoProvisioning + = DefenderFoDatabasesAwsOfferingArcAutoProvisioning.fromJson(reader); + } else if ("rds".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOffering.rds = DefenderFoDatabasesAwsOfferingRds.fromJson(reader); + } else if ("databasesDspm".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOffering.databasesDspm + = DefenderFoDatabasesAwsOfferingDatabasesDspm.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderFoDatabasesAwsOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.java index b81563c964fc..25438c8ebd0b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingArcAutoProvisioning.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The ARC autoprovisioning configuration. @@ -52,6 +56,53 @@ public DefenderFoDatabasesAwsOfferingArcAutoProvisioning withEnabled(Boolean ena */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + jsonWriter.writeStringField("cloudRoleArn", cloudRoleArn()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderFoDatabasesAwsOfferingArcAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderFoDatabasesAwsOfferingArcAutoProvisioning if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderFoDatabasesAwsOfferingArcAutoProvisioning. + */ + public static DefenderFoDatabasesAwsOfferingArcAutoProvisioning fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderFoDatabasesAwsOfferingArcAutoProvisioning deserializedDefenderFoDatabasesAwsOfferingArcAutoProvisioning + = new DefenderFoDatabasesAwsOfferingArcAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOfferingArcAutoProvisioning + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOfferingArcAutoProvisioning + .withConfiguration(ArcAutoProvisioningConfiguration.fromJson(reader)); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOfferingArcAutoProvisioning.withCloudRoleArn(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderFoDatabasesAwsOfferingArcAutoProvisioning; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingDatabasesDspm.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingDatabasesDspm.java index e6fe9024911e..721674780381 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingDatabasesDspm.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingDatabasesDspm.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The databases data security posture management (DSPM) configuration. */ @Fluent -public final class DefenderFoDatabasesAwsOfferingDatabasesDspm { +public final class DefenderFoDatabasesAwsOfferingDatabasesDspm + implements JsonSerializable { /* * Is databases data security posture management (DSPM) protection enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -77,4 +80,45 @@ public DefenderFoDatabasesAwsOfferingDatabasesDspm withCloudRoleArn(String cloud */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderFoDatabasesAwsOfferingDatabasesDspm from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderFoDatabasesAwsOfferingDatabasesDspm if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderFoDatabasesAwsOfferingDatabasesDspm. + */ + public static DefenderFoDatabasesAwsOfferingDatabasesDspm fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderFoDatabasesAwsOfferingDatabasesDspm deserializedDefenderFoDatabasesAwsOfferingDatabasesDspm + = new DefenderFoDatabasesAwsOfferingDatabasesDspm(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOfferingDatabasesDspm.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOfferingDatabasesDspm.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderFoDatabasesAwsOfferingDatabasesDspm; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingRds.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingRds.java index ac0c430af824..15acc97c0b77 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingRds.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderFoDatabasesAwsOfferingRds.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The RDS configuration. */ @Fluent -public final class DefenderFoDatabasesAwsOfferingRds { +public final class DefenderFoDatabasesAwsOfferingRds implements JsonSerializable { /* * Is RDS protection enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -77,4 +79,44 @@ public DefenderFoDatabasesAwsOfferingRds withCloudRoleArn(String cloudRoleArn) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderFoDatabasesAwsOfferingRds from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderFoDatabasesAwsOfferingRds if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderFoDatabasesAwsOfferingRds. + */ + public static DefenderFoDatabasesAwsOfferingRds fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderFoDatabasesAwsOfferingRds deserializedDefenderFoDatabasesAwsOfferingRds + = new DefenderFoDatabasesAwsOfferingRds(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOfferingRds.enabled = reader.getNullable(JsonReader::getBoolean); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderFoDatabasesAwsOfferingRds.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderFoDatabasesAwsOfferingRds; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOffering.java index 465ea5872d65..f6da1eed5787 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOffering.java @@ -5,99 +5,79 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Defender for Containers AWS offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = DefenderForContainersAwsOffering.class, - visible = true) -@JsonTypeName("DefenderForContainersAws") @Fluent public final class DefenderForContainersAwsOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.DEFENDER_FOR_CONTAINERS_AWS; /* * The kubernetes service connection configuration */ - @JsonProperty(value = "kubernetesService") private DefenderForContainersAwsOfferingKubernetesService kubernetesService; /* * The kubernetes data collection connection configuration */ - @JsonProperty(value = "kubernetesDataCollection") private DefenderForContainersAwsOfferingKubernetesDataCollection kubernetesDataCollection; /* * The cloudwatch to kinesis connection configuration */ - @JsonProperty(value = "cloudWatchToKinesis") private DefenderForContainersAwsOfferingCloudWatchToKinesis cloudWatchToKinesis; /* * The kinesis to s3 connection configuration */ - @JsonProperty(value = "kinesisToS3") private DefenderForContainersAwsOfferingKinesisToS3 kinesisToS3; /* * Is audit logs data collection enabled */ - @JsonProperty(value = "enableAuditLogsAutoProvisioning") private Boolean enableAuditLogsAutoProvisioning; /* * Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled */ - @JsonProperty(value = "enableDefenderAgentAutoProvisioning") private Boolean enableDefenderAgentAutoProvisioning; /* * Is Policy Kubernetes agent auto provisioning enabled */ - @JsonProperty(value = "enablePolicyAgentAutoProvisioning") private Boolean enablePolicyAgentAutoProvisioning; /* * The retention time in days of kube audit logs set on the CloudWatch log group */ - @JsonProperty(value = "kubeAuditRetentionTime") private Long kubeAuditRetentionTime; /* * The externalId used by the data reader to prevent the confused deputy attack */ - @JsonProperty(value = "dataCollectionExternalId") private String dataCollectionExternalId; /* * The Microsoft Defender container image assessment configuration */ - @JsonProperty(value = "mdcContainersImageAssessment") private DefenderForContainersAwsOfferingMdcContainersImageAssessment mdcContainersImageAssessment; /* * The Microsoft Defender container agentless discovery K8s configuration */ - @JsonProperty(value = "mdcContainersAgentlessDiscoveryK8s") private DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S; /* * The Microsoft Defender for Container K8s VM host scanning configuration */ - @JsonProperty(value = "vmScanners") private DefenderForContainersAwsOfferingVmScanners vmScanners; /** @@ -379,7 +359,6 @@ public DefenderForContainersAwsOffering withVmScanners(DefenderForContainersAwsO */ @Override public void validate() { - super.validate(); if (kubernetesService() != null) { kubernetesService().validate(); } @@ -402,4 +381,91 @@ public void validate() { vmScanners().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("kubernetesService", this.kubernetesService); + jsonWriter.writeJsonField("kubernetesDataCollection", this.kubernetesDataCollection); + jsonWriter.writeJsonField("cloudWatchToKinesis", this.cloudWatchToKinesis); + jsonWriter.writeJsonField("kinesisToS3", this.kinesisToS3); + jsonWriter.writeBooleanField("enableAuditLogsAutoProvisioning", this.enableAuditLogsAutoProvisioning); + jsonWriter.writeBooleanField("enableDefenderAgentAutoProvisioning", this.enableDefenderAgentAutoProvisioning); + jsonWriter.writeBooleanField("enablePolicyAgentAutoProvisioning", this.enablePolicyAgentAutoProvisioning); + jsonWriter.writeNumberField("kubeAuditRetentionTime", this.kubeAuditRetentionTime); + jsonWriter.writeStringField("dataCollectionExternalId", this.dataCollectionExternalId); + jsonWriter.writeJsonField("mdcContainersImageAssessment", this.mdcContainersImageAssessment); + jsonWriter.writeJsonField("mdcContainersAgentlessDiscoveryK8s", this.mdcContainersAgentlessDiscoveryK8S); + jsonWriter.writeJsonField("vmScanners", this.vmScanners); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersAwsOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersAwsOffering if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersAwsOffering. + */ + public static DefenderForContainersAwsOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersAwsOffering deserializedDefenderForContainersAwsOffering + = new DefenderForContainersAwsOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else if ("kubernetesService".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.kubernetesService + = DefenderForContainersAwsOfferingKubernetesService.fromJson(reader); + } else if ("kubernetesDataCollection".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.kubernetesDataCollection + = DefenderForContainersAwsOfferingKubernetesDataCollection.fromJson(reader); + } else if ("cloudWatchToKinesis".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.cloudWatchToKinesis + = DefenderForContainersAwsOfferingCloudWatchToKinesis.fromJson(reader); + } else if ("kinesisToS3".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.kinesisToS3 + = DefenderForContainersAwsOfferingKinesisToS3.fromJson(reader); + } else if ("enableAuditLogsAutoProvisioning".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.enableAuditLogsAutoProvisioning + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableDefenderAgentAutoProvisioning".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.enableDefenderAgentAutoProvisioning + = reader.getNullable(JsonReader::getBoolean); + } else if ("enablePolicyAgentAutoProvisioning".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.enablePolicyAgentAutoProvisioning + = reader.getNullable(JsonReader::getBoolean); + } else if ("kubeAuditRetentionTime".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.kubeAuditRetentionTime + = reader.getNullable(JsonReader::getLong); + } else if ("dataCollectionExternalId".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.dataCollectionExternalId = reader.getString(); + } else if ("mdcContainersImageAssessment".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.mdcContainersImageAssessment + = DefenderForContainersAwsOfferingMdcContainersImageAssessment.fromJson(reader); + } else if ("mdcContainersAgentlessDiscoveryK8s".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.mdcContainersAgentlessDiscoveryK8S + = DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.fromJson(reader); + } else if ("vmScanners".equals(fieldName)) { + deserializedDefenderForContainersAwsOffering.vmScanners + = DefenderForContainersAwsOfferingVmScanners.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersAwsOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingCloudWatchToKinesis.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingCloudWatchToKinesis.java index 59df0dad19dc..79bc50324bd9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingCloudWatchToKinesis.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingCloudWatchToKinesis.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The cloudwatch to kinesis connection configuration. */ @Fluent -public final class DefenderForContainersAwsOfferingCloudWatchToKinesis { +public final class DefenderForContainersAwsOfferingCloudWatchToKinesis + implements JsonSerializable { /* * The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -51,4 +55,42 @@ public DefenderForContainersAwsOfferingCloudWatchToKinesis withCloudRoleArn(Stri */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersAwsOfferingCloudWatchToKinesis from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersAwsOfferingCloudWatchToKinesis if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersAwsOfferingCloudWatchToKinesis. + */ + public static DefenderForContainersAwsOfferingCloudWatchToKinesis fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersAwsOfferingCloudWatchToKinesis deserializedDefenderForContainersAwsOfferingCloudWatchToKinesis + = new DefenderForContainersAwsOfferingCloudWatchToKinesis(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingCloudWatchToKinesis.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersAwsOfferingCloudWatchToKinesis; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKinesisToS3.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKinesisToS3.java index 23ab2b9a459d..2922e5aa3dc1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKinesisToS3.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKinesisToS3.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The kinesis to s3 connection configuration. */ @Fluent -public final class DefenderForContainersAwsOfferingKinesisToS3 { +public final class DefenderForContainersAwsOfferingKinesisToS3 + implements JsonSerializable { /* * The cloud role ARN in AWS used by Kinesis to transfer data into S3 */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -51,4 +55,41 @@ public DefenderForContainersAwsOfferingKinesisToS3 withCloudRoleArn(String cloud */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersAwsOfferingKinesisToS3 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersAwsOfferingKinesisToS3 if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersAwsOfferingKinesisToS3. + */ + public static DefenderForContainersAwsOfferingKinesisToS3 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersAwsOfferingKinesisToS3 deserializedDefenderForContainersAwsOfferingKinesisToS3 + = new DefenderForContainersAwsOfferingKinesisToS3(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingKinesisToS3.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersAwsOfferingKinesisToS3; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesDataCollection.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesDataCollection.java index 8f7f5da8b7be..29c675ab9cbe 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesDataCollection.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesDataCollection.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The kubernetes data collection connection configuration. */ @Fluent -public final class DefenderForContainersAwsOfferingKubernetesDataCollection { +public final class DefenderForContainersAwsOfferingKubernetesDataCollection + implements JsonSerializable { /* * The cloud role ARN in AWS for this feature used for reading data */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -51,4 +55,44 @@ public DefenderForContainersAwsOfferingKubernetesDataCollection withCloudRoleArn */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersAwsOfferingKubernetesDataCollection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersAwsOfferingKubernetesDataCollection if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderForContainersAwsOfferingKubernetesDataCollection. + */ + public static DefenderForContainersAwsOfferingKubernetesDataCollection fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersAwsOfferingKubernetesDataCollection deserializedDefenderForContainersAwsOfferingKubernetesDataCollection + = new DefenderForContainersAwsOfferingKubernetesDataCollection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingKubernetesDataCollection.cloudRoleArn + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersAwsOfferingKubernetesDataCollection; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesService.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesService.java index 3639cd51c263..75c5df18ba6d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesService.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingKubernetesService.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The kubernetes service connection configuration. */ @Fluent -public final class DefenderForContainersAwsOfferingKubernetesService { +public final class DefenderForContainersAwsOfferingKubernetesService + implements JsonSerializable { /* * The cloud role ARN in AWS for this feature used for provisioning resources */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -51,4 +55,41 @@ public DefenderForContainersAwsOfferingKubernetesService withCloudRoleArn(String */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersAwsOfferingKubernetesService from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersAwsOfferingKubernetesService if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersAwsOfferingKubernetesService. + */ + public static DefenderForContainersAwsOfferingKubernetesService fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersAwsOfferingKubernetesService deserializedDefenderForContainersAwsOfferingKubernetesService + = new DefenderForContainersAwsOfferingKubernetesService(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingKubernetesService.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersAwsOfferingKubernetesService; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.java index e442242e6ea0..b7b825de699f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender container agentless discovery K8s configuration. */ @Fluent -public final class DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S { +public final class DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S + implements JsonSerializable { /* * Is Microsoft Defender container agentless discovery K8s enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -77,4 +80,48 @@ public DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S withCl */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S. + */ + public static DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S deserializedDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S + = new DefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S.cloudRoleArn + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersAwsOfferingMdcContainersAgentlessDiscoveryK8S; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.java index f1206de4ecf1..09a69addc3fe 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingMdcContainersImageAssessment.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender container image assessment configuration. */ @Fluent -public final class DefenderForContainersAwsOfferingMdcContainersImageAssessment { +public final class DefenderForContainersAwsOfferingMdcContainersImageAssessment + implements JsonSerializable { /* * Is Microsoft Defender container image assessment enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -77,4 +80,48 @@ public DefenderForContainersAwsOfferingMdcContainersImageAssessment withCloudRol */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersAwsOfferingMdcContainersImageAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersAwsOfferingMdcContainersImageAssessment if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderForContainersAwsOfferingMdcContainersImageAssessment. + */ + public static DefenderForContainersAwsOfferingMdcContainersImageAssessment fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersAwsOfferingMdcContainersImageAssessment deserializedDefenderForContainersAwsOfferingMdcContainersImageAssessment + = new DefenderForContainersAwsOfferingMdcContainersImageAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingMdcContainersImageAssessment.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingMdcContainersImageAssessment.cloudRoleArn + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersAwsOfferingMdcContainersImageAssessment; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingVmScanners.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingVmScanners.java index 80f8783fadc0..bf1e036f28cb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingVmScanners.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersAwsOfferingVmScanners.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender for Container K8s VM host scanning configuration. @@ -51,6 +55,53 @@ public DefenderForContainersAwsOfferingVmScanners withConfiguration(VmScannersBa */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + jsonWriter.writeStringField("cloudRoleArn", cloudRoleArn()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersAwsOfferingVmScanners from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersAwsOfferingVmScanners if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersAwsOfferingVmScanners. + */ + public static DefenderForContainersAwsOfferingVmScanners fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersAwsOfferingVmScanners deserializedDefenderForContainersAwsOfferingVmScanners + = new DefenderForContainersAwsOfferingVmScanners(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingVmScanners + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingVmScanners + .withConfiguration(VmScannersBaseConfiguration.fromJson(reader)); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForContainersAwsOfferingVmScanners.withCloudRoleArn(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersAwsOfferingVmScanners; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersDockerHubOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersDockerHubOffering.java new file mode 100644 index 000000000000..2d9d2d111163 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersDockerHubOffering.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Defender for containers Docker Hub offering configurations. + */ +@Immutable +public final class DefenderForContainersDockerHubOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_CONTAINERS_DOCKER_HUB; + + /** + * Creates an instance of DefenderForContainersDockerHubOffering class. + */ + public DefenderForContainersDockerHubOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersDockerHubOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersDockerHubOffering if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersDockerHubOffering. + */ + public static DefenderForContainersDockerHubOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersDockerHubOffering deserializedDefenderForContainersDockerHubOffering + = new DefenderForContainersDockerHubOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderForContainersDockerHubOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderForContainersDockerHubOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersDockerHubOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOffering.java index a65814f97bfb..c055f7a2433f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOffering.java @@ -5,75 +5,59 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The containers GCP offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = DefenderForContainersGcpOffering.class, - visible = true) -@JsonTypeName("DefenderForContainersGcp") @Fluent public final class DefenderForContainersGcpOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.DEFENDER_FOR_CONTAINERS_GCP; /* * The native cloud connection configuration */ - @JsonProperty(value = "nativeCloudConnection") private DefenderForContainersGcpOfferingNativeCloudConnection nativeCloudConnection; /* * The native cloud connection configuration */ - @JsonProperty(value = "dataPipelineNativeCloudConnection") private DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection dataPipelineNativeCloudConnection; /* * Is audit logs data collection enabled */ - @JsonProperty(value = "enableAuditLogsAutoProvisioning") private Boolean enableAuditLogsAutoProvisioning; /* * Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled */ - @JsonProperty(value = "enableDefenderAgentAutoProvisioning") private Boolean enableDefenderAgentAutoProvisioning; /* * Is Policy Kubernetes agent auto provisioning enabled */ - @JsonProperty(value = "enablePolicyAgentAutoProvisioning") private Boolean enablePolicyAgentAutoProvisioning; /* * The Microsoft Defender Container image assessment configuration */ - @JsonProperty(value = "mdcContainersImageAssessment") private DefenderForContainersGcpOfferingMdcContainersImageAssessment mdcContainersImageAssessment; /* * The Microsoft Defender Container agentless discovery configuration */ - @JsonProperty(value = "mdcContainersAgentlessDiscoveryK8s") private DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S mdcContainersAgentlessDiscoveryK8S; /* * The Microsoft Defender for Container K8s VM host scanning configuration */ - @JsonProperty(value = "vmScanners") private DefenderForContainersGcpOfferingVmScanners vmScanners; /** @@ -270,7 +254,6 @@ public DefenderForContainersGcpOffering withVmScanners(DefenderForContainersGcpO */ @Override public void validate() { - super.validate(); if (nativeCloudConnection() != null) { nativeCloudConnection().validate(); } @@ -287,4 +270,76 @@ public void validate() { vmScanners().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("nativeCloudConnection", this.nativeCloudConnection); + jsonWriter.writeJsonField("dataPipelineNativeCloudConnection", this.dataPipelineNativeCloudConnection); + jsonWriter.writeBooleanField("enableAuditLogsAutoProvisioning", this.enableAuditLogsAutoProvisioning); + jsonWriter.writeBooleanField("enableDefenderAgentAutoProvisioning", this.enableDefenderAgentAutoProvisioning); + jsonWriter.writeBooleanField("enablePolicyAgentAutoProvisioning", this.enablePolicyAgentAutoProvisioning); + jsonWriter.writeJsonField("mdcContainersImageAssessment", this.mdcContainersImageAssessment); + jsonWriter.writeJsonField("mdcContainersAgentlessDiscoveryK8s", this.mdcContainersAgentlessDiscoveryK8S); + jsonWriter.writeJsonField("vmScanners", this.vmScanners); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersGcpOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersGcpOffering if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersGcpOffering. + */ + public static DefenderForContainersGcpOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersGcpOffering deserializedDefenderForContainersGcpOffering + = new DefenderForContainersGcpOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else if ("nativeCloudConnection".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.nativeCloudConnection + = DefenderForContainersGcpOfferingNativeCloudConnection.fromJson(reader); + } else if ("dataPipelineNativeCloudConnection".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.dataPipelineNativeCloudConnection + = DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.fromJson(reader); + } else if ("enableAuditLogsAutoProvisioning".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.enableAuditLogsAutoProvisioning + = reader.getNullable(JsonReader::getBoolean); + } else if ("enableDefenderAgentAutoProvisioning".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.enableDefenderAgentAutoProvisioning + = reader.getNullable(JsonReader::getBoolean); + } else if ("enablePolicyAgentAutoProvisioning".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.enablePolicyAgentAutoProvisioning + = reader.getNullable(JsonReader::getBoolean); + } else if ("mdcContainersImageAssessment".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.mdcContainersImageAssessment + = DefenderForContainersGcpOfferingMdcContainersImageAssessment.fromJson(reader); + } else if ("mdcContainersAgentlessDiscoveryK8s".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.mdcContainersAgentlessDiscoveryK8S + = DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.fromJson(reader); + } else if ("vmScanners".equals(fieldName)) { + deserializedDefenderForContainersGcpOffering.vmScanners + = DefenderForContainersGcpOfferingVmScanners.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersGcpOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.java index be2aadb8c4e3..7b2a4f4a4afb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The native cloud connection configuration. */ @Fluent -public final class DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection { +public final class DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + implements JsonSerializable { /* * The data collection service account email address in GCP for this offering */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /* * The data collection GCP workload identity provider id for this offering */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /** @@ -83,4 +86,48 @@ public String workloadIdentityProviderId() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection. + */ + public static DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection deserializedDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + = new DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.serviceAccountEmailAddress + = reader.getString(); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection.workloadIdentityProviderId + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersGcpOfferingDataPipelineNativeCloudConnection; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.java index 826addd4b26e..50966e3b00bf 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.java @@ -5,29 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender Container agentless discovery configuration. */ @Fluent -public final class DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S { +public final class DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S + implements JsonSerializable { /* * Is Microsoft Defender container agentless discovery enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The workload identity provider id in GCP for this feature */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /* * The service account email address in GCP for this feature */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /** @@ -105,4 +107,52 @@ public String serviceAccountEmailAddress() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S. + */ + public static DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S deserializedDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S + = new DefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.workloadIdentityProviderId + = reader.getString(); + } else if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S.serviceAccountEmailAddress + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersGcpOfferingMdcContainersAgentlessDiscoveryK8S; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.java index 7d4321448bea..d457f2fe0f00 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingMdcContainersImageAssessment.java @@ -5,29 +5,31 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender Container image assessment configuration. */ @Fluent -public final class DefenderForContainersGcpOfferingMdcContainersImageAssessment { +public final class DefenderForContainersGcpOfferingMdcContainersImageAssessment + implements JsonSerializable { /* * Is Microsoft Defender container image assessment enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * The workload identity provider id in GCP for this feature */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /* * The service account email address in GCP for this feature */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /** @@ -105,4 +107,52 @@ public String serviceAccountEmailAddress() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersGcpOfferingMdcContainersImageAssessment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersGcpOfferingMdcContainersImageAssessment if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderForContainersGcpOfferingMdcContainersImageAssessment. + */ + public static DefenderForContainersGcpOfferingMdcContainersImageAssessment fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersGcpOfferingMdcContainersImageAssessment deserializedDefenderForContainersGcpOfferingMdcContainersImageAssessment + = new DefenderForContainersGcpOfferingMdcContainersImageAssessment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingMdcContainersImageAssessment.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingMdcContainersImageAssessment.workloadIdentityProviderId + = reader.getString(); + } else if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingMdcContainersImageAssessment.serviceAccountEmailAddress + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersGcpOfferingMdcContainersImageAssessment; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingNativeCloudConnection.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingNativeCloudConnection.java index 6cdcebcf95b7..a62ba7a0a6a8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingNativeCloudConnection.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingNativeCloudConnection.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The native cloud connection configuration. */ @Fluent -public final class DefenderForContainersGcpOfferingNativeCloudConnection { +public final class DefenderForContainersGcpOfferingNativeCloudConnection + implements JsonSerializable { /* * The service account email address in GCP for this offering */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /* * The GCP workload identity provider id for this offering */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /** @@ -79,4 +82,47 @@ public String workloadIdentityProviderId() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersGcpOfferingNativeCloudConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersGcpOfferingNativeCloudConnection if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersGcpOfferingNativeCloudConnection. + */ + public static DefenderForContainersGcpOfferingNativeCloudConnection fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersGcpOfferingNativeCloudConnection deserializedDefenderForContainersGcpOfferingNativeCloudConnection + = new DefenderForContainersGcpOfferingNativeCloudConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingNativeCloudConnection.serviceAccountEmailAddress + = reader.getString(); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingNativeCloudConnection.workloadIdentityProviderId + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersGcpOfferingNativeCloudConnection; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingVmScanners.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingVmScanners.java index 63c72b7f8786..6df48311dfeb 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingVmScanners.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersGcpOfferingVmScanners.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender for Container K8s VM host scanning configuration. @@ -42,6 +46,50 @@ public DefenderForContainersGcpOfferingVmScanners withConfiguration(VmScannersBa */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersGcpOfferingVmScanners from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersGcpOfferingVmScanners if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersGcpOfferingVmScanners. + */ + public static DefenderForContainersGcpOfferingVmScanners fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersGcpOfferingVmScanners deserializedDefenderForContainersGcpOfferingVmScanners + = new DefenderForContainersGcpOfferingVmScanners(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingVmScanners + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForContainersGcpOfferingVmScanners + .withConfiguration(VmScannersBaseConfiguration.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersGcpOfferingVmScanners; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersJFrogOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersJFrogOffering.java new file mode 100644 index 000000000000..d3b69dfcbbac --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForContainersJFrogOffering.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Defender for Containers for JFrog Artifactory offering. + */ +@Immutable +public final class DefenderForContainersJFrogOffering extends CloudOffering { + /* + * The type of the security offering. + */ + private OfferingType offeringType = OfferingType.DEFENDER_FOR_CONTAINERS_JFROG; + + /** + * Creates an instance of DefenderForContainersJFrogOffering class. + */ + public DefenderForContainersJFrogOffering() { + } + + /** + * Get the offeringType property: The type of the security offering. + * + * @return the offeringType value. + */ + @Override + public OfferingType offeringType() { + return this.offeringType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForContainersJFrogOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForContainersJFrogOffering if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForContainersJFrogOffering. + */ + public static DefenderForContainersJFrogOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForContainersJFrogOffering deserializedDefenderForContainersJFrogOffering + = new DefenderForContainersJFrogOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderForContainersJFrogOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderForContainersJFrogOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForContainersJFrogOffering; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOffering.java index 6b707fccb44d..5b6639145006 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOffering.java @@ -5,39 +5,29 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Defender for Databases GCP offering configurations. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = DefenderForDatabasesGcpOffering.class, - visible = true) -@JsonTypeName("DefenderForDatabasesGcp") @Fluent public final class DefenderForDatabasesGcpOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.DEFENDER_FOR_DATABASES_GCP; /* * The ARC autoprovisioning configuration */ - @JsonProperty(value = "arcAutoProvisioning") private DefenderForDatabasesGcpOfferingArcAutoProvisioning arcAutoProvisioning; /* * The native cloud connection configuration */ - @JsonProperty(value = "defenderForDatabasesArcAutoProvisioning") private DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning defenderForDatabasesArcAutoProvisioning; /** @@ -106,7 +96,6 @@ public DefenderForDatabasesGcpOffering withDefenderForDatabasesArcAutoProvisioni */ @Override public void validate() { - super.validate(); if (arcAutoProvisioning() != null) { arcAutoProvisioning().validate(); } @@ -114,4 +103,53 @@ public void validate() { defenderForDatabasesArcAutoProvisioning().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("arcAutoProvisioning", this.arcAutoProvisioning); + jsonWriter.writeJsonField("defenderForDatabasesArcAutoProvisioning", + this.defenderForDatabasesArcAutoProvisioning); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForDatabasesGcpOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForDatabasesGcpOffering if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForDatabasesGcpOffering. + */ + public static DefenderForDatabasesGcpOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForDatabasesGcpOffering deserializedDefenderForDatabasesGcpOffering + = new DefenderForDatabasesGcpOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderForDatabasesGcpOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderForDatabasesGcpOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else if ("arcAutoProvisioning".equals(fieldName)) { + deserializedDefenderForDatabasesGcpOffering.arcAutoProvisioning + = DefenderForDatabasesGcpOfferingArcAutoProvisioning.fromJson(reader); + } else if ("defenderForDatabasesArcAutoProvisioning".equals(fieldName)) { + deserializedDefenderForDatabasesGcpOffering.defenderForDatabasesArcAutoProvisioning + = DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForDatabasesGcpOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.java index 39c6da569202..69aa0273fd57 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingArcAutoProvisioning.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The ARC autoprovisioning configuration. @@ -43,6 +47,51 @@ public DefenderForDatabasesGcpOfferingArcAutoProvisioning withEnabled(Boolean en */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForDatabasesGcpOfferingArcAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForDatabasesGcpOfferingArcAutoProvisioning if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForDatabasesGcpOfferingArcAutoProvisioning. + */ + public static DefenderForDatabasesGcpOfferingArcAutoProvisioning fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForDatabasesGcpOfferingArcAutoProvisioning deserializedDefenderForDatabasesGcpOfferingArcAutoProvisioning + = new DefenderForDatabasesGcpOfferingArcAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForDatabasesGcpOfferingArcAutoProvisioning + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForDatabasesGcpOfferingArcAutoProvisioning + .withConfiguration(ArcAutoProvisioningConfiguration.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForDatabasesGcpOfferingArcAutoProvisioning; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.java index c5b55c56eb26..bb52cddda555 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The native cloud connection configuration. */ @Fluent -public final class DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning { +public final class DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + implements JsonSerializable { /* * The service account email address in GCP for this offering */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /* * The GCP workload identity provider id for this offering */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /** @@ -79,4 +82,48 @@ public String workloadIdentityProviderId() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning if the JsonReader + * was pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning. + */ + public static DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning deserializedDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + = new DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.serviceAccountEmailAddress + = reader.getString(); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning.workloadIdentityProviderId + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOffering.java index 3fb2dd2da1df..6cf8056eace7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOffering.java @@ -5,63 +5,49 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Defender for Servers AWS offering. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = DefenderForServersAwsOffering.class, - visible = true) -@JsonTypeName("DefenderForServersAws") @Fluent public final class DefenderForServersAwsOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.DEFENDER_FOR_SERVERS_AWS; /* * The Defender for servers connection configuration */ - @JsonProperty(value = "defenderForServers") private DefenderForServersAwsOfferingDefenderForServers defenderForServers; /* * The ARC autoprovisioning configuration */ - @JsonProperty(value = "arcAutoProvisioning") private DefenderForServersAwsOfferingArcAutoProvisioning arcAutoProvisioning; /* * The Vulnerability Assessment autoprovisioning configuration */ - @JsonProperty(value = "vaAutoProvisioning") private DefenderForServersAwsOfferingVaAutoProvisioning vaAutoProvisioning; /* * The Microsoft Defender for Endpoint autoprovisioning configuration */ - @JsonProperty(value = "mdeAutoProvisioning") private DefenderForServersAwsOfferingMdeAutoProvisioning mdeAutoProvisioning; /* * configuration for the servers offering subPlan */ - @JsonProperty(value = "subPlan") private DefenderForServersAwsOfferingSubPlan subPlan; /* * The Microsoft Defender for Server VM scanning configuration */ - @JsonProperty(value = "vmScanners") private DefenderForServersAwsOfferingVmScanners vmScanners; /** @@ -211,7 +197,6 @@ public DefenderForServersAwsOffering withVmScanners(DefenderForServersAwsOfferin */ @Override public void validate() { - super.validate(); if (defenderForServers() != null) { defenderForServers().validate(); } @@ -231,4 +216,68 @@ public void validate() { vmScanners().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("defenderForServers", this.defenderForServers); + jsonWriter.writeJsonField("arcAutoProvisioning", this.arcAutoProvisioning); + jsonWriter.writeJsonField("vaAutoProvisioning", this.vaAutoProvisioning); + jsonWriter.writeJsonField("mdeAutoProvisioning", this.mdeAutoProvisioning); + jsonWriter.writeJsonField("subPlan", this.subPlan); + jsonWriter.writeJsonField("vmScanners", this.vmScanners); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersAwsOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersAwsOffering if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersAwsOffering. + */ + public static DefenderForServersAwsOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersAwsOffering deserializedDefenderForServersAwsOffering + = new DefenderForServersAwsOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderForServersAwsOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderForServersAwsOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else if ("defenderForServers".equals(fieldName)) { + deserializedDefenderForServersAwsOffering.defenderForServers + = DefenderForServersAwsOfferingDefenderForServers.fromJson(reader); + } else if ("arcAutoProvisioning".equals(fieldName)) { + deserializedDefenderForServersAwsOffering.arcAutoProvisioning + = DefenderForServersAwsOfferingArcAutoProvisioning.fromJson(reader); + } else if ("vaAutoProvisioning".equals(fieldName)) { + deserializedDefenderForServersAwsOffering.vaAutoProvisioning + = DefenderForServersAwsOfferingVaAutoProvisioning.fromJson(reader); + } else if ("mdeAutoProvisioning".equals(fieldName)) { + deserializedDefenderForServersAwsOffering.mdeAutoProvisioning + = DefenderForServersAwsOfferingMdeAutoProvisioning.fromJson(reader); + } else if ("subPlan".equals(fieldName)) { + deserializedDefenderForServersAwsOffering.subPlan + = DefenderForServersAwsOfferingSubPlan.fromJson(reader); + } else if ("vmScanners".equals(fieldName)) { + deserializedDefenderForServersAwsOffering.vmScanners + = DefenderForServersAwsOfferingVmScanners.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersAwsOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingArcAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingArcAutoProvisioning.java index a3b03c75ee18..2fb358cfce39 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingArcAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingArcAutoProvisioning.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The ARC autoprovisioning configuration. @@ -52,6 +56,53 @@ public DefenderForServersAwsOfferingArcAutoProvisioning withEnabled(Boolean enab */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + jsonWriter.writeStringField("cloudRoleArn", cloudRoleArn()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersAwsOfferingArcAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersAwsOfferingArcAutoProvisioning if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersAwsOfferingArcAutoProvisioning. + */ + public static DefenderForServersAwsOfferingArcAutoProvisioning fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersAwsOfferingArcAutoProvisioning deserializedDefenderForServersAwsOfferingArcAutoProvisioning + = new DefenderForServersAwsOfferingArcAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingArcAutoProvisioning + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingArcAutoProvisioning + .withConfiguration(ArcAutoProvisioningConfiguration.fromJson(reader)); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingArcAutoProvisioning.withCloudRoleArn(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersAwsOfferingArcAutoProvisioning; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingDefenderForServers.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingDefenderForServers.java index 98df7fa47fe8..eee7509cdef6 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingDefenderForServers.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingDefenderForServers.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Defender for servers connection configuration. */ @Fluent -public final class DefenderForServersAwsOfferingDefenderForServers { +public final class DefenderForServersAwsOfferingDefenderForServers + implements JsonSerializable { /* * The cloud role ARN in AWS for this feature */ - @JsonProperty(value = "cloudRoleArn") private String cloudRoleArn; /** @@ -51,4 +55,41 @@ public DefenderForServersAwsOfferingDefenderForServers withCloudRoleArn(String c */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cloudRoleArn", this.cloudRoleArn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersAwsOfferingDefenderForServers from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersAwsOfferingDefenderForServers if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersAwsOfferingDefenderForServers. + */ + public static DefenderForServersAwsOfferingDefenderForServers fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersAwsOfferingDefenderForServers deserializedDefenderForServersAwsOfferingDefenderForServers + = new DefenderForServersAwsOfferingDefenderForServers(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingDefenderForServers.cloudRoleArn = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersAwsOfferingDefenderForServers; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingMdeAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingMdeAutoProvisioning.java index 44d32a6f8ef5..3c160dc0a66d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingMdeAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingMdeAutoProvisioning.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender for Endpoint autoprovisioning configuration. */ @Fluent -public final class DefenderForServersAwsOfferingMdeAutoProvisioning { +public final class DefenderForServersAwsOfferingMdeAutoProvisioning + implements JsonSerializable { /* * Is Microsoft Defender for Endpoint auto provisioning enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * configuration for Microsoft Defender for Endpoint autoprovisioning */ - @JsonProperty(value = "configuration") private Object configuration; /** @@ -77,4 +80,45 @@ public DefenderForServersAwsOfferingMdeAutoProvisioning withConfiguration(Object */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeUntypedField("configuration", this.configuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersAwsOfferingMdeAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersAwsOfferingMdeAutoProvisioning if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersAwsOfferingMdeAutoProvisioning. + */ + public static DefenderForServersAwsOfferingMdeAutoProvisioning fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersAwsOfferingMdeAutoProvisioning deserializedDefenderForServersAwsOfferingMdeAutoProvisioning + = new DefenderForServersAwsOfferingMdeAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingMdeAutoProvisioning.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingMdeAutoProvisioning.configuration = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersAwsOfferingMdeAutoProvisioning; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingSubPlan.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingSubPlan.java index 0c4a52d24226..1f8749805e47 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingSubPlan.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingSubPlan.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * configuration for the servers offering subPlan. */ @Fluent -public final class DefenderForServersAwsOfferingSubPlan { +public final class DefenderForServersAwsOfferingSubPlan + implements JsonSerializable { /* * The available sub plans */ - @JsonProperty(value = "type") private SubPlan type; /** @@ -51,4 +55,41 @@ public DefenderForServersAwsOfferingSubPlan withType(SubPlan type) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersAwsOfferingSubPlan from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersAwsOfferingSubPlan if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersAwsOfferingSubPlan. + */ + public static DefenderForServersAwsOfferingSubPlan fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersAwsOfferingSubPlan deserializedDefenderForServersAwsOfferingSubPlan + = new DefenderForServersAwsOfferingSubPlan(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingSubPlan.type = SubPlan.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersAwsOfferingSubPlan; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioning.java index f0e803a21b44..2d542688b8b3 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioning.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Vulnerability Assessment autoprovisioning configuration. */ @Fluent -public final class DefenderForServersAwsOfferingVaAutoProvisioning { +public final class DefenderForServersAwsOfferingVaAutoProvisioning + implements JsonSerializable { /* * Is Vulnerability Assessment auto provisioning enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * configuration for Vulnerability Assessment autoprovisioning */ - @JsonProperty(value = "configuration") private DefenderForServersAwsOfferingVaAutoProvisioningConfiguration configuration; /** @@ -81,4 +84,46 @@ public void validate() { configuration().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeJsonField("configuration", this.configuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersAwsOfferingVaAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersAwsOfferingVaAutoProvisioning if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersAwsOfferingVaAutoProvisioning. + */ + public static DefenderForServersAwsOfferingVaAutoProvisioning fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersAwsOfferingVaAutoProvisioning deserializedDefenderForServersAwsOfferingVaAutoProvisioning + = new DefenderForServersAwsOfferingVaAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingVaAutoProvisioning.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingVaAutoProvisioning.configuration + = DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersAwsOfferingVaAutoProvisioning; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.java index 4f2d54b3101d..784802c2ea54 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVaAutoProvisioningConfiguration.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * configuration for Vulnerability Assessment autoprovisioning. */ @Fluent -public final class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration { +public final class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration + implements JsonSerializable { /* * The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' */ - @JsonProperty(value = "type") private Type type; /** @@ -51,4 +55,44 @@ public DefenderForServersAwsOfferingVaAutoProvisioningConfiguration withType(Typ */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersAwsOfferingVaAutoProvisioningConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersAwsOfferingVaAutoProvisioningConfiguration if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderForServersAwsOfferingVaAutoProvisioningConfiguration. + */ + public static DefenderForServersAwsOfferingVaAutoProvisioningConfiguration fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersAwsOfferingVaAutoProvisioningConfiguration deserializedDefenderForServersAwsOfferingVaAutoProvisioningConfiguration + = new DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingVaAutoProvisioningConfiguration.type + = Type.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersAwsOfferingVaAutoProvisioningConfiguration; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVmScanners.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVmScanners.java index 8e662e507b66..789c49fc3ad9 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVmScanners.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersAwsOfferingVmScanners.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender for Server VM scanning configuration. @@ -51,6 +55,53 @@ public DefenderForServersAwsOfferingVmScanners withConfiguration(VmScannersBaseC */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + jsonWriter.writeStringField("cloudRoleArn", cloudRoleArn()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersAwsOfferingVmScanners from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersAwsOfferingVmScanners if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersAwsOfferingVmScanners. + */ + public static DefenderForServersAwsOfferingVmScanners fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersAwsOfferingVmScanners deserializedDefenderForServersAwsOfferingVmScanners + = new DefenderForServersAwsOfferingVmScanners(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingVmScanners + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingVmScanners + .withConfiguration(VmScannersBaseConfiguration.fromJson(reader)); + } else if ("cloudRoleArn".equals(fieldName)) { + deserializedDefenderForServersAwsOfferingVmScanners.withCloudRoleArn(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersAwsOfferingVmScanners; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOffering.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOffering.java index 9710c727af8d..435a62e581e0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOffering.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOffering.java @@ -5,63 +5,49 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Defender for Servers GCP offering configurations. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "offeringType", - defaultImpl = DefenderForServersGcpOffering.class, - visible = true) -@JsonTypeName("DefenderForServersGcp") @Fluent public final class DefenderForServersGcpOffering extends CloudOffering { /* * The type of the security offering. */ - @JsonTypeId - @JsonProperty(value = "offeringType", required = true) private OfferingType offeringType = OfferingType.DEFENDER_FOR_SERVERS_GCP; /* * The Defender for servers connection configuration */ - @JsonProperty(value = "defenderForServers") private DefenderForServersGcpOfferingDefenderForServers defenderForServers; /* * The ARC autoprovisioning configuration */ - @JsonProperty(value = "arcAutoProvisioning") private DefenderForServersGcpOfferingArcAutoProvisioning arcAutoProvisioning; /* * The Vulnerability Assessment autoprovisioning configuration */ - @JsonProperty(value = "vaAutoProvisioning") private DefenderForServersGcpOfferingVaAutoProvisioning vaAutoProvisioning; /* * The Microsoft Defender for Endpoint autoprovisioning configuration */ - @JsonProperty(value = "mdeAutoProvisioning") private DefenderForServersGcpOfferingMdeAutoProvisioning mdeAutoProvisioning; /* * configuration for the servers offering subPlan */ - @JsonProperty(value = "subPlan") private DefenderForServersGcpOfferingSubPlan subPlan; /* * The Microsoft Defender for Server VM scanning configuration */ - @JsonProperty(value = "vmScanners") private DefenderForServersGcpOfferingVmScanners vmScanners; /** @@ -211,7 +197,6 @@ public DefenderForServersGcpOffering withVmScanners(DefenderForServersGcpOfferin */ @Override public void validate() { - super.validate(); if (defenderForServers() != null) { defenderForServers().validate(); } @@ -231,4 +216,68 @@ public void validate() { vmScanners().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("offeringType", this.offeringType == null ? null : this.offeringType.toString()); + jsonWriter.writeJsonField("defenderForServers", this.defenderForServers); + jsonWriter.writeJsonField("arcAutoProvisioning", this.arcAutoProvisioning); + jsonWriter.writeJsonField("vaAutoProvisioning", this.vaAutoProvisioning); + jsonWriter.writeJsonField("mdeAutoProvisioning", this.mdeAutoProvisioning); + jsonWriter.writeJsonField("subPlan", this.subPlan); + jsonWriter.writeJsonField("vmScanners", this.vmScanners); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersGcpOffering from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersGcpOffering if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersGcpOffering. + */ + public static DefenderForServersGcpOffering fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersGcpOffering deserializedDefenderForServersGcpOffering + = new DefenderForServersGcpOffering(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDefenderForServersGcpOffering.withDescription(reader.getString()); + } else if ("offeringType".equals(fieldName)) { + deserializedDefenderForServersGcpOffering.offeringType + = OfferingType.fromString(reader.getString()); + } else if ("defenderForServers".equals(fieldName)) { + deserializedDefenderForServersGcpOffering.defenderForServers + = DefenderForServersGcpOfferingDefenderForServers.fromJson(reader); + } else if ("arcAutoProvisioning".equals(fieldName)) { + deserializedDefenderForServersGcpOffering.arcAutoProvisioning + = DefenderForServersGcpOfferingArcAutoProvisioning.fromJson(reader); + } else if ("vaAutoProvisioning".equals(fieldName)) { + deserializedDefenderForServersGcpOffering.vaAutoProvisioning + = DefenderForServersGcpOfferingVaAutoProvisioning.fromJson(reader); + } else if ("mdeAutoProvisioning".equals(fieldName)) { + deserializedDefenderForServersGcpOffering.mdeAutoProvisioning + = DefenderForServersGcpOfferingMdeAutoProvisioning.fromJson(reader); + } else if ("subPlan".equals(fieldName)) { + deserializedDefenderForServersGcpOffering.subPlan + = DefenderForServersGcpOfferingSubPlan.fromJson(reader); + } else if ("vmScanners".equals(fieldName)) { + deserializedDefenderForServersGcpOffering.vmScanners + = DefenderForServersGcpOfferingVmScanners.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersGcpOffering; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingArcAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingArcAutoProvisioning.java index 1ad6882f0692..dd99e18208af 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingArcAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingArcAutoProvisioning.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The ARC autoprovisioning configuration. @@ -43,6 +47,50 @@ public DefenderForServersGcpOfferingArcAutoProvisioning withEnabled(Boolean enab */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersGcpOfferingArcAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersGcpOfferingArcAutoProvisioning if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersGcpOfferingArcAutoProvisioning. + */ + public static DefenderForServersGcpOfferingArcAutoProvisioning fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersGcpOfferingArcAutoProvisioning deserializedDefenderForServersGcpOfferingArcAutoProvisioning + = new DefenderForServersGcpOfferingArcAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingArcAutoProvisioning + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingArcAutoProvisioning + .withConfiguration(ArcAutoProvisioningConfiguration.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersGcpOfferingArcAutoProvisioning; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingDefenderForServers.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingDefenderForServers.java index 64fd7880fb15..b6f2c6288be5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingDefenderForServers.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingDefenderForServers.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Defender for servers connection configuration. */ @Fluent -public final class DefenderForServersGcpOfferingDefenderForServers { +public final class DefenderForServersGcpOfferingDefenderForServers + implements JsonSerializable { /* * The workload identity provider id in GCP for this feature */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /* * The service account email address in GCP for this feature */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /** @@ -79,4 +82,46 @@ public String serviceAccountEmailAddress() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersGcpOfferingDefenderForServers from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersGcpOfferingDefenderForServers if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersGcpOfferingDefenderForServers. + */ + public static DefenderForServersGcpOfferingDefenderForServers fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersGcpOfferingDefenderForServers deserializedDefenderForServersGcpOfferingDefenderForServers + = new DefenderForServersGcpOfferingDefenderForServers(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingDefenderForServers.workloadIdentityProviderId + = reader.getString(); + } else if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingDefenderForServers.serviceAccountEmailAddress + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersGcpOfferingDefenderForServers; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingMdeAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingMdeAutoProvisioning.java index f99c83dc070c..f937c1246219 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingMdeAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingMdeAutoProvisioning.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender for Endpoint autoprovisioning configuration. */ @Fluent -public final class DefenderForServersGcpOfferingMdeAutoProvisioning { +public final class DefenderForServersGcpOfferingMdeAutoProvisioning + implements JsonSerializable { /* * Is Microsoft Defender for Endpoint auto provisioning enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * configuration for Microsoft Defender for Endpoint autoprovisioning */ - @JsonProperty(value = "configuration") private Object configuration; /** @@ -77,4 +80,45 @@ public DefenderForServersGcpOfferingMdeAutoProvisioning withConfiguration(Object */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeUntypedField("configuration", this.configuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersGcpOfferingMdeAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersGcpOfferingMdeAutoProvisioning if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersGcpOfferingMdeAutoProvisioning. + */ + public static DefenderForServersGcpOfferingMdeAutoProvisioning fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersGcpOfferingMdeAutoProvisioning deserializedDefenderForServersGcpOfferingMdeAutoProvisioning + = new DefenderForServersGcpOfferingMdeAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingMdeAutoProvisioning.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingMdeAutoProvisioning.configuration = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersGcpOfferingMdeAutoProvisioning; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingSubPlan.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingSubPlan.java index 805e38440176..c9f7fc4d672a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingSubPlan.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingSubPlan.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * configuration for the servers offering subPlan. */ @Fluent -public final class DefenderForServersGcpOfferingSubPlan { +public final class DefenderForServersGcpOfferingSubPlan + implements JsonSerializable { /* * The available sub plans */ - @JsonProperty(value = "type") private SubPlan type; /** @@ -51,4 +55,41 @@ public DefenderForServersGcpOfferingSubPlan withType(SubPlan type) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersGcpOfferingSubPlan from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersGcpOfferingSubPlan if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersGcpOfferingSubPlan. + */ + public static DefenderForServersGcpOfferingSubPlan fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersGcpOfferingSubPlan deserializedDefenderForServersGcpOfferingSubPlan + = new DefenderForServersGcpOfferingSubPlan(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingSubPlan.type = SubPlan.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersGcpOfferingSubPlan; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioning.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioning.java index add710540f99..5c235a8f90df 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioning.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioning.java @@ -5,23 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Vulnerability Assessment autoprovisioning configuration. */ @Fluent -public final class DefenderForServersGcpOfferingVaAutoProvisioning { +public final class DefenderForServersGcpOfferingVaAutoProvisioning + implements JsonSerializable { /* * Is Vulnerability Assessment auto provisioning enabled */ - @JsonProperty(value = "enabled") private Boolean enabled; /* * configuration for Vulnerability Assessment autoprovisioning */ - @JsonProperty(value = "configuration") private DefenderForServersGcpOfferingVaAutoProvisioningConfiguration configuration; /** @@ -81,4 +84,46 @@ public void validate() { configuration().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeJsonField("configuration", this.configuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersGcpOfferingVaAutoProvisioning from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersGcpOfferingVaAutoProvisioning if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersGcpOfferingVaAutoProvisioning. + */ + public static DefenderForServersGcpOfferingVaAutoProvisioning fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersGcpOfferingVaAutoProvisioning deserializedDefenderForServersGcpOfferingVaAutoProvisioning + = new DefenderForServersGcpOfferingVaAutoProvisioning(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingVaAutoProvisioning.enabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingVaAutoProvisioning.configuration + = DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersGcpOfferingVaAutoProvisioning; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.java index afceeffabd35..9622ce1c3ab2 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVaAutoProvisioningConfiguration.java @@ -5,17 +5,21 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * configuration for Vulnerability Assessment autoprovisioning. */ @Fluent -public final class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration { +public final class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration + implements JsonSerializable { /* * The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' */ - @JsonProperty(value = "type") private Type type; /** @@ -51,4 +55,44 @@ public DefenderForServersGcpOfferingVaAutoProvisioningConfiguration withType(Typ */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersGcpOfferingVaAutoProvisioningConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersGcpOfferingVaAutoProvisioningConfiguration if the JsonReader was + * pointing to an instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the + * DefenderForServersGcpOfferingVaAutoProvisioningConfiguration. + */ + public static DefenderForServersGcpOfferingVaAutoProvisioningConfiguration fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersGcpOfferingVaAutoProvisioningConfiguration deserializedDefenderForServersGcpOfferingVaAutoProvisioningConfiguration + = new DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingVaAutoProvisioningConfiguration.type + = Type.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersGcpOfferingVaAutoProvisioningConfiguration; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVmScanners.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVmScanners.java index df496ff2ea02..2430ece553cf 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVmScanners.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForServersGcpOfferingVmScanners.java @@ -5,6 +5,10 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The Microsoft Defender for Server VM scanning configuration. @@ -42,6 +46,50 @@ public DefenderForServersGcpOfferingVmScanners withConfiguration(VmScannersBaseC */ @Override public void validate() { - super.validate(); + if (configuration() != null) { + configuration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enabled", enabled()); + jsonWriter.writeJsonField("configuration", configuration()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForServersGcpOfferingVmScanners from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForServersGcpOfferingVmScanners if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForServersGcpOfferingVmScanners. + */ + public static DefenderForServersGcpOfferingVmScanners fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForServersGcpOfferingVmScanners deserializedDefenderForServersGcpOfferingVmScanners + = new DefenderForServersGcpOfferingVmScanners(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enabled".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingVmScanners + .withEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("configuration".equals(fieldName)) { + deserializedDefenderForServersGcpOfferingVmScanners + .withConfiguration(VmScannersBaseConfiguration.fromJson(reader)); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForServersGcpOfferingVmScanners; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSetting.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSetting.java index 24ec7a8744bc..6cccb97e328f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSetting.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSetting.java @@ -4,6 +4,7 @@ package com.azure.resourcemanager.security.models; +import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner; @@ -33,66 +34,11 @@ public interface DefenderForStorageSetting { String type(); /** - * Gets the isEnabled property: Indicates whether Defender for Storage is enabled on this storage account. + * Gets the properties property: Defender for Storage resource properties. * - * @return the isEnabled value. + * @return the properties value. */ - Boolean isEnabled(); - - /** - * Gets the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this storage - * account should override the settings defined for the subscription. - * - * @return the overrideSubscriptionLevelSettings value. - */ - Boolean overrideSubscriptionLevelSettings(); - - /** - * Gets the scanResultsEventGridTopicResourceId property: Optional. Resource id of an Event Grid Topic to send scan - * results to. - * - * @return the scanResultsEventGridTopicResourceId value. - */ - String scanResultsEventGridTopicResourceId(); - - /** - * Gets the operationStatus property: Upon failure or partial success. Additional data describing Malware Scanning - * enable/disable operation. - * - * @return the operationStatus value. - */ - OperationStatus operationStatus(); - - /** - * Gets the isEnabledMalwareScanningIsEnabled property: Indicates whether On Upload malware scanning should be - * enabled. - * - * @return the isEnabledMalwareScanningIsEnabled value. - */ - Boolean isEnabledMalwareScanningIsEnabled(); - - /** - * Gets the capGBPerMonth property: Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. - * - * @return the capGBPerMonth value. - */ - Integer capGBPerMonth(); - - /** - * Gets the isEnabledSensitiveDataDiscoveryIsEnabled property: Indicates whether Sensitive Data Discovery should be - * enabled. - * - * @return the isEnabledSensitiveDataDiscoveryIsEnabled value. - */ - Boolean isEnabledSensitiveDataDiscoveryIsEnabled(); - - /** - * Gets the operationStatusSensitiveDataDiscoveryOperationStatus property: Upon failure or partial success. - * Additional data describing Sensitive Data Discovery enable/disable operation. - * - * @return the operationStatusSensitiveDataDiscoveryOperationStatus value. - */ - OperationStatus operationStatusSensitiveDataDiscoveryOperationStatus(); + DefenderForStorageSettingProperties properties(); /** * Gets the inner com.azure.resourcemanager.security.fluent.models.DefenderForStorageSettingInner object. @@ -134,11 +80,7 @@ interface WithScope { * The stage of the DefenderForStorageSetting definition which contains all the minimum required properties for * the resource to be created, but also allows for any other optional properties to be specified. */ - interface WithCreate - extends DefinitionStages.WithIsEnabled, DefinitionStages.WithOverrideSubscriptionLevelSettings, - DefinitionStages.WithScanResultsEventGridTopicResourceId, - DefinitionStages.WithIsEnabledMalwareScanningIsEnabled, DefinitionStages.WithCapGBPerMonth, - DefinitionStages.WithIsEnabledSensitiveDataDiscoveryIsEnabled { + interface WithCreate extends DefinitionStages.WithProperties { /** * Executes the create request. * @@ -156,92 +98,16 @@ interface WithCreate } /** - * The stage of the DefenderForStorageSetting definition allowing to specify isEnabled. + * The stage of the DefenderForStorageSetting definition allowing to specify properties. */ - interface WithIsEnabled { + interface WithProperties { /** - * Specifies the isEnabled property: Indicates whether Defender for Storage is enabled on this storage - * account.. + * Specifies the properties property: Defender for Storage resource properties.. * - * @param isEnabled Indicates whether Defender for Storage is enabled on this storage account. + * @param properties Defender for Storage resource properties. * @return the next definition stage. */ - WithCreate withIsEnabled(Boolean isEnabled); - } - - /** - * The stage of the DefenderForStorageSetting definition allowing to specify overrideSubscriptionLevelSettings. - */ - interface WithOverrideSubscriptionLevelSettings { - /** - * Specifies the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this - * storage account should override the settings defined for the subscription.. - * - * @param overrideSubscriptionLevelSettings Indicates whether the settings defined for this storage account - * should override the settings defined for the subscription. - * @return the next definition stage. - */ - WithCreate withOverrideSubscriptionLevelSettings(Boolean overrideSubscriptionLevelSettings); - } - - /** - * The stage of the DefenderForStorageSetting definition allowing to specify - * scanResultsEventGridTopicResourceId. - */ - interface WithScanResultsEventGridTopicResourceId { - /** - * Specifies the scanResultsEventGridTopicResourceId property: Optional. Resource id of an Event Grid Topic - * to send scan results to.. - * - * @param scanResultsEventGridTopicResourceId Optional. Resource id of an Event Grid Topic to send scan - * results to. - * @return the next definition stage. - */ - WithCreate withScanResultsEventGridTopicResourceId(String scanResultsEventGridTopicResourceId); - } - - /** - * The stage of the DefenderForStorageSetting definition allowing to specify isEnabledMalwareScanningIsEnabled. - */ - interface WithIsEnabledMalwareScanningIsEnabled { - /** - * Specifies the isEnabledMalwareScanningIsEnabled property: Indicates whether On Upload malware scanning - * should be enabled.. - * - * @param isEnabledMalwareScanningIsEnabled Indicates whether On Upload malware scanning should be enabled. - * @return the next definition stage. - */ - WithCreate withIsEnabledMalwareScanningIsEnabled(Boolean isEnabledMalwareScanningIsEnabled); - } - - /** - * The stage of the DefenderForStorageSetting definition allowing to specify capGBPerMonth. - */ - interface WithCapGBPerMonth { - /** - * Specifies the capGBPerMonth property: Defines the max GB to be scanned per Month. Set to -1 if no capping - * is needed.. - * - * @param capGBPerMonth Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. - * @return the next definition stage. - */ - WithCreate withCapGBPerMonth(Integer capGBPerMonth); - } - - /** - * The stage of the DefenderForStorageSetting definition allowing to specify - * isEnabledSensitiveDataDiscoveryIsEnabled. - */ - interface WithIsEnabledSensitiveDataDiscoveryIsEnabled { - /** - * Specifies the isEnabledSensitiveDataDiscoveryIsEnabled property: Indicates whether Sensitive Data - * Discovery should be enabled.. - * - * @param isEnabledSensitiveDataDiscoveryIsEnabled Indicates whether Sensitive Data Discovery should be - * enabled. - * @return the next definition stage. - */ - WithCreate withIsEnabledSensitiveDataDiscoveryIsEnabled(Boolean isEnabledSensitiveDataDiscoveryIsEnabled); + WithCreate withProperties(DefenderForStorageSettingProperties properties); } } @@ -259,4 +125,24 @@ interface WithIsEnabledSensitiveDataDiscoveryIsEnabled { * @return the refreshed resource. */ DefenderForStorageSetting refresh(Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + Response startMalwareScanWithResponse(Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + MalwareScan startMalwareScan(); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSettingProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSettingProperties.java new file mode 100644 index 000000000000..ae9ea364c57e --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorageSettingProperties.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defender for Storage resource properties. + */ +@Fluent +public final class DefenderForStorageSettingProperties + implements JsonSerializable { + /* + * Indicates whether Defender for Storage is enabled on this storage account. + */ + private Boolean isEnabled; + + /* + * Properties of Malware Scanning. + */ + private MalwareScanningProperties malwareScanning; + + /* + * Properties of Sensitive Data Discovery. + */ + private SensitiveDataDiscoveryProperties sensitiveDataDiscovery; + + /* + * Indicates whether the settings defined for this storage account should override the settings defined for the + * subscription. + */ + private Boolean overrideSubscriptionLevelSettings; + + /** + * Creates an instance of DefenderForStorageSettingProperties class. + */ + public DefenderForStorageSettingProperties() { + } + + /** + * Get the isEnabled property: Indicates whether Defender for Storage is enabled on this storage account. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Indicates whether Defender for Storage is enabled on this storage account. + * + * @param isEnabled the isEnabled value to set. + * @return the DefenderForStorageSettingProperties object itself. + */ + public DefenderForStorageSettingProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the malwareScanning property: Properties of Malware Scanning. + * + * @return the malwareScanning value. + */ + public MalwareScanningProperties malwareScanning() { + return this.malwareScanning; + } + + /** + * Set the malwareScanning property: Properties of Malware Scanning. + * + * @param malwareScanning the malwareScanning value to set. + * @return the DefenderForStorageSettingProperties object itself. + */ + public DefenderForStorageSettingProperties withMalwareScanning(MalwareScanningProperties malwareScanning) { + this.malwareScanning = malwareScanning; + return this; + } + + /** + * Get the sensitiveDataDiscovery property: Properties of Sensitive Data Discovery. + * + * @return the sensitiveDataDiscovery value. + */ + public SensitiveDataDiscoveryProperties sensitiveDataDiscovery() { + return this.sensitiveDataDiscovery; + } + + /** + * Set the sensitiveDataDiscovery property: Properties of Sensitive Data Discovery. + * + * @param sensitiveDataDiscovery the sensitiveDataDiscovery value to set. + * @return the DefenderForStorageSettingProperties object itself. + */ + public DefenderForStorageSettingProperties + withSensitiveDataDiscovery(SensitiveDataDiscoveryProperties sensitiveDataDiscovery) { + this.sensitiveDataDiscovery = sensitiveDataDiscovery; + return this; + } + + /** + * Get the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this storage + * account should override the settings defined for the subscription. + * + * @return the overrideSubscriptionLevelSettings value. + */ + public Boolean overrideSubscriptionLevelSettings() { + return this.overrideSubscriptionLevelSettings; + } + + /** + * Set the overrideSubscriptionLevelSettings property: Indicates whether the settings defined for this storage + * account should override the settings defined for the subscription. + * + * @param overrideSubscriptionLevelSettings the overrideSubscriptionLevelSettings value to set. + * @return the DefenderForStorageSettingProperties object itself. + */ + public DefenderForStorageSettingProperties + withOverrideSubscriptionLevelSettings(Boolean overrideSubscriptionLevelSettings) { + this.overrideSubscriptionLevelSettings = overrideSubscriptionLevelSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (malwareScanning() != null) { + malwareScanning().validate(); + } + if (sensitiveDataDiscovery() != null) { + sensitiveDataDiscovery().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", this.isEnabled); + jsonWriter.writeJsonField("malwareScanning", this.malwareScanning); + jsonWriter.writeJsonField("sensitiveDataDiscovery", this.sensitiveDataDiscovery); + jsonWriter.writeBooleanField("overrideSubscriptionLevelSettings", this.overrideSubscriptionLevelSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefenderForStorageSettingProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefenderForStorageSettingProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DefenderForStorageSettingProperties. + */ + public static DefenderForStorageSettingProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DefenderForStorageSettingProperties deserializedDefenderForStorageSettingProperties + = new DefenderForStorageSettingProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedDefenderForStorageSettingProperties.isEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("malwareScanning".equals(fieldName)) { + deserializedDefenderForStorageSettingProperties.malwareScanning + = MalwareScanningProperties.fromJson(reader); + } else if ("sensitiveDataDiscovery".equals(fieldName)) { + deserializedDefenderForStorageSettingProperties.sensitiveDataDiscovery + = SensitiveDataDiscoveryProperties.fromJson(reader); + } else if ("overrideSubscriptionLevelSettings".equals(fieldName)) { + deserializedDefenderForStorageSettingProperties.overrideSubscriptionLevelSettings + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDefenderForStorageSettingProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorages.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorages.java index 4762c3ebfa31..bb193865a733 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorages.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DefenderForStorages.java @@ -36,6 +36,87 @@ public interface DefenderForStorages { */ DefenderForStorageSetting get(String resourceId, SettingName settingName); + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + Response startMalwareScanWithResponse(String resourceId, SettingName settingName, Context context); + + /** + * Initiate a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + MalwareScan startMalwareScan(String resourceId, SettingName settingName); + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation along with {@link Response}. + */ + Response cancelMalwareScanWithResponse(String resourceId, SettingName settingName, String scanId, + Context context); + + /** + * Cancels a Defender for Storage malware scan for the specified storage account. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the state of a malware scan operation. + */ + MalwareScan cancelMalwareScan(String resourceId, SettingName settingName, String scanId); + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource along with {@link Response}. + */ + Response getMalwareScanWithResponse(String resourceId, SettingName settingName, String scanId, + Context context); + + /** + * Gets the Defender for Storage malware scan for the specified storage resource. + * + * @param resourceId The identifier of the resource. + * @param settingName Defender for Storage setting name. + * @param scanId The identifier of the scan. Can be either 'latest' or a GUID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Defender for Storage malware scan for the specified storage resource. + */ + MalwareScan getMalwareScan(String resourceId, SettingName settingName, String scanId); + /** * Gets the Defender for Storage settings for the specified storage account. * diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DenylistCustomAlertRule.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DenylistCustomAlertRule.java index a7f1880d1e22..e2fab6399883 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DenylistCustomAlertRule.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DenylistCustomAlertRule.java @@ -6,34 +6,25 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * A custom alert rule that checks if a value (depends on the custom alert type) is denied. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = DenylistCustomAlertRule.class, - visible = true) -@JsonTypeName("DenylistCustomAlertRule") @Fluent public final class DenylistCustomAlertRule extends ListCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "DenylistCustomAlertRule"; /* * The values to deny. The format of the values depends on the rule type. */ - @JsonProperty(value = "denylistValues", required = true) private List denylistValues; /** @@ -88,7 +79,6 @@ public DenylistCustomAlertRule withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); if (denylistValues() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -97,4 +87,55 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(DenylistCustomAlertRule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeArrayField("denylistValues", this.denylistValues, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DenylistCustomAlertRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DenylistCustomAlertRule if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DenylistCustomAlertRule. + */ + public static DenylistCustomAlertRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DenylistCustomAlertRule deserializedDenylistCustomAlertRule = new DenylistCustomAlertRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedDenylistCustomAlertRule.withIsEnabled(reader.getBoolean()); + } else if ("displayName".equals(fieldName)) { + deserializedDenylistCustomAlertRule.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedDenylistCustomAlertRule.withDescription(reader.getString()); + } else if ("valueType".equals(fieldName)) { + deserializedDenylistCustomAlertRule.withValueType(ValueType.fromString(reader.getString())); + } else if ("denylistValues".equals(fieldName)) { + List denylistValues = reader.readArray(reader1 -> reader1.getString()); + deserializedDenylistCustomAlertRule.denylistValues = denylistValues; + } else if ("ruleType".equals(fieldName)) { + deserializedDenylistCustomAlertRule.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDenylistCustomAlertRule; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DescendantBehavior.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DescendantBehavior.java new file mode 100644 index 000000000000..8f2e03ea92c7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DescendantBehavior.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The behavior of a policy on descendant resources. + */ +public final class DescendantBehavior extends ExpandableStringEnum { + /** + * Static value Unknown for DescendantBehavior. + */ + public static final DescendantBehavior UNKNOWN = fromString("Unknown"); + + /** + * Static value Override for DescendantBehavior. + */ + public static final DescendantBehavior OVERRIDE = fromString("Override"); + + /** + * Static value FallBack for DescendantBehavior. + */ + public static final DescendantBehavior FALL_BACK = fromString("FallBack"); + + /** + * Creates a new instance of DescendantBehavior value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DescendantBehavior() { + } + + /** + * Creates or finds a DescendantBehavior from its string representation. + * + * @param name a name to look for. + * @return the corresponding DescendantBehavior. + */ + public static DescendantBehavior fromString(String name) { + return fromString(name, DescendantBehavior.class); + } + + /** + * Gets known DescendantBehavior values. + * + * @return known DescendantBehavior values. + */ + public static Collection values() { + return values(DescendantBehavior.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsCapability.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsCapability.java index 96d6fa8d8c37..c1d35b961cf1 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsCapability.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsCapability.java @@ -5,23 +5,25 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Details about DevOps capability. */ @Immutable -public final class DevOpsCapability { +public final class DevOpsCapability implements JsonSerializable { /* * Gets the name of the DevOps capability. */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) private String name; /* * Gets the value of the DevOps capability. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private String value; /** @@ -55,4 +57,41 @@ public String value() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsCapability from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsCapability if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DevOpsCapability. + */ + public static DevOpsCapability fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsCapability deserializedDevOpsCapability = new DevOpsCapability(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDevOpsCapability.name = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedDevOpsCapability.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsCapability; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationListResponse.java index ac060a5d6efb..41ca2e8a5a6f 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationListResponse.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationListResponse.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.DevOpsConfigurationInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of RP resources which supports pagination. */ @Fluent -public final class DevOpsConfigurationListResponse { +public final class DevOpsConfigurationListResponse implements JsonSerializable { /* * Gets or sets list of resources. */ - @JsonProperty(value = "value") private List value; /* * Gets or sets next link to scroll over the results. */ - @JsonProperty(value = "nextLink") private String nextLink; /** @@ -82,4 +84,46 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsConfigurationListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsConfigurationListResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DevOpsConfigurationListResponse. + */ + public static DevOpsConfigurationListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsConfigurationListResponse deserializedDevOpsConfigurationListResponse + = new DevOpsConfigurationListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DevOpsConfigurationInner.fromJson(reader1)); + deserializedDevOpsConfigurationListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDevOpsConfigurationListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsConfigurationListResponse; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationProperties.java index bec128d73bbf..4fde6e8a057c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsConfigurationProperties.java @@ -5,7 +5,12 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; @@ -13,17 +18,15 @@ * DevOps Configuration properties. */ @Fluent -public final class DevOpsConfigurationProperties { +public final class DevOpsConfigurationProperties implements JsonSerializable { /* - * Gets or sets resource status message. + * Gets the resource status message. */ - @JsonProperty(value = "provisioningStatusMessage", access = JsonProperty.Access.WRITE_ONLY) private String provisioningStatusMessage; /* - * Gets or sets time when resource was last checked. + * Gets the time when resource was last checked. */ - @JsonProperty(value = "provisioningStatusUpdateTimeUtc", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime provisioningStatusUpdateTimeUtc; /* @@ -37,32 +40,27 @@ public final class DevOpsConfigurationProperties { * DeletionSuccess - Deletion successful. * DeletionFailure - Deletion failure. */ - @JsonProperty(value = "provisioningState") private DevOpsProvisioningState provisioningState; /* * Authorization payload. */ - @JsonProperty(value = "authorization") private Authorization authorization; /* * AutoDiscovery states. */ - @JsonProperty(value = "autoDiscovery") private AutoDiscovery autoDiscovery; /* * List of top-level inventory to select when AutoDiscovery is disabled. * This field is ignored when AutoDiscovery is enabled. */ - @JsonProperty(value = "topLevelInventoryList") private List topLevelInventoryList; /* * List of capabilities assigned to the DevOps configuration during the discovery process. */ - @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) private List capabilities; /** @@ -72,7 +70,7 @@ public DevOpsConfigurationProperties() { } /** - * Get the provisioningStatusMessage property: Gets or sets resource status message. + * Get the provisioningStatusMessage property: Gets the resource status message. * * @return the provisioningStatusMessage value. */ @@ -81,7 +79,7 @@ public String provisioningStatusMessage() { } /** - * Get the provisioningStatusUpdateTimeUtc property: Gets or sets time when resource was last checked. + * Get the provisioningStatusUpdateTimeUtc property: Gets the time when resource was last checked. * * @return the provisioningStatusUpdateTimeUtc value. */ @@ -106,25 +104,6 @@ public DevOpsProvisioningState provisioningState() { return this.provisioningState; } - /** - * Set the provisioningState property: The provisioning state of the resource. - * - * Pending - Provisioning pending. - * Failed - Provisioning failed. - * Succeeded - Successful provisioning. - * Canceled - Provisioning canceled. - * PendingDeletion - Deletion pending. - * DeletionSuccess - Deletion successful. - * DeletionFailure - Deletion failure. - * - * @param provisioningState the provisioningState value to set. - * @return the DevOpsConfigurationProperties object itself. - */ - public DevOpsConfigurationProperties withProvisioningState(DevOpsProvisioningState provisioningState) { - this.provisioningState = provisioningState; - return this; - } - /** * Get the authorization property: Authorization payload. * @@ -210,4 +189,62 @@ public void validate() { capabilities().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("authorization", this.authorization); + jsonWriter.writeStringField("autoDiscovery", this.autoDiscovery == null ? null : this.autoDiscovery.toString()); + jsonWriter.writeArrayField("topLevelInventoryList", this.topLevelInventoryList, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsConfigurationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsConfigurationProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DevOpsConfigurationProperties. + */ + public static DevOpsConfigurationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsConfigurationProperties deserializedDevOpsConfigurationProperties + = new DevOpsConfigurationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningStatusMessage".equals(fieldName)) { + deserializedDevOpsConfigurationProperties.provisioningStatusMessage = reader.getString(); + } else if ("provisioningStatusUpdateTimeUtc".equals(fieldName)) { + deserializedDevOpsConfigurationProperties.provisioningStatusUpdateTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedDevOpsConfigurationProperties.provisioningState + = DevOpsProvisioningState.fromString(reader.getString()); + } else if ("authorization".equals(fieldName)) { + deserializedDevOpsConfigurationProperties.authorization = Authorization.fromJson(reader); + } else if ("autoDiscovery".equals(fieldName)) { + deserializedDevOpsConfigurationProperties.autoDiscovery + = AutoDiscovery.fromString(reader.getString()); + } else if ("topLevelInventoryList".equals(fieldName)) { + List topLevelInventoryList = reader.readArray(reader1 -> reader1.getString()); + deserializedDevOpsConfigurationProperties.topLevelInventoryList = topLevelInventoryList; + } else if ("capabilities".equals(fieldName)) { + List capabilities + = reader.readArray(reader1 -> DevOpsCapability.fromJson(reader1)); + deserializedDevOpsConfigurationProperties.capabilities = capabilities; + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsConfigurationProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicies.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicies.java new file mode 100644 index 000000000000..7341c2df1514 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicies.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of DevOpsPolicies. + */ +public interface DevOpsPolicies { + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String securityConnectorName); + + /** + * Returns a list of DevOps Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String securityConnectorName, String devOpsPolicyType, + Context context); + + /** + * Returns a DevOps Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy Resource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String securityConnectorName, String policyName, + Context context); + + /** + * Returns a DevOps Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return devOps Policy Resource. + */ + DevOpsPolicy get(String resourceGroupName, String securityConnectorName, String policyName); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicy.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicy.java new file mode 100644 index 000000000000..b2d171e61da7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicy.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyInner; + +/** + * An immutable client-side representation of DevOpsPolicy. + */ +public interface DevOpsPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: Policy DevOps Resource properties that contain the full definition of a DevOps + * policy resource. + * + * @return the properties value. + */ + DevOpsPolicyProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.DevOpsPolicyInner object. + * + * @return the inner object. + */ + DevOpsPolicyInner innerModel(); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignment.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignment.java new file mode 100644 index 000000000000..24736758ccb8 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignment.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyAssignmentInner; + +/** + * An immutable client-side representation of DevOpsPolicyAssignment. + */ +public interface DevOpsPolicyAssignment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: Properties of the DevOps policy assignment resource. + * + * @return the properties value. + */ + DevOpsPolicyAssignmentProperties properties(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.security.fluent.models.DevOpsPolicyAssignmentInner object. + * + * @return the inner object. + */ + DevOpsPolicyAssignmentInner innerModel(); + + /** + * The entirety of the DevOpsPolicyAssignment definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The DevOpsPolicyAssignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the DevOpsPolicyAssignment definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the DevOpsPolicyAssignment definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, securityConnectorName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @return the next definition stage. + */ + WithCreate withExistingSecurityConnector(String resourceGroupName, String securityConnectorName); + } + + /** + * The stage of the DevOpsPolicyAssignment definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + DevOpsPolicyAssignment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DevOpsPolicyAssignment create(Context context); + } + + /** + * The stage of the DevOpsPolicyAssignment definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the DevOps policy assignment resource.. + * + * @param properties Properties of the DevOps policy assignment resource. + * @return the next definition stage. + */ + WithCreate withProperties(DevOpsPolicyAssignmentProperties properties); + } + } + + /** + * Begins update for the DevOpsPolicyAssignment resource. + * + * @return the stage of resource update. + */ + DevOpsPolicyAssignment.Update update(); + + /** + * The template for DevOpsPolicyAssignment update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DevOpsPolicyAssignment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DevOpsPolicyAssignment apply(Context context); + } + + /** + * The DevOpsPolicyAssignment update stages. + */ + interface UpdateStages { + /** + * The stage of the DevOpsPolicyAssignment update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the DevOps policy assignment resource.. + * + * @param properties Properties of the DevOps policy assignment resource. + * @return the next definition stage. + */ + Update withProperties(DevOpsPolicyAssignmentProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DevOpsPolicyAssignment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DevOpsPolicyAssignment refresh(Context context); +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignmentListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignmentListResponse.java new file mode 100644 index 000000000000..140f32ba68ae --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignmentListResponse.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyAssignmentInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Fluent +public final class DevOpsPolicyAssignmentListResponse implements JsonSerializable { + /* + * Gets or sets list of resources. + */ + private List value; + + /* + * Gets or sets next link to scroll over the results. + */ + private String nextLink; + + /** + * Creates an instance of DevOpsPolicyAssignmentListResponse class. + */ + public DevOpsPolicyAssignmentListResponse() { + } + + /** + * Get the value property: Gets or sets list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets list of resources. + * + * @param value the value value to set. + * @return the DevOpsPolicyAssignmentListResponse object itself. + */ + public DevOpsPolicyAssignmentListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets next link to scroll over the results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets next link to scroll over the results. + * + * @param nextLink the nextLink value to set. + * @return the DevOpsPolicyAssignmentListResponse object itself. + */ + public DevOpsPolicyAssignmentListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsPolicyAssignmentListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsPolicyAssignmentListResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DevOpsPolicyAssignmentListResponse. + */ + public static DevOpsPolicyAssignmentListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsPolicyAssignmentListResponse deserializedDevOpsPolicyAssignmentListResponse + = new DevOpsPolicyAssignmentListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DevOpsPolicyAssignmentInner.fromJson(reader1)); + deserializedDevOpsPolicyAssignmentListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsPolicyAssignmentListResponse; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignmentProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignmentProperties.java new file mode 100644 index 000000000000..055c4f7cdde3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignmentProperties.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Properties of the DevOps policy assignment resource. + */ +@Fluent +public final class DevOpsPolicyAssignmentProperties implements JsonSerializable { + /* + * Gets the resource status message. + */ + private String provisioningStatusMessage; + + /* + * Gets the time when resource was last checked. + */ + private OffsetDateTime provisioningStatusUpdateTimeUtc; + + /* + * The provisioning state of the resource. + * + * Pending - Provisioning pending. + * Failed - Provisioning failed. + * Succeeded - Successful provisioning. + * Canceled - Provisioning canceled. + * PendingDeletion - Deletion pending. + * DeletionSuccess - Deletion successful. + * DeletionFailure - Deletion failure. + */ + private DevOpsProvisioningState provisioningState; + + /* + * Gets or sets the Azure resource id. + */ + private String resourceId; + + /* + * The behavior of a policy on descendant resources. + */ + private DescendantBehavior descendantBehavior; + + /* + * Condensed information to identify a DevOps Policy resource. + */ + private DevOpsPolicyDescriptor policy; + + /* + * Gets or sets time when the assignment was created in UTC. + */ + private OffsetDateTime assignedAt; + + /** + * Creates an instance of DevOpsPolicyAssignmentProperties class. + */ + public DevOpsPolicyAssignmentProperties() { + } + + /** + * Get the provisioningStatusMessage property: Gets the resource status message. + * + * @return the provisioningStatusMessage value. + */ + public String provisioningStatusMessage() { + return this.provisioningStatusMessage; + } + + /** + * Get the provisioningStatusUpdateTimeUtc property: Gets the time when resource was last checked. + * + * @return the provisioningStatusUpdateTimeUtc value. + */ + public OffsetDateTime provisioningStatusUpdateTimeUtc() { + return this.provisioningStatusUpdateTimeUtc; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * Pending - Provisioning pending. + * Failed - Provisioning failed. + * Succeeded - Successful provisioning. + * Canceled - Provisioning canceled. + * PendingDeletion - Deletion pending. + * DeletionSuccess - Deletion successful. + * DeletionFailure - Deletion failure. + * + * @return the provisioningState value. + */ + public DevOpsProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the resourceId property: Gets or sets the Azure resource id. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Gets or sets the Azure resource id. + * + * @param resourceId the resourceId value to set. + * @return the DevOpsPolicyAssignmentProperties object itself. + */ + public DevOpsPolicyAssignmentProperties withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the descendantBehavior property: The behavior of a policy on descendant resources. + * + * @return the descendantBehavior value. + */ + public DescendantBehavior descendantBehavior() { + return this.descendantBehavior; + } + + /** + * Set the descendantBehavior property: The behavior of a policy on descendant resources. + * + * @param descendantBehavior the descendantBehavior value to set. + * @return the DevOpsPolicyAssignmentProperties object itself. + */ + public DevOpsPolicyAssignmentProperties withDescendantBehavior(DescendantBehavior descendantBehavior) { + this.descendantBehavior = descendantBehavior; + return this; + } + + /** + * Get the policy property: Condensed information to identify a DevOps Policy resource. + * + * @return the policy value. + */ + public DevOpsPolicyDescriptor policy() { + return this.policy; + } + + /** + * Set the policy property: Condensed information to identify a DevOps Policy resource. + * + * @param policy the policy value to set. + * @return the DevOpsPolicyAssignmentProperties object itself. + */ + public DevOpsPolicyAssignmentProperties withPolicy(DevOpsPolicyDescriptor policy) { + this.policy = policy; + return this; + } + + /** + * Get the assignedAt property: Gets or sets time when the assignment was created in UTC. + * + * @return the assignedAt value. + */ + public OffsetDateTime assignedAt() { + return this.assignedAt; + } + + /** + * Set the assignedAt property: Gets or sets time when the assignment was created in UTC. + * + * @param assignedAt the assignedAt value to set. + * @return the DevOpsPolicyAssignmentProperties object itself. + */ + public DevOpsPolicyAssignmentProperties withAssignedAt(OffsetDateTime assignedAt) { + this.assignedAt = assignedAt; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policy() != null) { + policy().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("descendantBehavior", + this.descendantBehavior == null ? null : this.descendantBehavior.toString()); + jsonWriter.writeJsonField("policy", this.policy); + jsonWriter.writeStringField("assignedAt", + this.assignedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.assignedAt)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsPolicyAssignmentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsPolicyAssignmentProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DevOpsPolicyAssignmentProperties. + */ + public static DevOpsPolicyAssignmentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsPolicyAssignmentProperties deserializedDevOpsPolicyAssignmentProperties + = new DevOpsPolicyAssignmentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningStatusMessage".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentProperties.provisioningStatusMessage = reader.getString(); + } else if ("provisioningStatusUpdateTimeUtc".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentProperties.provisioningStatusUpdateTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentProperties.provisioningState + = DevOpsProvisioningState.fromString(reader.getString()); + } else if ("resourceId".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentProperties.resourceId = reader.getString(); + } else if ("descendantBehavior".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentProperties.descendantBehavior + = DescendantBehavior.fromString(reader.getString()); + } else if ("policy".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentProperties.policy = DevOpsPolicyDescriptor.fromJson(reader); + } else if ("assignedAt".equals(fieldName)) { + deserializedDevOpsPolicyAssignmentProperties.assignedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsPolicyAssignmentProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControls.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignments.java similarity index 51% rename from sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControls.java rename to sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignments.java index f6dc614ced7c..4d0877b31b1a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/AdaptiveApplicationControls.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyAssignments.java @@ -4,114 +4,120 @@ package com.azure.resourcemanager.security.models; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; /** - * Resource collection API of AdaptiveApplicationControls. + * Resource collection API of DevOpsPolicyAssignments. */ -public interface AdaptiveApplicationControls { +public interface DevOpsPolicyAssignments { /** - * Gets a list of application control machine groups for the subscription. + * Returns a list of DevOps Policy Assignments. * - * @param includePathRecommendations Include the policy rules. - * @param summary Return output in a summarized form. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of application control machine groups for the subscription along with {@link Response}. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. */ - Response listWithResponse(Boolean includePathRecommendations, Boolean summary, - Context context); + PagedIterable list(String resourceGroupName, String securityConnectorName); /** - * Gets a list of application control machine groups for the subscription. + * Returns a list of DevOps Policy Assignments. * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param devOpsPolicyType Optional filter for listing the policies. + * @param resourceId Optional filter for listing the assignments of a specific resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of application control machine groups for the subscription. + * @return list of RP resources which supports pagination as paginated response with {@link PagedIterable}. */ - AdaptiveApplicationControlGroups list(); + PagedIterable list(String resourceGroupName, String securityConnectorName, + String devOpsPolicyType, String resourceId, Context context); /** - * Gets an application control VM/server group. + * Returns a DevOps Policy Assignment Resource. * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group along with {@link Response}. + * @return devOps Policy assignment resource along with {@link Response}. */ - Response getWithResponse(String ascLocation, String groupName, Context context); + Response getWithResponse(String resourceGroupName, String securityConnectorName, + String policyAssignmentId, Context context); /** - * Gets an application control VM/server group. + * Returns a DevOps Policy Assignment Resource. * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group. + * @return devOps Policy assignment resource. */ - AdaptiveApplicationControlGroup get(String ascLocation, String groupName); + DevOpsPolicyAssignment get(String resourceGroupName, String securityConnectorName, String policyAssignmentId); /** - * Delete an application control machine group. + * Deletes a DevOps Policy Assignment Resource. * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. - * @param context The context to associate with this operation. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. */ - Response deleteByResourceGroupWithResponse(String ascLocation, String groupName, Context context); + void delete(String resourceGroupName, String securityConnectorName, String policyAssignmentId); /** - * Delete an application control machine group. + * Deletes a DevOps Policy Assignment Resource. * - * @param ascLocation The location where ASC stores the data of the subscription. can be retrieved from Get - * locations. - * @param groupName Name of an application control machine group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param securityConnectorName The security connector name. + * @param policyAssignmentId The policy assignment Id. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void deleteByResourceGroup(String ascLocation, String groupName); + void delete(String resourceGroupName, String securityConnectorName, String policyAssignmentId, Context context); /** - * Gets an application control VM/server group. + * Returns a DevOps Policy Assignment Resource. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group along with {@link Response}. + * @return devOps Policy assignment resource along with {@link Response}. */ - AdaptiveApplicationControlGroup getById(String id); + DevOpsPolicyAssignment getById(String id); /** - * Gets an application control VM/server group. + * Returns a DevOps Policy Assignment Resource. * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an application control VM/server group along with {@link Response}. + * @return devOps Policy assignment resource along with {@link Response}. */ - Response getByIdWithResponse(String id, Context context); + Response getByIdWithResponse(String id, Context context); /** - * Delete an application control machine group. + * Deletes a DevOps Policy Assignment Resource. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -121,22 +127,21 @@ Response listWithResponse(Boolean includePathR void deleteById(String id); /** - * Delete an application control machine group. + * Deletes a DevOps Policy Assignment Resource. * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. */ - Response deleteByIdWithResponse(String id, Context context); + void deleteByIdWithResponse(String id, Context context); /** - * Begins definition for a new AdaptiveApplicationControlGroup resource. + * Begins definition for a new DevOpsPolicyAssignment resource. * * @param name resource name. - * @return the first stage of the new AdaptiveApplicationControlGroup definition. + * @return the first stage of the new DevOpsPolicyAssignment definition. */ - AdaptiveApplicationControlGroup.DefinitionStages.Blank define(String name); + DevOpsPolicyAssignment.DefinitionStages.Blank define(String name); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyDescriptor.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyDescriptor.java new file mode 100644 index 000000000000..60608e9d0734 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyDescriptor.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Condensed information to identify a DevOps Policy resource. + */ +@Fluent +public final class DevOpsPolicyDescriptor implements JsonSerializable { + /* + * Gets or sets the policy name. + */ + private String policyName; + + /* + * Gets or sets the policy GUID. + */ + private String policyId; + + /* + * Gets or sets the version. + */ + private String policyVersion; + + /* + * DevOps Policy resource types. + */ + private DevOpsPolicyType policyType; + + /** + * Creates an instance of DevOpsPolicyDescriptor class. + */ + public DevOpsPolicyDescriptor() { + } + + /** + * Get the policyName property: Gets or sets the policy name. + * + * @return the policyName value. + */ + public String policyName() { + return this.policyName; + } + + /** + * Set the policyName property: Gets or sets the policy name. + * + * @param policyName the policyName value to set. + * @return the DevOpsPolicyDescriptor object itself. + */ + public DevOpsPolicyDescriptor withPolicyName(String policyName) { + this.policyName = policyName; + return this; + } + + /** + * Get the policyId property: Gets or sets the policy GUID. + * + * @return the policyId value. + */ + public String policyId() { + return this.policyId; + } + + /** + * Set the policyId property: Gets or sets the policy GUID. + * + * @param policyId the policyId value to set. + * @return the DevOpsPolicyDescriptor object itself. + */ + public DevOpsPolicyDescriptor withPolicyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Get the policyVersion property: Gets or sets the version. + * + * @return the policyVersion value. + */ + public String policyVersion() { + return this.policyVersion; + } + + /** + * Set the policyVersion property: Gets or sets the version. + * + * @param policyVersion the policyVersion value to set. + * @return the DevOpsPolicyDescriptor object itself. + */ + public DevOpsPolicyDescriptor withPolicyVersion(String policyVersion) { + this.policyVersion = policyVersion; + return this; + } + + /** + * Get the policyType property: DevOps Policy resource types. + * + * @return the policyType value. + */ + public DevOpsPolicyType policyType() { + return this.policyType; + } + + /** + * Set the policyType property: DevOps Policy resource types. + * + * @param policyType the policyType value to set. + * @return the DevOpsPolicyDescriptor object itself. + */ + public DevOpsPolicyDescriptor withPolicyType(DevOpsPolicyType policyType) { + this.policyType = policyType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("policyName", this.policyName); + jsonWriter.writeStringField("policyId", this.policyId); + jsonWriter.writeStringField("policyVersion", this.policyVersion); + jsonWriter.writeStringField("policyType", this.policyType == null ? null : this.policyType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsPolicyDescriptor from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsPolicyDescriptor if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DevOpsPolicyDescriptor. + */ + public static DevOpsPolicyDescriptor fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsPolicyDescriptor deserializedDevOpsPolicyDescriptor = new DevOpsPolicyDescriptor(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("policyName".equals(fieldName)) { + deserializedDevOpsPolicyDescriptor.policyName = reader.getString(); + } else if ("policyId".equals(fieldName)) { + deserializedDevOpsPolicyDescriptor.policyId = reader.getString(); + } else if ("policyVersion".equals(fieldName)) { + deserializedDevOpsPolicyDescriptor.policyVersion = reader.getString(); + } else if ("policyType".equals(fieldName)) { + deserializedDevOpsPolicyDescriptor.policyType = DevOpsPolicyType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsPolicyDescriptor; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyListResponse.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyListResponse.java new file mode 100644 index 000000000000..c4fe1bc74fd7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyListResponse.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.security.fluent.models.DevOpsPolicyInner; +import java.io.IOException; +import java.util.List; + +/** + * List of RP resources which supports pagination. + */ +@Fluent +public final class DevOpsPolicyListResponse implements JsonSerializable { + /* + * Gets or sets list of resources. + */ + private List value; + + /* + * Gets or sets next link to scroll over the results. + */ + private String nextLink; + + /** + * Creates an instance of DevOpsPolicyListResponse class. + */ + public DevOpsPolicyListResponse() { + } + + /** + * Get the value property: Gets or sets list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets list of resources. + * + * @param value the value value to set. + * @return the DevOpsPolicyListResponse object itself. + */ + public DevOpsPolicyListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets next link to scroll over the results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets next link to scroll over the results. + * + * @param nextLink the nextLink value to set. + * @return the DevOpsPolicyListResponse object itself. + */ + public DevOpsPolicyListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsPolicyListResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsPolicyListResponse if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DevOpsPolicyListResponse. + */ + public static DevOpsPolicyListResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsPolicyListResponse deserializedDevOpsPolicyListResponse = new DevOpsPolicyListResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> DevOpsPolicyInner.fromJson(reader1)); + deserializedDevOpsPolicyListResponse.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDevOpsPolicyListResponse.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsPolicyListResponse; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyProperties.java new file mode 100644 index 000000000000..2095bb4567fd --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyProperties.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** + * Policy DevOps Resource properties that contain the full definition of a DevOps policy resource. + */ +@Fluent +public final class DevOpsPolicyProperties implements JsonSerializable { + /* + * Gets the resource status message. + */ + private String provisioningStatusMessage; + + /* + * Gets the time when resource was last checked. + */ + private OffsetDateTime provisioningStatusUpdateTimeUtc; + + /* + * The provisioning state of the resource. + * + * Pending - Provisioning pending. + * Failed - Provisioning failed. + * Succeeded - Successful provisioning. + * Canceled - Provisioning canceled. + * PendingDeletion - Deletion pending. + * DeletionSuccess - Deletion successful. + * DeletionFailure - Deletion failure. + */ + private DevOpsProvisioningState provisioningState; + + /* + * DevOps Policy creation sources. + */ + private DevOpsPolicySource source; + + /* + * Gets the policy resource GUID. + */ + private UUID policyId; + + /* + * Gets the web URL. + */ + private String webUrl; + + /* + * Gets or sets the semantic version. + */ + private String version; + + /* + * DevOps Policy resource types. + */ + private DevOpsPolicyType type; + + /* + * Gets or sets the policy definition content JSON string. + */ + private String content; + + /** + * Creates an instance of DevOpsPolicyProperties class. + */ + public DevOpsPolicyProperties() { + } + + /** + * Get the provisioningStatusMessage property: Gets the resource status message. + * + * @return the provisioningStatusMessage value. + */ + public String provisioningStatusMessage() { + return this.provisioningStatusMessage; + } + + /** + * Get the provisioningStatusUpdateTimeUtc property: Gets the time when resource was last checked. + * + * @return the provisioningStatusUpdateTimeUtc value. + */ + public OffsetDateTime provisioningStatusUpdateTimeUtc() { + return this.provisioningStatusUpdateTimeUtc; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * Pending - Provisioning pending. + * Failed - Provisioning failed. + * Succeeded - Successful provisioning. + * Canceled - Provisioning canceled. + * PendingDeletion - Deletion pending. + * DeletionSuccess - Deletion successful. + * DeletionFailure - Deletion failure. + * + * @return the provisioningState value. + */ + public DevOpsProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the source property: DevOps Policy creation sources. + * + * @return the source value. + */ + public DevOpsPolicySource source() { + return this.source; + } + + /** + * Set the source property: DevOps Policy creation sources. + * + * @param source the source value to set. + * @return the DevOpsPolicyProperties object itself. + */ + public DevOpsPolicyProperties withSource(DevOpsPolicySource source) { + this.source = source; + return this; + } + + /** + * Get the policyId property: Gets the policy resource GUID. + * + * @return the policyId value. + */ + public UUID policyId() { + return this.policyId; + } + + /** + * Get the webUrl property: Gets the web URL. + * + * @return the webUrl value. + */ + public String webUrl() { + return this.webUrl; + } + + /** + * Get the version property: Gets or sets the semantic version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Gets or sets the semantic version. + * + * @param version the version value to set. + * @return the DevOpsPolicyProperties object itself. + */ + public DevOpsPolicyProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the type property: DevOps Policy resource types. + * + * @return the type value. + */ + public DevOpsPolicyType type() { + return this.type; + } + + /** + * Set the type property: DevOps Policy resource types. + * + * @param type the type value to set. + * @return the DevOpsPolicyProperties object itself. + */ + public DevOpsPolicyProperties withType(DevOpsPolicyType type) { + this.type = type; + return this; + } + + /** + * Get the content property: Gets or sets the policy definition content JSON string. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: Gets or sets the policy definition content JSON string. + * + * @param content the content value to set. + * @return the DevOpsPolicyProperties object itself. + */ + public DevOpsPolicyProperties withContent(String content) { + this.content = content; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("source", this.source == null ? null : this.source.toString()); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("content", this.content); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DevOpsPolicyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DevOpsPolicyProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DevOpsPolicyProperties. + */ + public static DevOpsPolicyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DevOpsPolicyProperties deserializedDevOpsPolicyProperties = new DevOpsPolicyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningStatusMessage".equals(fieldName)) { + deserializedDevOpsPolicyProperties.provisioningStatusMessage = reader.getString(); + } else if ("provisioningStatusUpdateTimeUtc".equals(fieldName)) { + deserializedDevOpsPolicyProperties.provisioningStatusUpdateTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedDevOpsPolicyProperties.provisioningState + = DevOpsProvisioningState.fromString(reader.getString()); + } else if ("source".equals(fieldName)) { + deserializedDevOpsPolicyProperties.source = DevOpsPolicySource.fromString(reader.getString()); + } else if ("policyId".equals(fieldName)) { + deserializedDevOpsPolicyProperties.policyId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("webUrl".equals(fieldName)) { + deserializedDevOpsPolicyProperties.webUrl = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedDevOpsPolicyProperties.version = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDevOpsPolicyProperties.type = DevOpsPolicyType.fromString(reader.getString()); + } else if ("content".equals(fieldName)) { + deserializedDevOpsPolicyProperties.content = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDevOpsPolicyProperties; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicySource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicySource.java new file mode 100644 index 000000000000..b37764bc85d3 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicySource.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * DevOps Policy creation sources. + */ +public final class DevOpsPolicySource extends ExpandableStringEnum { + /** + * Static value Unknown for DevOpsPolicySource. + */ + public static final DevOpsPolicySource UNKNOWN = fromString("Unknown"); + + /** + * Static value BuiltIn for DevOpsPolicySource. + */ + public static final DevOpsPolicySource BUILT_IN = fromString("BuiltIn"); + + /** + * Static value UserDefined for DevOpsPolicySource. + */ + public static final DevOpsPolicySource USER_DEFINED = fromString("UserDefined"); + + /** + * Creates a new instance of DevOpsPolicySource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DevOpsPolicySource() { + } + + /** + * Creates or finds a DevOpsPolicySource from its string representation. + * + * @param name a name to look for. + * @return the corresponding DevOpsPolicySource. + */ + public static DevOpsPolicySource fromString(String name) { + return fromString(name, DevOpsPolicySource.class); + } + + /** + * Gets known DevOpsPolicySource values. + * + * @return known DevOpsPolicySource values. + */ + public static Collection values() { + return values(DevOpsPolicySource.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyType.java new file mode 100644 index 000000000000..85fdb24efcb7 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsPolicyType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * DevOps Policy resource types. + */ +public final class DevOpsPolicyType extends ExpandableStringEnum { + /** + * Static value Unknown for DevOpsPolicyType. + */ + public static final DevOpsPolicyType UNKNOWN = fromString("Unknown"); + + /** + * Static value Pipeline for DevOpsPolicyType. + */ + public static final DevOpsPolicyType PIPELINE = fromString("Pipeline"); + + /** + * Creates a new instance of DevOpsPolicyType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DevOpsPolicyType() { + } + + /** + * Creates or finds a DevOpsPolicyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DevOpsPolicyType. + */ + public static DevOpsPolicyType fromString(String name) { + return fromString(name, DevOpsPolicyType.class); + } + + /** + * Gets known DevOpsPolicyType values. + * + * @return known DevOpsPolicyType values. + */ + public static Collection values() { + return values(DevOpsPolicyType.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsProvisioningState.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsProvisioningState.java index cf6fecd3e609..723624bcf62c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsProvisioningState.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DevOpsProvisioningState.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -70,7 +69,6 @@ public DevOpsProvisioningState() { * @param name a name to look for. * @return the corresponding DevOpsProvisioningState. */ - @JsonCreator public static DevOpsProvisioningState fromString(String name) { return fromString(name, DevOpsProvisioningState.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroupList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroupList.java index fcb9cf9fd1b2..ba1035de43ff 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroupList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DeviceSecurityGroupList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.DeviceSecurityGroupInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * List of device security groups. */ @Fluent -public final class DeviceSecurityGroupList { +public final class DeviceSecurityGroupList implements JsonSerializable { /* * List of device security group objects */ - @JsonProperty(value = "value") private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeviceSecurityGroupList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeviceSecurityGroupList if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DeviceSecurityGroupList. + */ + public static DeviceSecurityGroupList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeviceSecurityGroupList deserializedDeviceSecurityGroupList = new DeviceSecurityGroupList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DeviceSecurityGroupInner.fromJson(reader1)); + deserializedDeviceSecurityGroupList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDeviceSecurityGroupList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeviceSecurityGroupList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DirectMethodInvokesNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DirectMethodInvokesNotInAllowedRange.java index 803b8131a37c..715969d5d508 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DirectMethodInvokesNotInAllowedRange.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DirectMethodInvokesNotInAllowedRange.java @@ -5,28 +5,22 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; /** * Number of direct method invokes is not in allowed range. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = DirectMethodInvokesNotInAllowedRange.class, - visible = true) -@JsonTypeName("DirectMethodInvokesNotInAllowedRange") @Fluent public final class DirectMethodInvokesNotInAllowedRange extends TimeWindowCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "DirectMethodInvokesNotInAllowedRange"; /** @@ -88,6 +82,67 @@ public DirectMethodInvokesNotInAllowedRange withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); + if (timeWindowSize() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeWindowSize in model DirectMethodInvokesNotInAllowedRange")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DirectMethodInvokesNotInAllowedRange.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeIntField("minThreshold", minThreshold()); + jsonWriter.writeIntField("maxThreshold", maxThreshold()); + jsonWriter.writeStringField("timeWindowSize", CoreUtils.durationToStringWithDays(timeWindowSize())); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DirectMethodInvokesNotInAllowedRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DirectMethodInvokesNotInAllowedRange if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DirectMethodInvokesNotInAllowedRange. + */ + public static DirectMethodInvokesNotInAllowedRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DirectMethodInvokesNotInAllowedRange deserializedDirectMethodInvokesNotInAllowedRange + = new DirectMethodInvokesNotInAllowedRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedDirectMethodInvokesNotInAllowedRange.withIsEnabled(reader.getBoolean()); + } else if ("minThreshold".equals(fieldName)) { + deserializedDirectMethodInvokesNotInAllowedRange.withMinThreshold(reader.getInt()); + } else if ("maxThreshold".equals(fieldName)) { + deserializedDirectMethodInvokesNotInAllowedRange.withMaxThreshold(reader.getInt()); + } else if ("timeWindowSize".equals(fieldName)) { + deserializedDirectMethodInvokesNotInAllowedRange.withTimeWindowSize( + reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()))); + } else if ("displayName".equals(fieldName)) { + deserializedDirectMethodInvokesNotInAllowedRange.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedDirectMethodInvokesNotInAllowedRange.withDescription(reader.getString()); + } else if ("ruleType".equals(fieldName)) { + deserializedDirectMethodInvokesNotInAllowedRange.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDirectMethodInvokesNotInAllowedRange; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Direction.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Direction.java deleted file mode 100644 index fa058da533db..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Direction.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * The rule's direction. - */ -public final class Direction extends ExpandableStringEnum { - /** - * Static value Inbound for Direction. - */ - public static final Direction INBOUND = fromString("Inbound"); - - /** - * Static value Outbound for Direction. - */ - public static final Direction OUTBOUND = fromString("Outbound"); - - /** - * Creates a new instance of Direction value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public Direction() { - } - - /** - * Creates or finds a Direction from its string representation. - * - * @param name a name to look for. - * @return the corresponding Direction. - */ - @JsonCreator - public static Direction fromString(String name) { - return fromString(name, Direction.class); - } - - /** - * Gets known Direction values. - * - * @return known Direction values. - */ - public static Collection values() { - return values(Direction.class); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutionList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutionList.java index bd6bf1354a23..a78d169ddc63 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutionList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DiscoveredSecuritySolutionList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.DiscoveredSecuritySolutionInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The DiscoveredSecuritySolutionList model. */ @Fluent -public final class DiscoveredSecuritySolutionList { +public final class DiscoveredSecuritySolutionList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value") private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -71,4 +73,45 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredSecuritySolutionList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredSecuritySolutionList if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DiscoveredSecuritySolutionList. + */ + public static DiscoveredSecuritySolutionList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredSecuritySolutionList deserializedDiscoveredSecuritySolutionList + = new DiscoveredSecuritySolutionList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DiscoveredSecuritySolutionInner.fromJson(reader1)); + deserializedDiscoveredSecuritySolutionList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDiscoveredSecuritySolutionList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredSecuritySolutionList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DockerHubEnvironmentData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DockerHubEnvironmentData.java new file mode 100644 index 000000000000..36dfad75ee63 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/DockerHubEnvironmentData.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Docker Hub connector environment data. + */ +@Fluent +public final class DockerHubEnvironmentData extends EnvironmentData { + /* + * The type of the environment data. + */ + private EnvironmentType environmentType = EnvironmentType.DOCKER_HUB_ORGANIZATION; + + /* + * The Docker Hub organization authentication details + */ + private Authentication authentication; + + /* + * Scan interval in hours (value should be between 1-hour to 24-hours) + */ + private Long scanInterval; + + /** + * Creates an instance of DockerHubEnvironmentData class. + */ + public DockerHubEnvironmentData() { + } + + /** + * Get the environmentType property: The type of the environment data. + * + * @return the environmentType value. + */ + @Override + public EnvironmentType environmentType() { + return this.environmentType; + } + + /** + * Get the authentication property: The Docker Hub organization authentication details. + * + * @return the authentication value. + */ + public Authentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: The Docker Hub organization authentication details. + * + * @param authentication the authentication value to set. + * @return the DockerHubEnvironmentData object itself. + */ + public DockerHubEnvironmentData withAuthentication(Authentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Get the scanInterval property: Scan interval in hours (value should be between 1-hour to 24-hours). + * + * @return the scanInterval value. + */ + public Long scanInterval() { + return this.scanInterval; + } + + /** + * Set the scanInterval property: Scan interval in hours (value should be between 1-hour to 24-hours). + * + * @param scanInterval the scanInterval value to set. + * @return the DockerHubEnvironmentData object itself. + */ + public DockerHubEnvironmentData withScanInterval(Long scanInterval) { + this.scanInterval = scanInterval; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (authentication() != null) { + authentication().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("environmentType", + this.environmentType == null ? null : this.environmentType.toString()); + jsonWriter.writeJsonField("authentication", this.authentication); + jsonWriter.writeNumberField("scanInterval", this.scanInterval); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DockerHubEnvironmentData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DockerHubEnvironmentData if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DockerHubEnvironmentData. + */ + public static DockerHubEnvironmentData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DockerHubEnvironmentData deserializedDockerHubEnvironmentData = new DockerHubEnvironmentData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("environmentType".equals(fieldName)) { + deserializedDockerHubEnvironmentData.environmentType + = EnvironmentType.fromString(reader.getString()); + } else if ("authentication".equals(fieldName)) { + deserializedDockerHubEnvironmentData.authentication = Authentication.fromJson(reader); + } else if ("scanInterval".equals(fieldName)) { + deserializedDockerHubEnvironmentData.scanInterval = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedDockerHubEnvironmentData; + }); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Effect.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Effect.java new file mode 100644 index 000000000000..b7ec28941b49 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Effect.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Expected effect of this assignment (Audit/Exempt/Attest). + */ +public final class Effect extends ExpandableStringEnum { + /** + * Static value Audit for Effect. + */ + public static final Effect AUDIT = fromString("Audit"); + + /** + * Static value Exempt for Effect. + */ + public static final Effect EXEMPT = fromString("Exempt"); + + /** + * Static value Attest for Effect. + */ + public static final Effect ATTEST = fromString("Attest"); + + /** + * Creates a new instance of Effect value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Effect() { + } + + /** + * Creates or finds a Effect from its string representation. + * + * @param name a name to look for. + * @return the corresponding Effect. + */ + public static Effect fromString(String name) { + return fromString(name, Effect.class); + } + + /** + * Gets known Effect values. + * + * @return known Effect values. + */ + public static Collection values() { + return values(Effect.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EffectiveNetworkSecurityGroups.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EffectiveNetworkSecurityGroups.java deleted file mode 100644 index d9f78c61a349..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EffectiveNetworkSecurityGroups.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** - * Describes the Network Security Groups effective on a network interface. - */ -@Fluent -public final class EffectiveNetworkSecurityGroups { - /* - * The Azure resource ID of the network interface - */ - @JsonProperty(value = "networkInterface") - private String networkInterface; - - /* - * The Network Security Groups effective on the network interface - */ - @JsonProperty(value = "networkSecurityGroups") - private List networkSecurityGroups; - - /** - * Creates an instance of EffectiveNetworkSecurityGroups class. - */ - public EffectiveNetworkSecurityGroups() { - } - - /** - * Get the networkInterface property: The Azure resource ID of the network interface. - * - * @return the networkInterface value. - */ - public String networkInterface() { - return this.networkInterface; - } - - /** - * Set the networkInterface property: The Azure resource ID of the network interface. - * - * @param networkInterface the networkInterface value to set. - * @return the EffectiveNetworkSecurityGroups object itself. - */ - public EffectiveNetworkSecurityGroups withNetworkInterface(String networkInterface) { - this.networkInterface = networkInterface; - return this; - } - - /** - * Get the networkSecurityGroups property: The Network Security Groups effective on the network interface. - * - * @return the networkSecurityGroups value. - */ - public List networkSecurityGroups() { - return this.networkSecurityGroups; - } - - /** - * Set the networkSecurityGroups property: The Network Security Groups effective on the network interface. - * - * @param networkSecurityGroups the networkSecurityGroups value to set. - * @return the EffectiveNetworkSecurityGroups object itself. - */ - public EffectiveNetworkSecurityGroups withNetworkSecurityGroups(List networkSecurityGroups) { - this.networkSecurityGroups = networkSecurityGroups; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java index 8d83a3237130..e86e45fc3a42 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EndOfSupportStatus.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -53,7 +52,6 @@ public EndOfSupportStatus() { * @param name a name to look for. * @return the corresponding EndOfSupportStatus. */ - @JsonCreator public static EndOfSupportStatus fromString(String name) { return fromString(name, EndOfSupportStatus.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Enforce.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Enforce.java index 491f1e20353f..6c9ba4bdec37 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Enforce.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Enforce.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -39,7 +38,6 @@ public Enforce() { * @param name a name to look for. * @return the corresponding Enforce. */ - @JsonCreator public static Enforce fromString(String name) { return fromString(name, Enforce.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementMode.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementMode.java deleted file mode 100644 index 85e1cdc5ccc4..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementMode.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * The application control policy enforcement/protection mode of the machine group. - */ -public final class EnforcementMode extends ExpandableStringEnum { - /** - * Static value Audit for EnforcementMode. - */ - public static final EnforcementMode AUDIT = fromString("Audit"); - - /** - * Static value Enforce for EnforcementMode. - */ - public static final EnforcementMode ENFORCE = fromString("Enforce"); - - /** - * Static value None for EnforcementMode. - */ - public static final EnforcementMode NONE = fromString("None"); - - /** - * Creates a new instance of EnforcementMode value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public EnforcementMode() { - } - - /** - * Creates or finds a EnforcementMode from its string representation. - * - * @param name a name to look for. - * @return the corresponding EnforcementMode. - */ - @JsonCreator - public static EnforcementMode fromString(String name) { - return fromString(name, EnforcementMode.class); - } - - /** - * Gets known EnforcementMode values. - * - * @return known EnforcementMode values. - */ - public static Collection values() { - return values(EnforcementMode.class); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementSupport.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementSupport.java deleted file mode 100644 index 42bd2ade16c9..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnforcementSupport.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * The machine supportability of Enforce feature. - */ -public final class EnforcementSupport extends ExpandableStringEnum { - /** - * Static value Supported for EnforcementSupport. - */ - public static final EnforcementSupport SUPPORTED = fromString("Supported"); - - /** - * Static value NotSupported for EnforcementSupport. - */ - public static final EnforcementSupport NOT_SUPPORTED = fromString("NotSupported"); - - /** - * Static value Unknown for EnforcementSupport. - */ - public static final EnforcementSupport UNKNOWN = fromString("Unknown"); - - /** - * Creates a new instance of EnforcementSupport value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public EnforcementSupport() { - } - - /** - * Creates or finds a EnforcementSupport from its string representation. - * - * @param name a name to look for. - * @return the corresponding EnforcementSupport. - */ - @JsonCreator - public static EnforcementSupport fromString(String name) { - return fromString(name, EnforcementSupport.class); - } - - /** - * Gets known EnforcementSupport values. - * - * @return known EnforcementSupport values. - */ - public static Collection values() { - return values(EnforcementSupport.class); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentData.java index acbf9cdc61f6..c74a017309e8 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentData.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentData.java @@ -5,41 +5,26 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The security connector environment data. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "environmentType", - defaultImpl = EnvironmentData.class, - visible = true) -@JsonTypeName("EnvironmentData") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "AwsAccount", value = AwsEnvironmentData.class), - @JsonSubTypes.Type(name = "GcpProject", value = GcpProjectEnvironmentData.class), - @JsonSubTypes.Type(name = "GithubScope", value = GithubScopeEnvironmentData.class), - @JsonSubTypes.Type(name = "AzureDevOpsScope", value = AzureDevOpsScopeEnvironmentData.class), - @JsonSubTypes.Type(name = "GitlabScope", value = GitlabScopeEnvironmentData.class) }) @Immutable -public class EnvironmentData { +public class EnvironmentData implements JsonSerializable { /* * The type of the environment data. */ - @JsonTypeId - @JsonProperty(value = "environmentType", required = true) - private EnvironmentType environmentType; + private EnvironmentType environmentType = EnvironmentType.fromString("EnvironmentData"); /** * Creates an instance of EnvironmentData class. */ public EnvironmentData() { - this.environmentType = EnvironmentType.fromString("EnvironmentData"); } /** @@ -58,4 +43,78 @@ public EnvironmentType environmentType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("environmentType", + this.environmentType == null ? null : this.environmentType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnvironmentData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnvironmentData if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EnvironmentData. + */ + public static EnvironmentData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("environmentType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AwsAccount".equals(discriminatorValue)) { + return AwsEnvironmentData.fromJson(readerToUse.reset()); + } else if ("GcpProject".equals(discriminatorValue)) { + return GcpProjectEnvironmentData.fromJson(readerToUse.reset()); + } else if ("GithubScope".equals(discriminatorValue)) { + return GithubScopeEnvironmentData.fromJson(readerToUse.reset()); + } else if ("AzureDevOpsScope".equals(discriminatorValue)) { + return AzureDevOpsScopeEnvironmentData.fromJson(readerToUse.reset()); + } else if ("GitlabScope".equals(discriminatorValue)) { + return GitlabScopeEnvironmentData.fromJson(readerToUse.reset()); + } else if ("DockerHubOrganization".equals(discriminatorValue)) { + return DockerHubEnvironmentData.fromJson(readerToUse.reset()); + } else if ("JFrogArtifactory".equals(discriminatorValue)) { + return JFrogEnvironmentData.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static EnvironmentData fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnvironmentData deserializedEnvironmentData = new EnvironmentData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("environmentType".equals(fieldName)) { + deserializedEnvironmentData.environmentType = EnvironmentType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEnvironmentData; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentDetails.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentDetails.java index 91bd70650ced..36507a405692 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentDetails.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentDetails.java @@ -5,41 +5,42 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The environment details of the resource. */ @Fluent -public final class EnvironmentDetails { +public final class EnvironmentDetails implements JsonSerializable { /* - * The native resource id of the resource (in case of Azure - the resource Id, in case of MC - the native resource id) + * The native resource id of the resource (in case of Azure - the resource Id, in case of MC - the native resource + * id) */ - @JsonProperty(value = "nativeResourceId") private String nativeResourceId; /* * The hierarchy id of the connector (in case of Azure - the subscription Id, in case of MC - the hierarchyId id) */ - @JsonProperty(value = "environmentHierarchyId") private String environmentHierarchyId; /* - * The organizational hierarchy id of the connector (in case of Azure - the subscription Id, in case of MC - the organizational hierarchyId id) + * The organizational hierarchy id of the connector (in case of Azure - the subscription Id, in case of MC - the + * organizational hierarchyId id) */ - @JsonProperty(value = "organizationalHierarchyId") private String organizationalHierarchyId; /* * The subscription Id */ - @JsonProperty(value = "subscriptionId") private String subscriptionId; /* * The tenant Id */ - @JsonProperty(value = "tenantId") private String tenantId; /** @@ -161,4 +162,52 @@ public EnvironmentDetails withTenantId(String tenantId) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nativeResourceId", this.nativeResourceId); + jsonWriter.writeStringField("environmentHierarchyId", this.environmentHierarchyId); + jsonWriter.writeStringField("organizationalHierarchyId", this.organizationalHierarchyId); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("tenantId", this.tenantId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnvironmentDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnvironmentDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EnvironmentDetails. + */ + public static EnvironmentDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnvironmentDetails deserializedEnvironmentDetails = new EnvironmentDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nativeResourceId".equals(fieldName)) { + deserializedEnvironmentDetails.nativeResourceId = reader.getString(); + } else if ("environmentHierarchyId".equals(fieldName)) { + deserializedEnvironmentDetails.environmentHierarchyId = reader.getString(); + } else if ("organizationalHierarchyId".equals(fieldName)) { + deserializedEnvironmentDetails.organizationalHierarchyId = reader.getString(); + } else if ("subscriptionId".equals(fieldName)) { + deserializedEnvironmentDetails.subscriptionId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedEnvironmentDetails.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnvironmentDetails; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentType.java index 406dc205abf5..85931d7c25f0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentType.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EnvironmentType.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,6 +36,16 @@ public final class EnvironmentType extends ExpandableStringEnum */ public static final EnvironmentType GITLAB_SCOPE = fromString("GitlabScope"); + /** + * Static value DockerHubOrganization for EnvironmentType. + */ + public static final EnvironmentType DOCKER_HUB_ORGANIZATION = fromString("DockerHubOrganization"); + + /** + * Static value JFrogArtifactory for EnvironmentType. + */ + public static final EnvironmentType JFROG_ARTIFACTORY = fromString("JFrogArtifactory"); + /** * Creates a new instance of EnvironmentType value. * @@ -52,7 +61,6 @@ public EnvironmentType() { * @param name a name to look for. * @return the corresponding EnvironmentType. */ - @JsonCreator public static EnvironmentType fromString(String name) { return fromString(name, EnvironmentType.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Etag.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Etag.java index bf6efadba615..2e694c31bb26 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Etag.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Etag.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Entity tag is used for comparing two or more entities from the same requested resource. */ @Fluent -public class Etag { +public class Etag implements JsonSerializable { /* * Entity tag is used for comparing two or more entities from the same requested resource. */ - @JsonProperty(value = "etag") private String etag; /** @@ -51,4 +54,40 @@ public Etag withEtag(String etag) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("etag", this.etag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Etag from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Etag if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Etag. + */ + public static Etag fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Etag deserializedEtag = new Etag(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("etag".equals(fieldName)) { + deserializedEtag.etag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEtag; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java index ac6777138c5e..206d143e8984 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/EventSource.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -93,7 +92,6 @@ public EventSource() { * @param name a name to look for. * @return the corresponding EventSource. */ - @JsonCreator public static EventSource fromString(String name) { return fromString(name, EventSource.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExecuteGovernanceRuleParams.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExecuteGovernanceRuleParams.java index 3d62749f52d4..b95c220f8d30 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExecuteGovernanceRuleParams.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExecuteGovernanceRuleParams.java @@ -5,17 +5,20 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Governance rule execution parameters. */ @Fluent -public final class ExecuteGovernanceRuleParams { +public final class ExecuteGovernanceRuleParams implements JsonSerializable { /* * Describe if governance rule should be override */ - @JsonProperty(value = "override") private Boolean override; /** @@ -51,4 +54,40 @@ public ExecuteGovernanceRuleParams withOverride(Boolean override) { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("override", this.override); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExecuteGovernanceRuleParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExecuteGovernanceRuleParams if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExecuteGovernanceRuleParams. + */ + public static ExecuteGovernanceRuleParams fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExecuteGovernanceRuleParams deserializedExecuteGovernanceRuleParams = new ExecuteGovernanceRuleParams(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("override".equals(fieldName)) { + deserializedExecuteGovernanceRuleParams.override = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedExecuteGovernanceRuleParams; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExemptionCategory.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExemptionCategory.java new file mode 100644 index 000000000000..0eb21400df06 --- /dev/null +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExemptionCategory.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.security.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Exemption category of this assignment. + */ +public final class ExemptionCategory extends ExpandableStringEnum { + /** + * Static value waiver for ExemptionCategory. + */ + public static final ExemptionCategory WAIVER = fromString("waiver"); + + /** + * Static value mitigated for ExemptionCategory. + */ + public static final ExemptionCategory MITIGATED = fromString("mitigated"); + + /** + * Creates a new instance of ExemptionCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ExemptionCategory() { + } + + /** + * Creates or finds a ExemptionCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExemptionCategory. + */ + public static ExemptionCategory fromString(String name) { + return fromString(name, ExemptionCategory.class); + } + + /** + * Gets known ExemptionCategory values. + * + * @return known ExemptionCategory values. + */ + public static Collection values() { + return values(ExemptionCategory.class); + } +} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandControlsEnum.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandControlsEnum.java index 346c4c40f240..60f003888de5 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandControlsEnum.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandControlsEnum.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public ExpandControlsEnum() { * @param name a name to look for. * @return the corresponding ExpandControlsEnum. */ - @JsonCreator public static ExpandControlsEnum fromString(String name) { return fromString(name, ExpandControlsEnum.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandEnum.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandEnum.java index e47ff3a294e6..3665c59728a7 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandEnum.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExpandEnum.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -37,7 +36,6 @@ public ExpandEnum() { * @param name a name to look for. * @return the corresponding ExpandEnum. */ - @JsonCreator public static ExpandEnum fromString(String name) { return fromString(name, ExpandEnum.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExportData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExportData.java index b44944af9bef..b2f2bb22ba6e 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExportData.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExportData.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -32,7 +31,6 @@ public ExportData() { * @param name a name to look for. * @return the corresponding ExportData. */ - @JsonCreator public static ExportData fromString(String name) { return fromString(name, ExportData.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Extension.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Extension.java index a6f0e392bfc4..c67c672c2e89 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Extension.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/Extension.java @@ -6,42 +6,70 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; /** * A plan's extension properties. */ @Fluent -public final class Extension { +public final class Extension implements JsonSerializable { /* - * The extension name. Supported values are:

**AgentlessDiscoveryForKubernetes** - API-based discovery of information about Kubernetes cluster architecture, workload objects, and setup. Required for Kubernetes inventory, identity and network exposure detection, attack path analysis and risk hunting as part of the cloud security explorer. - * Available for CloudPosture plan.

**OnUploadMalwareScanning** - Limits the GB to be scanned per month for each storage account within the subscription. Once this limit reached on a given storage account, Blobs won't be scanned during current calendar month. - * Available for StorageAccounts plan.

**SensitiveDataDiscovery** - Sensitive data discovery identifies Blob storage container with sensitive data such as credentials, credit cards, and more, to help prioritize and investigate security events. - * Available for StorageAccounts and CloudPosture plans.

**ContainerRegistriesVulnerabilityAssessments** - Provides vulnerability management for images stored in your container registries. - * Available for CloudPosture and Containers plans. + * The extension name. Supported values are:

**AgentlessDiscoveryForKubernetes** - Provides zero footprint, + * API-based discovery of Kubernetes clusters, their configurations and deployments. The collected data is used to + * create a contextualized security graph for Kubernetes clusters, provide risk hunting capabilities, and visualize + * risks and threats to Kubernetes environments and workloads.
Available for CloudPosture plan and Containers + * plan.

**OnUploadMalwareScanning** - Limits the GB to be scanned per month for each storage account within + * the subscription. Once this limit reached on a given storage account, Blobs won't be scanned during current + * calendar month.
Available for StorageAccounts plan (DefenderForStorageV2 sub + * plans).

**SensitiveDataDiscovery** - Sensitive data discovery identifies Blob storage container with + * sensitive data such as credentials, credit cards, and more, to help prioritize and investigate security + * events.
Available for StorageAccounts plan (DefenderForStorageV2 sub plan) and CloudPosture + * plan.

**ContainerRegistriesVulnerabilityAssessments** - Provides vulnerability management for images + * stored in your container registries.
Available for CloudPosture plan and Containers + * plan.

**MdeDesignatedSubscription** - Direct onboarding is a seamless integration between Defender for + * Endpoint and Defender for Cloud that doesn’t require extra software deployment on your servers. The onboarded + * resources will be presented under a designated Azure Subscription you configure
Available for VirtualMachines + * plan (P1 and P2 sub plans).

**AgentlessVmScanning** - Scans your machines for installed software, + * vulnerabilities, malware and secret scanning without relying on agents or impacting machine performance. Learn + * more here + * https://learn.microsoft.com/en-us/azure/defender-for-cloud/concept-agentless-data-collection.
Available for + * CloudPosture plan, VirtualMachines plan (P2 sub plan) and Containers plan.

**EntraPermissionsManagement** + * - Permissions Management provides Cloud Infrastructure Entitlement Management (CIEM) capabilities that helps + * organizations to manage and control user access and entitlements in their cloud infrastructure - important attack + * vector for cloud environments.
Permissions Management analyzes all permissions and active usage, and suggests + * recommendations to reduce permissions to enforce the principle of least privilege. Learn more here + * https://learn.microsoft.com/en-us/azure/defender-for-cloud/permissions-management.
Available for CloudPosture + * plan.

**FileIntegrityMonitoring** - File integrity monitoring (FIM), examines operating system + * files.
Windows registries, Linux system files, in real time, for changes that might indicate an + * attack.
Available for VirtualMachines plan (P2 sub plan).

**ContainerSensor** - The sensor is based on + * IG and provides a rich threat detection suite for Kubernetes clusters, nodes, and workloads, powered by Microsoft + * leading threat intelligence, provides mapping to MITRE ATT&CK framework.
Available for Containers plan. + *

**AIPromptEvidence** - Exposes the prompts passed between the user and the AI model as alert evidence. + * This helps classify and triage the alerts with relevant user context. The prompt snippets will include only + * segments of the user prompt or model response that were deemed suspicious and relevant for security + * classifications. The prompt evidence will be available through Defender portal as part of each + * alert.
Available for AI plan.

*/ - @JsonProperty(value = "name", required = true) private String name; /* * Indicates whether the extension is enabled. */ - @JsonProperty(value = "isEnabled", required = true) private IsEnabled isEnabled; /* * Property values associated with the extension. */ - @JsonProperty(value = "additionalExtensionProperties") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map additionalExtensionProperties; /* * Optional. A status describing the success/failure of the extension's enablement/disablement operation. */ - @JsonProperty(value = "operationStatus", access = JsonProperty.Access.WRITE_ONLY) private OperationStatusAutoGenerated operationStatus; /** @@ -52,19 +80,42 @@ public Extension() { /** * Get the name property: The extension name. Supported values are: - * <br><br>**AgentlessDiscoveryForKubernetes** - API-based discovery of information about Kubernetes - * cluster architecture, workload objects, and setup. Required for Kubernetes inventory, identity and network - * exposure detection, attack path analysis and risk hunting as part of the cloud security explorer. - * Available for CloudPosture plan.<br><br>**OnUploadMalwareScanning** - Limits the GB to be scanned per - * month for each storage account within the subscription. Once this limit reached on a given storage account, Blobs - * won't be scanned during current calendar month. - * Available for StorageAccounts plan.<br><br>**SensitiveDataDiscovery** - Sensitive data discovery - * identifies Blob storage container with sensitive data such as credentials, credit cards, and more, to help - * prioritize and investigate security events. - * Available for StorageAccounts and CloudPosture - * plans.<br><br>**ContainerRegistriesVulnerabilityAssessments** - Provides vulnerability management for - * images stored in your container registries. - * Available for CloudPosture and Containers plans. + * <br><br>**AgentlessDiscoveryForKubernetes** - Provides zero footprint, API-based discovery of + * Kubernetes clusters, their configurations and deployments. The collected data is used to create a contextualized + * security graph for Kubernetes clusters, provide risk hunting capabilities, and visualize risks and threats to + * Kubernetes environments and workloads.<br>Available for CloudPosture plan and Containers + * plan.<br><br>**OnUploadMalwareScanning** - Limits the GB to be scanned per month for each storage + * account within the subscription. Once this limit reached on a given storage account, Blobs won't be scanned + * during current calendar month.<br>Available for StorageAccounts plan (DefenderForStorageV2 sub + * plans).<br><br>**SensitiveDataDiscovery** - Sensitive data discovery identifies Blob storage + * container with sensitive data such as credentials, credit cards, and more, to help prioritize and investigate + * security events.<br>Available for StorageAccounts plan (DefenderForStorageV2 sub plan) and CloudPosture + * plan.<br><br>**ContainerRegistriesVulnerabilityAssessments** - Provides vulnerability management for + * images stored in your container registries.<br>Available for CloudPosture plan and Containers + * plan.<br><br>**MdeDesignatedSubscription** - Direct onboarding is a seamless integration between + * Defender for Endpoint and Defender for Cloud that doesn’t require extra software deployment on your servers. The + * onboarded resources will be presented under a designated Azure Subscription you configure<br>Available for + * VirtualMachines plan (P1 and P2 sub plans).<br><br>**AgentlessVmScanning** - Scans your machines for + * installed software, vulnerabilities, malware and secret scanning without relying on agents or impacting machine + * performance. Learn more here + * https://learn.microsoft.com/en-us/azure/defender-for-cloud/concept-agentless-data-collection.<br>Available + * for CloudPosture plan, VirtualMachines plan (P2 sub plan) and Containers + * plan.<br><br>**EntraPermissionsManagement** - Permissions Management provides Cloud Infrastructure + * Entitlement Management (CIEM) capabilities that helps organizations to manage and control user access and + * entitlements in their cloud infrastructure - important attack vector for cloud environments.<br>Permissions + * Management analyzes all permissions and active usage, and suggests recommendations to reduce permissions to + * enforce the principle of least privilege. Learn more here + * https://learn.microsoft.com/en-us/azure/defender-for-cloud/permissions-management.<br>Available for + * CloudPosture plan. <br><br>**FileIntegrityMonitoring** - File integrity monitoring (FIM), examines + * operating system files.<br>Windows registries, Linux system files, in real time, for changes that might + * indicate an attack.<br>Available for VirtualMachines plan (P2 sub plan). + * <br><br>**ContainerSensor** - The sensor is based on IG and provides a rich threat detection suite + * for Kubernetes clusters, nodes, and workloads, powered by Microsoft leading threat intelligence, provides mapping + * to MITRE ATT&CK framework.<br>Available for Containers plan. <br><br>**AIPromptEvidence** - + * Exposes the prompts passed between the user and the AI model as alert evidence. This helps classify and triage + * the alerts with relevant user context. The prompt snippets will include only segments of the user prompt or model + * response that were deemed suspicious and relevant for security classifications. The prompt evidence will be + * available through Defender portal as part of each alert.<br>Available for AI plan. <br><br>. * * @return the name value. */ @@ -74,19 +125,42 @@ public String name() { /** * Set the name property: The extension name. Supported values are: - * <br><br>**AgentlessDiscoveryForKubernetes** - API-based discovery of information about Kubernetes - * cluster architecture, workload objects, and setup. Required for Kubernetes inventory, identity and network - * exposure detection, attack path analysis and risk hunting as part of the cloud security explorer. - * Available for CloudPosture plan.<br><br>**OnUploadMalwareScanning** - Limits the GB to be scanned per - * month for each storage account within the subscription. Once this limit reached on a given storage account, Blobs - * won't be scanned during current calendar month. - * Available for StorageAccounts plan.<br><br>**SensitiveDataDiscovery** - Sensitive data discovery - * identifies Blob storage container with sensitive data such as credentials, credit cards, and more, to help - * prioritize and investigate security events. - * Available for StorageAccounts and CloudPosture - * plans.<br><br>**ContainerRegistriesVulnerabilityAssessments** - Provides vulnerability management for - * images stored in your container registries. - * Available for CloudPosture and Containers plans. + * <br><br>**AgentlessDiscoveryForKubernetes** - Provides zero footprint, API-based discovery of + * Kubernetes clusters, their configurations and deployments. The collected data is used to create a contextualized + * security graph for Kubernetes clusters, provide risk hunting capabilities, and visualize risks and threats to + * Kubernetes environments and workloads.<br>Available for CloudPosture plan and Containers + * plan.<br><br>**OnUploadMalwareScanning** - Limits the GB to be scanned per month for each storage + * account within the subscription. Once this limit reached on a given storage account, Blobs won't be scanned + * during current calendar month.<br>Available for StorageAccounts plan (DefenderForStorageV2 sub + * plans).<br><br>**SensitiveDataDiscovery** - Sensitive data discovery identifies Blob storage + * container with sensitive data such as credentials, credit cards, and more, to help prioritize and investigate + * security events.<br>Available for StorageAccounts plan (DefenderForStorageV2 sub plan) and CloudPosture + * plan.<br><br>**ContainerRegistriesVulnerabilityAssessments** - Provides vulnerability management for + * images stored in your container registries.<br>Available for CloudPosture plan and Containers + * plan.<br><br>**MdeDesignatedSubscription** - Direct onboarding is a seamless integration between + * Defender for Endpoint and Defender for Cloud that doesn’t require extra software deployment on your servers. The + * onboarded resources will be presented under a designated Azure Subscription you configure<br>Available for + * VirtualMachines plan (P1 and P2 sub plans).<br><br>**AgentlessVmScanning** - Scans your machines for + * installed software, vulnerabilities, malware and secret scanning without relying on agents or impacting machine + * performance. Learn more here + * https://learn.microsoft.com/en-us/azure/defender-for-cloud/concept-agentless-data-collection.<br>Available + * for CloudPosture plan, VirtualMachines plan (P2 sub plan) and Containers + * plan.<br><br>**EntraPermissionsManagement** - Permissions Management provides Cloud Infrastructure + * Entitlement Management (CIEM) capabilities that helps organizations to manage and control user access and + * entitlements in their cloud infrastructure - important attack vector for cloud environments.<br>Permissions + * Management analyzes all permissions and active usage, and suggests recommendations to reduce permissions to + * enforce the principle of least privilege. Learn more here + * https://learn.microsoft.com/en-us/azure/defender-for-cloud/permissions-management.<br>Available for + * CloudPosture plan. <br><br>**FileIntegrityMonitoring** - File integrity monitoring (FIM), examines + * operating system files.<br>Windows registries, Linux system files, in real time, for changes that might + * indicate an attack.<br>Available for VirtualMachines plan (P2 sub plan). + * <br><br>**ContainerSensor** - The sensor is based on IG and provides a rich threat detection suite + * for Kubernetes clusters, nodes, and workloads, powered by Microsoft leading threat intelligence, provides mapping + * to MITRE ATT&CK framework.<br>Available for Containers plan. <br><br>**AIPromptEvidence** - + * Exposes the prompts passed between the user and the AI model as alert evidence. This helps classify and triage + * the alerts with relevant user context. The prompt snippets will include only segments of the user prompt or model + * response that were deemed suspicious and relevant for security classifications. The prompt evidence will be + * available through Defender portal as part of each alert.<br>Available for AI plan. <br><br>. * * @param name the name value to set. * @return the Extension object itself. @@ -166,4 +240,52 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(Extension.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("isEnabled", this.isEnabled == null ? null : this.isEnabled.toString()); + jsonWriter.writeMapField("additionalExtensionProperties", this.additionalExtensionProperties, + (writer, element) -> writer.writeUntyped(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Extension from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Extension if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Extension. + */ + public static Extension fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Extension deserializedExtension = new Extension(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedExtension.name = reader.getString(); + } else if ("isEnabled".equals(fieldName)) { + deserializedExtension.isEnabled = IsEnabled.fromString(reader.getString()); + } else if ("additionalExtensionProperties".equals(fieldName)) { + Map additionalExtensionProperties + = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedExtension.additionalExtensionProperties = additionalExtensionProperties; + } else if ("operationStatus".equals(fieldName)) { + deserializedExtension.operationStatus = OperationStatusAutoGenerated.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExtension; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionKind.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionKind.java index 974e187fc666..fa8311eb8b57 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionKind.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionKind.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.security.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -42,7 +41,6 @@ public ExternalSecuritySolutionKind() { * @param name a name to look for. * @return the corresponding ExternalSecuritySolutionKind. */ - @JsonCreator public static ExternalSecuritySolutionKind fromString(String name) { return fromString(name, ExternalSecuritySolutionKind.class); } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionList.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionList.java index 0a2ddc31fdc7..d0a9f510e379 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionList.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionList.java @@ -5,25 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.security.fluent.models.ExternalSecuritySolutionInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; /** * The ExternalSecuritySolutionList model. */ @Fluent -public final class ExternalSecuritySolutionList { +public final class ExternalSecuritySolutionList implements JsonSerializable { /* * The value property. */ - @JsonProperty(value = "value") private List value; /* * The URI to fetch the next page. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; /** @@ -71,4 +73,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExternalSecuritySolutionList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExternalSecuritySolutionList if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExternalSecuritySolutionList. + */ + public static ExternalSecuritySolutionList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExternalSecuritySolutionList deserializedExternalSecuritySolutionList = new ExternalSecuritySolutionList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ExternalSecuritySolutionInner.fromJson(reader1)); + deserializedExternalSecuritySolutionList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedExternalSecuritySolutionList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExternalSecuritySolutionList; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionProperties.java index 94dffbf88a94..9de1c6b32a39 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/ExternalSecuritySolutionProperties.java @@ -5,40 +5,37 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashMap; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; import java.util.Map; /** * The solution properties (correspond to the solution kind). */ @Fluent -public class ExternalSecuritySolutionProperties { +public class ExternalSecuritySolutionProperties implements JsonSerializable { /* * The deviceVendor property. */ - @JsonProperty(value = "deviceVendor") private String deviceVendor; /* * The deviceType property. */ - @JsonProperty(value = "deviceType") private String deviceType; /* * Represents an OMS workspace to which the solution is connected */ - @JsonProperty(value = "workspace") private ConnectedWorkspace workspace; /* * The solution properties (correspond to the solution kind) */ - @JsonIgnore private Map additionalProperties; /** @@ -112,7 +109,6 @@ public ExternalSecuritySolutionProperties withWorkspace(ConnectedWorkspace works * * @return the additionalProperties value. */ - @JsonAnyGetter public Map additionalProperties() { return this.additionalProperties; } @@ -128,14 +124,6 @@ public ExternalSecuritySolutionProperties withAdditionalProperties(Map(); - } - additionalProperties.put(key, value); - } - /** * Validates the instance. * @@ -146,4 +134,58 @@ public void validate() { workspace().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deviceVendor", this.deviceVendor); + jsonWriter.writeStringField("deviceType", this.deviceType); + jsonWriter.writeJsonField("workspace", this.workspace); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExternalSecuritySolutionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExternalSecuritySolutionProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExternalSecuritySolutionProperties. + */ + public static ExternalSecuritySolutionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExternalSecuritySolutionProperties deserializedExternalSecuritySolutionProperties + = new ExternalSecuritySolutionProperties(); + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deviceVendor".equals(fieldName)) { + deserializedExternalSecuritySolutionProperties.deviceVendor = reader.getString(); + } else if ("deviceType".equals(fieldName)) { + deserializedExternalSecuritySolutionProperties.deviceType = reader.getString(); + } else if ("workspace".equals(fieldName)) { + deserializedExternalSecuritySolutionProperties.workspace = ConnectedWorkspace.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.readUntyped()); + } + } + deserializedExternalSecuritySolutionProperties.additionalProperties = additionalProperties; + + return deserializedExternalSecuritySolutionProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FailedLocalLoginsNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FailedLocalLoginsNotInAllowedRange.java index 2751d9a14ea6..8c34bf3f682c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FailedLocalLoginsNotInAllowedRange.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FailedLocalLoginsNotInAllowedRange.java @@ -5,28 +5,22 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; /** * Number of failed local logins is not in allowed range. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = FailedLocalLoginsNotInAllowedRange.class, - visible = true) -@JsonTypeName("FailedLocalLoginsNotInAllowedRange") @Fluent public final class FailedLocalLoginsNotInAllowedRange extends TimeWindowCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "FailedLocalLoginsNotInAllowedRange"; /** @@ -88,6 +82,67 @@ public FailedLocalLoginsNotInAllowedRange withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); + if (timeWindowSize() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeWindowSize in model FailedLocalLoginsNotInAllowedRange")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailedLocalLoginsNotInAllowedRange.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeIntField("minThreshold", minThreshold()); + jsonWriter.writeIntField("maxThreshold", maxThreshold()); + jsonWriter.writeStringField("timeWindowSize", CoreUtils.durationToStringWithDays(timeWindowSize())); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FailedLocalLoginsNotInAllowedRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FailedLocalLoginsNotInAllowedRange if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FailedLocalLoginsNotInAllowedRange. + */ + public static FailedLocalLoginsNotInAllowedRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FailedLocalLoginsNotInAllowedRange deserializedFailedLocalLoginsNotInAllowedRange + = new FailedLocalLoginsNotInAllowedRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedFailedLocalLoginsNotInAllowedRange.withIsEnabled(reader.getBoolean()); + } else if ("minThreshold".equals(fieldName)) { + deserializedFailedLocalLoginsNotInAllowedRange.withMinThreshold(reader.getInt()); + } else if ("maxThreshold".equals(fieldName)) { + deserializedFailedLocalLoginsNotInAllowedRange.withMaxThreshold(reader.getInt()); + } else if ("timeWindowSize".equals(fieldName)) { + deserializedFailedLocalLoginsNotInAllowedRange.withTimeWindowSize( + reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()))); + } else if ("displayName".equals(fieldName)) { + deserializedFailedLocalLoginsNotInAllowedRange.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedFailedLocalLoginsNotInAllowedRange.withDescription(reader.getString()); + } else if ("ruleType".equals(fieldName)) { + deserializedFailedLocalLoginsNotInAllowedRange.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFailedLocalLoginsNotInAllowedRange; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileType.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileType.java deleted file mode 100644 index 3873d1fd88c4..000000000000 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileType.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.security.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * The type of the file (for Linux files - Executable is used). - */ -public final class FileType extends ExpandableStringEnum { - /** - * Static value Exe for FileType. - */ - public static final FileType EXE = fromString("Exe"); - - /** - * Static value Dll for FileType. - */ - public static final FileType DLL = fromString("Dll"); - - /** - * Static value Msi for FileType. - */ - public static final FileType MSI = fromString("Msi"); - - /** - * Static value Script for FileType. - */ - public static final FileType SCRIPT = fromString("Script"); - - /** - * Static value Executable for FileType. - */ - public static final FileType EXECUTABLE = fromString("Executable"); - - /** - * Static value Unknown for FileType. - */ - public static final FileType UNKNOWN = fromString("Unknown"); - - /** - * Creates a new instance of FileType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public FileType() { - } - - /** - * Creates or finds a FileType from its string representation. - * - * @param name a name to look for. - * @return the corresponding FileType. - */ - @JsonCreator - public static FileType fromString(String name) { - return fromString(name, FileType.class); - } - - /** - * Gets known FileType values. - * - * @return known FileType values. - */ - public static Collection values() { - return values(FileType.class); - } -} diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileUploadsNotInAllowedRange.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileUploadsNotInAllowedRange.java index f4147194bcd2..e1dfabcc7e32 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileUploadsNotInAllowedRange.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/FileUploadsNotInAllowedRange.java @@ -5,28 +5,22 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.Duration; /** * Number of file uploads is not in allowed range. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "ruleType", - defaultImpl = FileUploadsNotInAllowedRange.class, - visible = true) -@JsonTypeName("FileUploadsNotInAllowedRange") @Fluent public final class FileUploadsNotInAllowedRange extends TimeWindowCustomAlertRule { /* * The type of the custom alert rule. */ - @JsonTypeId - @JsonProperty(value = "ruleType", required = true) private String ruleType = "FileUploadsNotInAllowedRange"; /** @@ -88,6 +82,66 @@ public FileUploadsNotInAllowedRange withIsEnabled(boolean isEnabled) { */ @Override public void validate() { - super.validate(); + if (timeWindowSize() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeWindowSize in model FileUploadsNotInAllowedRange")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FileUploadsNotInAllowedRange.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isEnabled", isEnabled()); + jsonWriter.writeIntField("minThreshold", minThreshold()); + jsonWriter.writeIntField("maxThreshold", maxThreshold()); + jsonWriter.writeStringField("timeWindowSize", CoreUtils.durationToStringWithDays(timeWindowSize())); + jsonWriter.writeStringField("ruleType", this.ruleType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileUploadsNotInAllowedRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileUploadsNotInAllowedRange if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileUploadsNotInAllowedRange. + */ + public static FileUploadsNotInAllowedRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileUploadsNotInAllowedRange deserializedFileUploadsNotInAllowedRange = new FileUploadsNotInAllowedRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isEnabled".equals(fieldName)) { + deserializedFileUploadsNotInAllowedRange.withIsEnabled(reader.getBoolean()); + } else if ("minThreshold".equals(fieldName)) { + deserializedFileUploadsNotInAllowedRange.withMinThreshold(reader.getInt()); + } else if ("maxThreshold".equals(fieldName)) { + deserializedFileUploadsNotInAllowedRange.withMaxThreshold(reader.getInt()); + } else if ("timeWindowSize".equals(fieldName)) { + deserializedFileUploadsNotInAllowedRange.withTimeWindowSize( + reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()))); + } else if ("displayName".equals(fieldName)) { + deserializedFileUploadsNotInAllowedRange.withDisplayName(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedFileUploadsNotInAllowedRange.withDescription(reader.getString()); + } else if ("ruleType".equals(fieldName)) { + deserializedFileUploadsNotInAllowedRange.ruleType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFileUploadsNotInAllowedRange; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpCredentialsDetailsProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpCredentialsDetailsProperties.java index 1ba27636d96a..33a99060890c 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpCredentialsDetailsProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpCredentialsDetailsProperties.java @@ -6,94 +6,77 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; /** * GCP cloud account connector based service to service credentials, the credentials are composed of the organization ID * and a JSON API key (write only). */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "authenticationType", - defaultImpl = GcpCredentialsDetailsProperties.class, - visible = true) -@JsonTypeName("gcpCredentials") @Fluent public final class GcpCredentialsDetailsProperties extends AuthenticationDetailsProperties { /* - * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use account organization credentials. + * Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use + * account organization credentials. */ - @JsonTypeId - @JsonProperty(value = "authenticationType", required = true) private AuthenticationType authenticationType = AuthenticationType.GCP_CREDENTIALS; /* * The organization ID of the GCP cloud account */ - @JsonProperty(value = "organizationId", required = true) private String organizationId; /* * Type field of the API key (write only) */ - @JsonProperty(value = "type", required = true) private String type; /* * Project ID field of the API key (write only) */ - @JsonProperty(value = "projectId", required = true) private String projectId; /* * Private key ID field of the API key (write only) */ - @JsonProperty(value = "privateKeyId", required = true) private String privateKeyId; /* * Private key field of the API key (write only) */ - @JsonProperty(value = "privateKey", required = true) private String privateKey; /* * Client email field of the API key (write only) */ - @JsonProperty(value = "clientEmail", required = true) private String clientEmail; /* * Client ID field of the API key (write only) */ - @JsonProperty(value = "clientId", required = true) private String clientId; /* * Auth URI field of the API key (write only) */ - @JsonProperty(value = "authUri", required = true) private String authUri; /* * Token URI field of the API key (write only) */ - @JsonProperty(value = "tokenUri", required = true) private String tokenUri; /* * Auth provider x509 certificate URL field of the API key (write only) */ - @JsonProperty(value = "authProviderX509CertUrl", required = true) private String authProviderX509CertUrl; /* * Client x509 certificate URL field of the API key (write only) */ - @JsonProperty(value = "clientX509CertUrl", required = true) private String clientX509CertUrl; /** @@ -340,7 +323,6 @@ public GcpCredentialsDetailsProperties withClientX509CertUrl(String clientX509Ce */ @Override public void validate() { - super.validate(); if (organizationId() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( @@ -399,4 +381,84 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(GcpCredentialsDetailsProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("organizationId", this.organizationId); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("projectId", this.projectId); + jsonWriter.writeStringField("privateKeyId", this.privateKeyId); + jsonWriter.writeStringField("privateKey", this.privateKey); + jsonWriter.writeStringField("clientEmail", this.clientEmail); + jsonWriter.writeStringField("clientId", this.clientId); + jsonWriter.writeStringField("authUri", this.authUri); + jsonWriter.writeStringField("tokenUri", this.tokenUri); + jsonWriter.writeStringField("authProviderX509CertUrl", this.authProviderX509CertUrl); + jsonWriter.writeStringField("clientX509CertUrl", this.clientX509CertUrl); + jsonWriter.writeStringField("authenticationType", + this.authenticationType == null ? null : this.authenticationType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpCredentialsDetailsProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpCredentialsDetailsProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GcpCredentialsDetailsProperties. + */ + public static GcpCredentialsDetailsProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpCredentialsDetailsProperties deserializedGcpCredentialsDetailsProperties + = new GcpCredentialsDetailsProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("authenticationProvisioningState".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.withAuthenticationProvisioningState( + AuthenticationProvisioningState.fromString(reader.getString())); + } else if ("grantedPermissions".equals(fieldName)) { + List grantedPermissions + = reader.readArray(reader1 -> PermissionProperty.fromString(reader1.getString())); + deserializedGcpCredentialsDetailsProperties.withGrantedPermissions(grantedPermissions); + } else if ("organizationId".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.organizationId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.type = reader.getString(); + } else if ("projectId".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.projectId = reader.getString(); + } else if ("privateKeyId".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.privateKeyId = reader.getString(); + } else if ("privateKey".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.privateKey = reader.getString(); + } else if ("clientEmail".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.clientEmail = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.clientId = reader.getString(); + } else if ("authUri".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.authUri = reader.getString(); + } else if ("tokenUri".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.tokenUri = reader.getString(); + } else if ("authProviderX509CertUrl".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.authProviderX509CertUrl = reader.getString(); + } else if ("clientX509CertUrl".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.clientX509CertUrl = reader.getString(); + } else if ("authenticationType".equals(fieldName)) { + deserializedGcpCredentialsDetailsProperties.authenticationType + = AuthenticationType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpCredentialsDetailsProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalData.java index 0b0cf4bb62d4..258cb7ae1525 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalData.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalData.java @@ -5,38 +5,27 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The gcpOrganization data. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "organizationMembershipType", - defaultImpl = GcpOrganizationalData.class, - visible = true) -@JsonTypeName("GcpOrganizationalData") -@JsonSubTypes({ - @JsonSubTypes.Type(name = "Organization", value = GcpOrganizationalDataOrganization.class), - @JsonSubTypes.Type(name = "Member", value = GcpOrganizationalDataMember.class) }) @Immutable -public class GcpOrganizationalData { +public class GcpOrganizationalData implements JsonSerializable { /* * The multi cloud account's membership type in the organization */ - @JsonTypeId - @JsonProperty(value = "organizationMembershipType", required = true) - private OrganizationMembershipType organizationMembershipType; + private OrganizationMembershipType organizationMembershipType + = OrganizationMembershipType.fromString("GcpOrganizationalData"); /** * Creates an instance of GcpOrganizationalData class. */ public GcpOrganizationalData() { - this.organizationMembershipType = OrganizationMembershipType.fromString("GcpOrganizationalData"); } /** @@ -55,4 +44,69 @@ public OrganizationMembershipType organizationMembershipType() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("organizationMembershipType", + this.organizationMembershipType == null ? null : this.organizationMembershipType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpOrganizationalData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpOrganizationalData if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the GcpOrganizationalData. + */ + public static GcpOrganizationalData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("organizationMembershipType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Organization".equals(discriminatorValue)) { + return GcpOrganizationalDataOrganization.fromJson(readerToUse.reset()); + } else if ("Member".equals(discriminatorValue)) { + return GcpOrganizationalDataMember.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static GcpOrganizationalData fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpOrganizationalData deserializedGcpOrganizationalData = new GcpOrganizationalData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("organizationMembershipType".equals(fieldName)) { + deserializedGcpOrganizationalData.organizationMembershipType + = OrganizationMembershipType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpOrganizationalData; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataMember.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataMember.java index f557c7877989..fcd7170df607 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataMember.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataMember.java @@ -5,39 +5,29 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The gcpOrganization data for the member account. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "organizationMembershipType", - defaultImpl = GcpOrganizationalDataMember.class, - visible = true) -@JsonTypeName("Member") @Fluent public final class GcpOrganizationalDataMember extends GcpOrganizationalData { /* * The multi cloud account's membership type in the organization */ - @JsonTypeId - @JsonProperty(value = "organizationMembershipType", required = true) private OrganizationMembershipType organizationMembershipType = OrganizationMembershipType.MEMBER; /* * If the multi cloud account is not of membership type organization, this will be the ID of the project's parent */ - @JsonProperty(value = "parentHierarchyId") private String parentHierarchyId; /* * The GCP management project number from organizational onboarding */ - @JsonProperty(value = "managementProjectNumber") private String managementProjectNumber; /** @@ -105,6 +95,49 @@ public GcpOrganizationalDataMember withManagementProjectNumber(String management */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("organizationMembershipType", + this.organizationMembershipType == null ? null : this.organizationMembershipType.toString()); + jsonWriter.writeStringField("parentHierarchyId", this.parentHierarchyId); + jsonWriter.writeStringField("managementProjectNumber", this.managementProjectNumber); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpOrganizationalDataMember from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpOrganizationalDataMember if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GcpOrganizationalDataMember. + */ + public static GcpOrganizationalDataMember fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpOrganizationalDataMember deserializedGcpOrganizationalDataMember = new GcpOrganizationalDataMember(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("organizationMembershipType".equals(fieldName)) { + deserializedGcpOrganizationalDataMember.organizationMembershipType + = OrganizationMembershipType.fromString(reader.getString()); + } else if ("parentHierarchyId".equals(fieldName)) { + deserializedGcpOrganizationalDataMember.parentHierarchyId = reader.getString(); + } else if ("managementProjectNumber".equals(fieldName)) { + deserializedGcpOrganizationalDataMember.managementProjectNumber = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpOrganizationalDataMember; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataOrganization.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataOrganization.java index 1c587c6b84ea..2c8c07ef232b 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataOrganization.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpOrganizationalDataOrganization.java @@ -5,52 +5,41 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * The gcpOrganization data for the parent account. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "organizationMembershipType", - defaultImpl = GcpOrganizationalDataOrganization.class, - visible = true) -@JsonTypeName("Organization") @Fluent public final class GcpOrganizationalDataOrganization extends GcpOrganizationalData { /* * The multi cloud account's membership type in the organization */ - @JsonTypeId - @JsonProperty(value = "organizationMembershipType", required = true) private OrganizationMembershipType organizationMembershipType = OrganizationMembershipType.ORGANIZATION; /* * If the multi cloud account is of membership type organization, list of accounts excluded from offering */ - @JsonProperty(value = "excludedProjectNumbers") private List excludedProjectNumbers; /* * The service account email address which represents the organization level permissions container. */ - @JsonProperty(value = "serviceAccountEmailAddress") private String serviceAccountEmailAddress; /* - * The GCP workload identity provider id which represents the permissions required to auto provision security connectors + * The GCP workload identity provider id which represents the permissions required to auto provision security + * connectors */ - @JsonProperty(value = "workloadIdentityProviderId") private String workloadIdentityProviderId; /* * GCP organization name */ - @JsonProperty(value = "organizationName", access = JsonProperty.Access.WRITE_ONLY) private String organizationName; /** @@ -151,6 +140,57 @@ public String organizationName() { */ @Override public void validate() { - super.validate(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("organizationMembershipType", + this.organizationMembershipType == null ? null : this.organizationMembershipType.toString()); + jsonWriter.writeArrayField("excludedProjectNumbers", this.excludedProjectNumbers, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("serviceAccountEmailAddress", this.serviceAccountEmailAddress); + jsonWriter.writeStringField("workloadIdentityProviderId", this.workloadIdentityProviderId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpOrganizationalDataOrganization from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpOrganizationalDataOrganization if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GcpOrganizationalDataOrganization. + */ + public static GcpOrganizationalDataOrganization fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpOrganizationalDataOrganization deserializedGcpOrganizationalDataOrganization + = new GcpOrganizationalDataOrganization(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("organizationMembershipType".equals(fieldName)) { + deserializedGcpOrganizationalDataOrganization.organizationMembershipType + = OrganizationMembershipType.fromString(reader.getString()); + } else if ("excludedProjectNumbers".equals(fieldName)) { + List excludedProjectNumbers = reader.readArray(reader1 -> reader1.getString()); + deserializedGcpOrganizationalDataOrganization.excludedProjectNumbers = excludedProjectNumbers; + } else if ("serviceAccountEmailAddress".equals(fieldName)) { + deserializedGcpOrganizationalDataOrganization.serviceAccountEmailAddress = reader.getString(); + } else if ("workloadIdentityProviderId".equals(fieldName)) { + deserializedGcpOrganizationalDataOrganization.workloadIdentityProviderId = reader.getString(); + } else if ("organizationName".equals(fieldName)) { + deserializedGcpOrganizationalDataOrganization.organizationName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpOrganizationalDataOrganization; + }); } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectDetails.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectDetails.java index 45d89bb89da7..885ac4f9a2d0 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectDetails.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectDetails.java @@ -5,35 +5,35 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The details about the project represented by the security connector. */ @Fluent -public final class GcpProjectDetails { +public final class GcpProjectDetails implements JsonSerializable { /* * The unique GCP Project number */ - @JsonProperty(value = "projectNumber") private String projectNumber; /* * The GCP Project id */ - @JsonProperty(value = "projectId") private String projectId; /* * The GCP workload identity federation pool id */ - @JsonProperty(value = "workloadIdentityPoolId", access = JsonProperty.Access.WRITE_ONLY) private String workloadIdentityPoolId; /* * GCP project name */ - @JsonProperty(value = "projectName", access = JsonProperty.Access.WRITE_ONLY) private String projectName; /** @@ -107,4 +107,47 @@ public String projectName() { */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("projectNumber", this.projectNumber); + jsonWriter.writeStringField("projectId", this.projectId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpProjectDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpProjectDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the GcpProjectDetails. + */ + public static GcpProjectDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpProjectDetails deserializedGcpProjectDetails = new GcpProjectDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("projectNumber".equals(fieldName)) { + deserializedGcpProjectDetails.projectNumber = reader.getString(); + } else if ("projectId".equals(fieldName)) { + deserializedGcpProjectDetails.projectId = reader.getString(); + } else if ("workloadIdentityPoolId".equals(fieldName)) { + deserializedGcpProjectDetails.workloadIdentityPoolId = reader.getString(); + } else if ("projectName".equals(fieldName)) { + deserializedGcpProjectDetails.projectName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpProjectDetails; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectEnvironmentData.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectEnvironmentData.java index feb97e312efc..9a24e2439a12 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectEnvironmentData.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GcpProjectEnvironmentData.java @@ -5,45 +5,34 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeId; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The GCP project connector environment data. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "environmentType", - defaultImpl = GcpProjectEnvironmentData.class, - visible = true) -@JsonTypeName("GcpProject") @Fluent public final class GcpProjectEnvironmentData extends EnvironmentData { /* * The type of the environment data. */ - @JsonTypeId - @JsonProperty(value = "environmentType", required = true) private EnvironmentType environmentType = EnvironmentType.GCP_PROJECT; /* * The Gcp project's organizational data */ - @JsonProperty(value = "organizationalData") private GcpOrganizationalData organizationalData; /* * The Gcp project's details */ - @JsonProperty(value = "projectDetails") private GcpProjectDetails projectDetails; /* * Scan interval in hours (value should be between 1-hour to 24-hours) */ - @JsonProperty(value = "scanInterval") private Long scanInterval; /** @@ -129,7 +118,6 @@ public GcpProjectEnvironmentData withScanInterval(Long scanInterval) { */ @Override public void validate() { - super.validate(); if (organizationalData() != null) { organizationalData().validate(); } @@ -137,4 +125,51 @@ public void validate() { projectDetails().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("environmentType", + this.environmentType == null ? null : this.environmentType.toString()); + jsonWriter.writeJsonField("organizationalData", this.organizationalData); + jsonWriter.writeJsonField("projectDetails", this.projectDetails); + jsonWriter.writeNumberField("scanInterval", this.scanInterval); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GcpProjectEnvironmentData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GcpProjectEnvironmentData if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GcpProjectEnvironmentData. + */ + public static GcpProjectEnvironmentData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GcpProjectEnvironmentData deserializedGcpProjectEnvironmentData = new GcpProjectEnvironmentData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("environmentType".equals(fieldName)) { + deserializedGcpProjectEnvironmentData.environmentType + = EnvironmentType.fromString(reader.getString()); + } else if ("organizationalData".equals(fieldName)) { + deserializedGcpProjectEnvironmentData.organizationalData = GcpOrganizationalData.fromJson(reader); + } else if ("projectDetails".equals(fieldName)) { + deserializedGcpProjectEnvironmentData.projectDetails = GcpProjectDetails.fromJson(reader); + } else if ("scanInterval".equals(fieldName)) { + deserializedGcpProjectEnvironmentData.scanInterval = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedGcpProjectEnvironmentData; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponseProperties.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponseProperties.java index 4b60c59855ed..8d9ded012d3a 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponseProperties.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponseProperties.java @@ -5,37 +5,40 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; +import java.util.Objects; import java.util.UUID; /** * The sensitivity settings properties. */ @Fluent -public final class GetSensitivitySettingsResponseProperties { +public final class GetSensitivitySettingsResponseProperties + implements JsonSerializable { /* * List of selected sensitive info types' IDs. */ - @JsonProperty(value = "sensitiveInfoTypesIds") private List sensitiveInfoTypesIds; /* - * The order of the sensitivity threshold label. Any label at or above this order will be considered sensitive. If set to -1, sensitivity by labels is turned off + * The order of the sensitivity threshold label. Any label at or above this order will be considered sensitive. If + * set to -1, sensitivity by labels is turned off */ - @JsonProperty(value = "sensitivityThresholdLabelOrder") private Float sensitivityThresholdLabelOrder; /* * The id of the sensitivity threshold label. Any label at or above this rank will be considered sensitive. */ - @JsonProperty(value = "sensitivityThresholdLabelId") private UUID sensitivityThresholdLabelId; /* * Microsoft information protection built-in and custom information types, labels, and integration status. */ - @JsonProperty(value = "mipInformation") private GetSensitivitySettingsResponsePropertiesMipInformation mipInformation; /** @@ -142,4 +145,57 @@ public void validate() { mipInformation().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("sensitiveInfoTypesIds", this.sensitiveInfoTypesIds, + (writer, element) -> writer.writeString(Objects.toString(element, null))); + jsonWriter.writeNumberField("sensitivityThresholdLabelOrder", this.sensitivityThresholdLabelOrder); + jsonWriter.writeStringField("sensitivityThresholdLabelId", + Objects.toString(this.sensitivityThresholdLabelId, null)); + jsonWriter.writeJsonField("mipInformation", this.mipInformation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetSensitivitySettingsResponseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetSensitivitySettingsResponseProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the GetSensitivitySettingsResponseProperties. + */ + public static GetSensitivitySettingsResponseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetSensitivitySettingsResponseProperties deserializedGetSensitivitySettingsResponseProperties + = new GetSensitivitySettingsResponseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sensitiveInfoTypesIds".equals(fieldName)) { + List sensitiveInfoTypesIds = reader.readArray( + reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()))); + deserializedGetSensitivitySettingsResponseProperties.sensitiveInfoTypesIds = sensitiveInfoTypesIds; + } else if ("sensitivityThresholdLabelOrder".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseProperties.sensitivityThresholdLabelOrder + = reader.getNullable(JsonReader::getFloat); + } else if ("sensitivityThresholdLabelId".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseProperties.sensitivityThresholdLabelId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("mipInformation".equals(fieldName)) { + deserializedGetSensitivitySettingsResponseProperties.mipInformation + = GetSensitivitySettingsResponsePropertiesMipInformation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGetSensitivitySettingsResponseProperties; + }); + } } diff --git a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponsePropertiesMipInformation.java b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponsePropertiesMipInformation.java index fa0a02f11ba0..b4197d36609d 100644 --- a/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponsePropertiesMipInformation.java +++ b/sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/models/GetSensitivitySettingsResponsePropertiesMipInformation.java @@ -5,36 +5,37 @@ package com.azure.resourcemanager.security.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** * Microsoft information protection built-in and custom information types, labels, and integration status. */ @Fluent -public final class GetSensitivitySettingsResponsePropertiesMipInformation { +public final class GetSensitivitySettingsResponsePropertiesMipInformation + implements JsonSerializable { /* * Microsoft information protection integration status */ - @JsonProperty(value = "mipIntegrationStatus") private MipIntegrationStatus mipIntegrationStatus; /* * List of Microsoft information protection sensitivity labels */ - @JsonProperty(value = "labels") private List